#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 - 2009-09-18

    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.

  • Jeffrey C. Jacobs


    I believe the problem was that I needed to set an attribute on the Root node via a directive but because of the Title Transform it was getting lost. I think the idea was that setting the attribute directly on the title was counter-intuitive that it would then apply to the entire document and that fundamentally root and title attributes should be merged when combining not replaced, losing any settings in the original root.

    In other words, imagine a document-level directive; it would lie in the root node. However it would be lost at the time of the Title transform.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks