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
root(items)[source]

Process the root context.

attrs(items)[source]

Process the attrs context.

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

cdata(items)[source]

Process the cdata context.

comment(items)[source]

Process the comment context.

dqstring(items)[source]

Process the dqstring context.

sqstring(items)[source]

Process the sqstring context.

processing_instruction(items)[source]

Process the processing_instruction context.

tag(items)[source]

Process the tag context.

Returns a list of nodes representing the contents.

lilypond_book_options(items)[source]

Process the lilypond_book_options context.

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

entityref_action(token)[source]
string_action(token)[source]
class HtmlAdHocTransform[source]

Bases: AdHocTransform, HtmlTransform

Html Transform that does not keep the originating tokens.