Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HTML attributes #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oriolpiera
Copy link

Goal

This PR add support for insert attributes on specific html tags using dicttoxml_attributes and dicttoxml_content as a "reserved words" .

Example with on element

Input:

"name": { 
    "language": { 
        "dicttoxml_attributes": { 
            "id": "1", 
         }, 
         "dicttoxml_content": "This is a text", 
     } 
  }, 

Result:

<name>
    <language id="1">This is a text</language>
</name>

Exemple in a list

Input:

"name": [ {"language": { 
        "dicttoxml_attributes": { 
            "id": "1", 
         }, 
         "dicttoxml_content": "This is a text", 
     }},{"language": { 
      "dicttoxml_attributes": { 
       "id": "2", 
       },  
       "dicttoxml_content": "This is another text", 
       }} 
  ], 

Result:

<name>
    <language id="1">This is a text</language>
    <language id="2">This is another text</language>
</name>

Example with more than one attribute

Input:

"name":  {"language": { 
        "dicttoxml_attributes": { 
            "id": "1", 
            "quality": "45",
            "class": "header"
         }, 
         "dicttoxml_content": "This is a text", 
     }
}, 

Result:

<name>
    <language id="1" quality="45" class="header">This is a text</language>
</name>

@bfontaine
Copy link

This feature has been extensively discussed in #66.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants