Skip to main content

A visitor for Mau that converts the AST into HTML

Project description

Mau HTML Visitor

This is a plugin for the Mau markup language. The plugin provides the conversion from Mau source to HTML.

You can install this plugin with

pip install mau-html-visitor

and Mau will automatically be able to load it. To use the visitor you need to load it and to pass it to the class Mau when you instantiate it

from mau import Mau, load_visitors

visitor_classes = load_visitors()

visitors = {i.format_code: i for i in visitor_classes}
visitor_class = visitors["html"]

mau = Mau(
    "path/of/the/source",
    visitor_class=visitor_class,
)

lexer = self._mau.run_lexer(text)
parser = self._mau.run_parser(lexer.tokens)
content = self._mau.process(parser.nodes, parser.environment)

if visitor_class.transform:
    content = visitor_class.transform(content)

The default extension for templates is .html. The plugin uses Pygments to provide source code highlighting.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mau_html_visitor-2.0.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

mau_html_visitor-2.0.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file mau_html_visitor-2.0.0.tar.gz.

File metadata

  • Download URL: mau_html_visitor-2.0.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for mau_html_visitor-2.0.0.tar.gz
Algorithm Hash digest
SHA256 7772bb7b596f125d8426b39938b2f4b118b07783f299a8cdf1e83f6a568bc235
MD5 8d1b1e8f790b38fc699d7bc1d3d13f96
BLAKE2b-256 38c1205cd5bd27b88139a044fef03c97c2932749c70fcb7735f9cc21d3dd25ad

See more details on using hashes here.

File details

Details for the file mau_html_visitor-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mau_html_visitor-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2445572eb53e314dfb7d7b6602c5ef7fdd0135440b919125480e5b7ece4a18a2
MD5 0d7dbceb429e8dbb46d01a767da9a94d
BLAKE2b-256 1f2a31c1b1f4bb5c2fac6730ed381c7eb10bd8d9c09404f76a3e04d15f3cc053

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page