#18 Attributes in the main document are overriden


Any attributes set to the root document node are lost during a Title Promotion transformation because the update function is called instead of merging the attributes of the section into the document. For example, if a name is appended to the 'classes' attribute of the root document, this name is lost during the current version of the TitlePromoter transform. What I propose in the associated patch is to add more functionality to the Element class to handle generic attribute assignment and merging and then to call this instead of directly updating the attribute dictionary as done in the current code. This method has the ability to append rather than overwrite the basis attributes of an element as well as append any list elements in both the document and the section being merged in and replacing any attributes that are not both of list type with the values in the section node. This preserves the values in the document class list attributes as the user would expect.


  • Günter Milde
    Günter Milde

    The proposed patch (http://sourceforge.net/tracker/?func=detail&aid=2714873&group_id=38414&atid=422032)
    is quite heavy. The test case involves a custom directive.

    Before including such a change into Docutils I would like to see a convincing use case and rule out simpler solutions.