Skip to main content

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

Project description

LeidenMark

$ 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 = """\
<D=.r<=
1. Lorem ipsum dolor
vac.1lin
2. sit amet, con[ca.3]c
3.-etur adipiscing
=>=D>
<D=.v<=
lost.2lin
6. ut labore et dol
7.-ore magna aliqua
=>=D>"""
>>> leiden_plus(content, indent=True)

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

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

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

Configuration

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

Uploaded Source

Built Distribution

leidenmark-0.1.26-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file leidenmark-0.1.26.tar.gz.

File metadata

  • Download URL: leidenmark-0.1.26.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.1

File hashes

Hashes for leidenmark-0.1.26.tar.gz
Algorithm Hash digest
SHA256 a0114710f0c3f37867907d577fdd51b03f657c3599faa8fd8cc6a550faf11d22
MD5 3ebcdb9db652b369f04d04a761a7e30c
BLAKE2b-256 51a720d51b5ee7cc25cbf0e7c04a9b67907a33a9b652722467cb467a48bf6d52

See more details on using hashes here.

File details

Details for the file leidenmark-0.1.26-py3-none-any.whl.

File metadata

  • Download URL: leidenmark-0.1.26-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.1

File hashes

Hashes for leidenmark-0.1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 cf7bd56d133345b3b81b28826a0144ff59a5ea6a6d491bc78ae39df73d21865f
MD5 15b06559d9b6b5ef3d742776df59cd76
BLAKE2b-256 6ef9602c115062b60c02c1cc2ac86e5155bc01a6bddc4a7f1223cc0e337d31a2

See more details on using hashes here.

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