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: Node

Mark 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, not NodeWithChildren. 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

nodeid

Node id - always exists (unlike label), automatically assigned, unique within the tree.

label

Unique identifier.

classes

CSS classes for this node.

handrail_depth

The number of ancestors of this node that have a handrail.

number

Node number.

nonum

Whether this node should be automatically given a number.

reftext_template

Reftext template, or "" to use classreftext.

start_point

The start point of the corresponding concrete syntax tree node.

end_point

The end point of the corresponding concrete syntax tree node.