Skip to main content

Travis (.org) branch   Codecov branch

tagup

tagup is a Python module which provides a reference implementation of the Tagup Language.

This module currently implements version 1.0.0 of the Tagup Language.

Quick Start

from tagup import BaseRenderer, TagDictMixin


class TagupRenderer(TagDictMixin, BaseRenderer):
    pass


renderer = TagupRenderer(
    # Optional initial markup tags.
    tags={
        'bold': r'<span style="font-weight: bold">[\\1]</span>',
    }
)

# Manipulate tags using dictionary syntax.
renderer['link'] = (
    r'<a href="[\\1]" [\if target\target="_[\\target]"]>'
    r'[bold [\if 2\[\\2]\[\\1]]]'
    r'</a>'
)

html = renderer.render_markup(
    r'Click [link target\\blank\[\\url]\here] to visit [link\[\\url]]',
    # Provide optional named (and positional) arguments.
    named_args={'url': 'http://example.com'}
)
print(html)

Changelog

v0.2.3

  • Added "StaticTagMixin," "TagDictMixin" and "TrimMixin" for "BaseRenderer."
  • Added new errors "ImproperlyConfigured," "NamedArgumentMissing," "PositionalArgumentMissing," "TagNotFound" and "TagupSyntaxError."
  • Renamed "stack_trace" to "tag_stack_trace" for all custom errors.
  • Fixed bug in getitem method of "TagStackTrace."

v0.2.2

  • Added support for global named arguments.
  • Added max tag depth enforcement.
  • Fixed bug that prevented the positional loop from functioning when not provided an optional default value.

v0.2.1

  • Added tag prefetching.

v0.2.0

  • Renamed "Renderer" to "BaseRenderer."
  • Refactored "BaseRenderer" to use method overriding for "get_tag" instead of providing "get_tag_callback" to constructor.
  • Removed "cache_tag_ast_callback" from "BaseRenderer" constructor.
  • Removed "trim_args" from "BaseRenderer" constructor.
  • Added a node pre and post processing hook system.
  • Added test cases.
  • Various internal optimizations.

v0.1.3

  • Fixed bug where the "trim_args" option didn't properly remove leading and trailing whitespace in some situations.

v0.1.2

  • Fixed bug where code called "trim()" rather than "strip()."

v0.1.1

  • Added non-standard option to trim whitespace from arguments before tag evaluation.
  • Fixed bug where whitespace was considered when specifying a name/position for argument substitution.

v0.1.0

  • Initial release.

Metadata

Release files for tagup 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tagup 0.2.3
File Size Uploaded
tagup-0.2.3.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tagup 0.2.3
File Interpreter ABI Platform
tagup-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / tagup-0.2.3.tar.gz

Download URL tagup-0.2.3.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
14c1f5d88d3238efb37df49ff461dc5a011913fde180988682b81a80e4f47c76
BLAKE2b-256 checksum
How to use checksums
411906b4ab8697db1e7c19ebe1685b4ebc78217e85893d10b37712994becab01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.3 Linux/4.14.182-1-MANJARO

Release files / tagup-0.2.3-py3-none-any.whl

Download URL tagup-0.2.3-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe175133958d7f43d6a4b7195c4cdac1c117e124ebf9d1e6c201fb6272a00d22
BLAKE2b-256 checksum
How to use checksums
96fbe2a817577a70b389fb037d6cc042d3ac34fb84ee7cc3f59fd772baf56712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.3 Linux/4.14.182-1-MANJARO

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page