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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mau_html_visitor-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ec266519d4f6c383d87aaf6aebf9e3a8b15fe89e7a10680e814b427981a7d720
MD5 d43aa1b0f0abf3881bd962f0f9639aea
BLAKE2b-256 e311608c6a74af23be2d692010563d2e748ad142bf2a888fbf1360e1354b6664

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mau_html_visitor-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 767bd6a5a5acc827e8269285bb9f757a86a54af0e936495740bc50e6155d37d7
MD5 fa8290186f71a15b43d946a014655c13
BLAKE2b-256 0dae7c7a70c990acd1c9867d6e8ca643214049e53d417200bf88fb9029471120

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