Skip to content

Comments

Add support for HTML attributes#77

Open
oriolpiera wants to merge 1 commit intoquandyfactory:masterfrom
oriolpiera:IMP_html_attributes
Open

Add support for HTML attributes#77
oriolpiera wants to merge 1 commit intoquandyfactory:masterfrom
oriolpiera:IMP_html_attributes

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