Arbitrary tag attributes (feature request)

Previous topic - Next topic

mikosullivan

My Scribus documents are generated by a home-brew content management system. It would be very helpful if there were a way to add arbitrary attributes to any tag in a document. For example, in HTML you can add any attribute if it starts with data-. Something like that would help me note tags with special information for my CMS. Thanks!

RobSay

#1
I'm just another user ... and obviously I don't know exactly what you are try to achieve .. but you can add arbitrary Object "<ItemAttributes>" to frames as child elements of the PageObject. I'm doing this with scripts but if your building the XML from scratch then I think it would be straight forward to add these.

An example of a page object:

        <PAGEOBJECT XPOS="763.307716535433" YPOS="1009.92188976378" OwnPage="4" ItemID="181115408" PTYPE="2"
                WIDTH="510.236220472441" HEIGHT="148.052149219053" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" ANNAME="ctwl_1"
                LOCALSCX="0.836452820446625" LOCALSCY="0.836452820446625" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="0"
                RATIO="1" Pagenumber="0" PFILE="../Source/image/processed034.eps" IRENDER="0" EMBEDDED="0"
                path="M0 0 L510.236 0 L510.236 148.052 L0 148.052 L0 0 Z" copath="M0 0 L510.236 0 L510.236 148.052 L0 148.052 L0 0 Z"
                gXpos="763.307716535433" gYpos="1009.92188976378" gWidth="0" gHeight="0" LAYER="0" NEXTITEM="-1" BACKITEM="-1">
            <PageItemAttributes>
                <!-- this is my arbitrary Item Attribute added via scripter -->
                <ItemAttribute Name="TOC_Alpha_Index" Type="string" Value="Quaternary Waltz, The" Parameter="" Relationship="none" RelationshipTo="" AutoAddTo="none"/>
            </PageItemAttributes>
        </PAGEOBJECT>

In terms of adding arbitrary XML *attributes* to the PAGEOBJECT element - personally I can't see a need for these in Scribus as a product. The ItemAttribute pattern already exists and is supported within the application .. and you can also use these in scripter to pretty much drive anything content like where the end goal is the PDF.

It would of course be possible to create XSL to map each of the <ItemAttribute Name="something" .. > elements to a "data-something" attribute of the PageObject - but then your XML document is not really a scribus document. Personally I'd try and work off the existing XML structure.