app#
Applications that execute the steps of the RSM file processing pipeline.
Classes in this module use the steps implemented elsewhere (rsm.reader
,
rsm.tsparser
, etc) and actually execute those steps, feeding the output of one
step into the next. The base class for all of these is RSMApp
, which stores
the sequence of steps and executes them all via a run()
method.
The three main applications provided currently are make()
, render()
, and
lint()
. These simply instantiate an object of class FullBuildApp
,
LinterApp
, ProcessorApp
, respectively, and call their run()
method.
The functions make()
, render()
, and lint()
can be called directly via
rsm.make()
, rsm.render()
, and rsm.lint()
. They each receive RSM source
(either a string or a path to a file), run the application, and return the result. For
more control over the execution, or post-execution inspection, instantiate the
appropriate class manually. For example:
This
>>> src = ":manuscript: Hello, RSM! ::"
>>> html = rsm.make(source=src)
Is essentially equivalent to the following.
>>> app = FullBuildApp(plain=src)
>>> html = app.run()
Except that now, ``app`` can be inspected.
>>> print(app.parser.ast.sexp())
(Manuscript
(Paragraph
(Text)))
The module rsm.cli
exposes these apps as command line utilities.
The RSM library code (i.e. all of the previous modules) does not itself set up any
logging facilities. This is at recommendation
of the Python standard library. Instead, this module uses the functions in
rsm.rsmlogger
before executing an application. In other words, manually handling
RSM source with classes such as rsm.tsparser.TSParser
or
rsm.transformer.Transformer
will not issue any logging messages, while calling
the run()
method on an RSMApp
instance will.
Classes
A sequence of |
|
A step in a |
Functions
- rsm.app.lint(source='', path='', handrails=False, loglevel=30, log_format='rsm', log_time=True)[source]#
- rsm.app.make(source='', path='', handrails=True, lint=True, loglevel=30, log_format='rsm', log_time=True)[source]#
- rsm.app.render(source='', path='', handrails=False, loglevel=30, log_format='rsm', log_time=True)[source]#
Exceptions
|