Skip to main content

A markdown extension for converting Leiden+ epigraphic text to TEI Epidoc XML

Project description


$ pip install leidenmark

A Python Markdown extension for converting Leiden+ epigraphic text to TEI XML/HTML. Inspired by the Brill plain text (BPT) format that aims to incorporate Leiden+ into a Markdown-based syntax.

>>> from leidenmark import leiden_plus
>>> content = """\
1. Lorem ipsum dolor
2. sit amet, con[ca.3]c
3.-etur adipiscing
6. ut labore et dol
7.-ore magna aliqua
>>> leiden_plus(content, indent=True)

The output of the above lines is the following XML snippet:

<div n="r" type="textpart">
    <l n="1">Lorem ipsum dolor</l>
    <space quantity="1" unit="line"/>
    <l n="2">sit amet, con<gap precision="low" quantity="3" reason="lost" unit="character"/>c</l>
    <l break="no" n="3">etur adipiscing</l>
<div n="v" type="textpart">
    <gap quantity="2" unit="line"/>
    <l n="6">ut labore et dol</l>
    <l break="no" n="7">ore magna aliqua</l>

leiden_plus() is syntactic sugar for the registered Markdown extension, and equivalent to:

>>> import leidenmark
>>> from markdown import markdown
>>> markdown(content, extensions=['leiden_plus']) # Other extensions can be added to this list


Given that this is a Markdown extension, conventions like *italics* and **bold** will also be recognized an converted (these in particular will additionally be transformed to the TEI element <hi>). Though these are in principle not part of the Leiden+ syntax, in practice the use of italics and boldface is still encountered a lot. Therefore, support is maintaned by default, which can be switched off by passing strict=True:

>>> leiden_plus(content, strict=True)

NB: The blockprocessors for paragraphs and ordered list are always switched off, because they interfer too much with Leiden+.

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

leidenmark-0.2.2.tar.gz (12.2 kB view hashes)

Uploaded source

Built Distribution

leidenmark-0.2.2-py3-none-any.whl (16.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page