The lang.html module

Html language and transformation definition (for lilypond-book).

class Html[source]

Bases: XmlLike, Html

Html language definition, with support for the lilypond-book tags.

Those are: <lilypond ... /> for short code, <lilypond> ... </lilypond> for longer code, <lilypondfile>filename</lilypondfile> for a LilyPond file, and <musicxmlfile>filename</musicxmlfile> for a MusicXml file.

These tags also support the attribute notation that’s outlined in the LilyPond documentation.

root = Html.root
lilypond_book_options = Html.lilypond_book_options
class HtmlTransform[source]

Bases: Transform

Transform Html (for lilypond-book) to quickly.dom.htm elements.

Note that this transform currently ignores the following lexicons: css_style_attribute, css_style_tag, doctype, internal_dtd and script_tag.

This means the constructed htm.Document cannot write back the full document. You should only rely on the lilypond-tags and their content.

The alternative would be to disable css and javascript in the inherited parce language definition, but then we loose the nice highlighting of CSS and JS parts.

factory(element_class, head_origin, tail_origin=(), *children)[source]

Create a node, keeping its origin.

The head_origin and optionally tail_origin is an iterable of Token instances. All items should be created using this method, so that it can be overridden for the case you don’t want to remember the origin.

css_style_attribute = None
css_style_tag = None
doctype = None
internal_dtd = None
script_tag = None

Process the root context.


Process the attrs context.

Returns a list of htm.Attribute elements and a tail_origin tuple.


Process the cdata context.


Process the comment context.


Process the dqstring context.


Process the sqstring context.


Process the processing_instruction context.


Process the tag context.

Returns a list of nodes representing the contents.


Process the lilypond_book_options context.

Returns a list of Attribute elements and a tuple with the ending delimiter (: or > or />).

class HtmlAdHocTransform[source]

Bases: AdHocTransform, HtmlTransform

Html Transform that does not keep the originating tokens.