Code comment

Previous topic - Next topic

iohann

I am working with a text editor on my sla code. How do I include a comment ?

Thanks in advance for your help.

iohann

hjh

#1
As the Scribus sla file is a XML file you may use the regular syntax for comments:

https://www.w3.org/TR/REC-xml/#sec-comments

<!-- Page definition -->
Scribus does not complain when opening the sla file.

However if you change something in Scribus and save the file the comments are not maintained. But for learning purposes and reverse engineering/documentation purposes this is useful.

Also noteworthy is that you can have newlines between attributes in the tags as in any XML file thus making the (generated) code more readable.

Example
    <!-- Page definition -->
        <PAGE PAGEXPOS="100.00062992126" PAGEYPOS="20.0012598425197"
        PAGEWIDTH="595.275590551181" PAGEHEIGHT="841.889763779528"
        BORDERLEFT="40" BORDERRIGHT="40" BORDERTOP="40" BORDERBOTTOM="40"
        NUM="0" NAM="" MNAM="Normal"
        Size="A4" Orientation="0"
        LEFT="0" PRESET="0"
        VerticalGuides="" HorizontalGuides=""
        AGhorizontalAutoGap="0" AGverticalAutoGap="0" AGhorizontalAutoCount="0" AGverticalAutoCount="0" AGhorizontalAutoRefer="0" AGverticalAutoRefer="0" AGSelection="0 0 0 0"
        pageEffectDuration="1"
        pageViewDuration="1" effectType="0" Dm="0" M="0" Di="0"/>


--Hannes

iohann

Thanks for the rapid response. Is there no way to comment sla code that persists after a save at the GUI ?

hjh

#3
Hi Iohann

I do not know Scribus enough to answer this question generally.

But one thing which will help for orientation searching in the XML file is to give text and image frames a name. When text frames are created Scribus gives names like 'Text1', 'Text2', 'Text3' and so on.
However these names are not saved in the code and if you reopen the sla file these automatically generated names may be different.

But if you add a name manually in the F2 properties box the names are saved in an attribute called ANNAME (e.g. ANNAME="myTextFrame1").

Names may also be assigned when creating frames with a script.

And in menu 'File -> Document Setup -> Document Information' you may also add comment which will be preserved.

HTH

--Hannes

iohann

Thanks for the responses. Seems there is no way to comment sla code and have those comments persist through a GUI save.

iohann

Only workaround I've found is : add an "invisible" text box, e.g. 1mm x 1mm. Text can be added to this box. Will be invisible in rendered document because all text will be "overflow".