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.2.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mau_html_visitor-2.0.2.tar.gz
Algorithm Hash digest
SHA256 c33a07a6ab71b6c633596ac074cc3ce8e66a45917195a56c70a4db78507ecdef
MD5 5412dc000b753a40e2e60138d2f51e32
BLAKE2b-256 7b73679060da4446322a8583c10000b384cb96d28d69203b72c00b7be8a06c78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mau_html_visitor-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c4d1b0b4dc1b4da1ee287eca49cfc8113571bcb7c465f0e10cdec01b232031e6
MD5 9679b765ac9d8a6a8827eb582579923d
BLAKE2b-256 282f626911c08a6df09718572787f81c0940c47a274058c1eaf1adf36820eec6

See more details on using hashes here.

Supported by

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