Appendix#
Qualified name: rsm.nodes.Appendix
- class rsm.nodes.Appendix(label='', classes=None, number=None, nonum=False, reftext_template='', start_point=(-1, -1), end_point=(-1, -1))[source]#
Bases:
NodeMark the start of the Appendix sections.
The Appendix node currently has no visible output in the manuscript. Instead, it affects how subsequent sections are numbered.
Notes
The Appendix must not contain children. In fact, its parent subclass is
Node, notNodeWithChildren. Sections “in” the Appendix should simply appear after an Appendix node.Examples
In RSM markup, the Appendix is a stamp, i.e. it does not need a closing Halmos.
# Before Appendix # Before Appendix ## Subsec :appendix: # After Appendix
The above source is parsed into a Manuscript tree equivalent to the following.
>>> msc = nodes.Manuscript().append( ... [ ... nodes.Section(title="Before Appendix"), ... nodes.Section(title="Before Appendix").append(nodes.Subsection(title="Subsec")), ... nodes.Appendix(), ... nodes.Section(title="After Appendix"), ... ] ... ) >>> print(msc.sexp()) (Manuscript (Section) (Section (Subsection)) (Appendix) (Section))
Run the transform step on this Manuscript so the Sections will be autonumbered.
>>> tform = rsm.transformer.Transformer() >>> tform.transform(msc) Manuscript(parent=None, [Section, Section, Appendix, Section])
By default, Sections appearing after the Appendix receive letter numerals.
>>> for sec in msc.traverse(nodeclass=nodes.Section): ... print(f'{sec.full_number}. {sec.title}') 1. Before Appendix 2. Before Appendix 2.1. Subsec A. After Appendix
Methods
Attributes
nodeidNode id - always exists (unlike label), automatically assigned, unique within the tree.
labelUnique identifier.
classesCSS classes for this node.
handrail_depthThe number of ancestors of this node that have a handrail.
numberNode number.
nonumWhether this node should be automatically given a number.
reftext_templateReftext template, or "" to use
classreftext.start_pointThe start point of the corresponding concrete syntax tree node.
end_pointThe end point of the corresponding concrete syntax tree node.