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

Uploaded Source

Built Distribution

mau_html_visitor-1.0.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mau_html_visitor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0d3465163b17aa1b8764a4f6e007e2ac39f58e71665b8fb218cdd49d5f27f148
MD5 f84e60e70230a116b32df1c5de445dcc
BLAKE2b-256 f6074b6e3956384e3dd44096e301b8e30dcdf1513fc973c5dd3c3467f7d119cc

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mau_html_visitor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9030c8fc505467d579b7ed506004747be79123bea4bd85f598e518b98752afa3
MD5 2ce4ece9ea6aac9f943efc233a8cf634
BLAKE2b-256 cdd95ac5b85ac96dedf735c0c534e1723b95aa6d996f11016c26e26ee1670b4c

See more details on using hashes here.

Provenance

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