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

Overview

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" reason="lost" 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+.

You might also like...
Comprehensive Markdown plugin built for Django
Comprehensive Markdown plugin built for Django

Django MarkdownX Django MarkdownX is a comprehensive Markdown plugin built for Django, the renowned high-level Python web framework, with flexibility,

Awesome Django Markdown Editor, supported for Bootstrap & Semantic-UI
Awesome Django Markdown Editor, supported for Bootstrap & Semantic-UI

martor Martor is a Markdown Editor plugin for Django, supported for Bootstrap & Semantic-UI. Features Live Preview Integrated with Ace Editor Supporte

Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed. Now in Python!

markdown-it-py Markdown parser done right. Follows the CommonMark spec for baseline parsing Configurable syntax: you can add new rules and even replac

A fast, extensible and spec-compliant Markdown parser in pure Python.

mistletoe mistletoe is a Markdown parser in pure Python, designed to be fast, spec-compliant and fully customizable. Apart from being the fastest Comm

Livemark is a static page generator that extends Markdown with interactive charts, tables, and more.

Livermark This software is in the early stages and is not well-tested Livemark is a static site generator that extends Markdown with interactive chart

Remarkable Markdown Debian Package Fix

Remarkable debian package fix For some reason the Debian package for remarkable markdown editor has not been made to install properly on Ubuntu 20.04

Read a list in markdown and do something with it!

Markdown List Reader A simple tool for reading lists in markdown. Usage Begin by running the mdr.py file and input either a markdown string with the -

Lightweight Markdown dialect for Python desktop apps
Lightweight Markdown dialect for Python desktop apps

Litemark is a lightweight Markdown dialect originally created to be the markup language for the Codegame Platform project. When you run litemark from the command line interface without any arguments, the Litemark Viewer opens and displays the rendered demo.

A Discord Bot for rendering Markdown

Markdown to PDF Bot A discord bot that accepts markdown files (or messages) and displays them as images. Prerequisite To install, you must have have :

Comments
  • `enable_paragraphs` option not working as intended

    `enable_paragraphs` option not working as intended

    When enabling paragraphs, the following unwanted behaviour is occuring:

    >>> leiden_plus('<= Leiden+ section =>', enable_paragraphs=True)
    '<ab><p>Leiden+ section </p></ab>'
    

    This should just be <ab>Leiden+ section</ab>.

    The problem is that <= and => are formatted as different blocks using preprocessors, and stitched together using postprocessors, rendering the text content as a single paragraph in between by the regular markdown paragraph processor. It's probably better to use a mechanism where <= ... => and <D= ... =D> are interpreted as separate blocks.

    opened by andredelft 0
Releases(v0.2.2)
  • v0.2.2(Aug 4, 2021)

  • v0.2.1(Jul 28, 2021)

    This release includes several new processors for broader Leiden+ support, as well as some bugfixes to old ones. The new processors are listed below, linked to the corresponding sections on http://papyri.info

    Special characters

    1. Paragraphos: ----

    Marginalia

    1. Text inserted / added above line: \ὅλων/
    2. Text added between lines: ||interlin: ὧν||

    Other editorial conventions

    1. Handshift: $m4

    Extras (Not yet on papyri.info)

    1. Diples:
      To get this PN preview: (diple)
      Use this Leiden+: ((diple))
      <milestone rend="diple" unit="undefined"/>
      
    2. Eisthesis (indentation):
      To get this PN preview: line in eisthesis
      Use this Leiden+: (1, indent)
      To create this XML: <lb n="1" rend="indent"/>
      
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Jul 28, 2021)

    This release includes:

    • A pytest integration and some first basic tests
    • A new, decentralized processor registration system. Each submodule now has a register function (e.g. register_divisions in divisions.py) that registers the corresponding processors. These functions can also be imported when building a custom extension using this package. Note that individual processors should be imported from their submodules (e.g. from leidenmark.divisions import DivisionsPreproc instead of the former from leidenmark import DivisionsPreproc).
    Source code(tar.gz)
    Source code(zip)
  • v0.1.31(May 11, 2021)

  • v0.1.28(Apr 29, 2021)

Owner
André van Delft
Python & front-end web developer, passionate about digital humanities
André van Delft
Static site generator that supports Markdown and reST syntax. Powered by Python.

Pelican Pelican is a static site generator, written in Python. Write content in reStructuredText or Markdown using your editor of choice Includes a si

Pelican dev team 11.3k Jan 05, 2023
Application that converts markdown to html.

Markdown-Engine An application that converts markdown to html. Installation Using the package manager [pip] pip install -r requirements.txt Usage Run

adriano atambo 1 Jan 13, 2022
Lightweight Markdown dialect for Python desktop apps

Litemark is a lightweight Markdown dialect originally created to be the markup language for the Codegame Platform project. When you run litemark from the command line interface without any arguments,

10 Apr 23, 2022
Pure-python-server - A blogging platform written in pure python for developer to share their coding knowledge

Pure Python web server - PyProject A blogging platform written in pure python (n

Srikar Koushik Satya Viswanadha 10 Nov 07, 2022
A Discord Bot for rendering Markdown

Markdown to PDF Bot A discord bot that accepts markdown files (or messages) and displays them as images. Prerequisite To install, you must have have :

1 Oct 21, 2021
Notedown - Markdown <=> IPython Notebook

Python 2/3 and IPython 4 / Jupyter compatible! Convert IPython Notebooks to markdown (and back) notedown is a simple tool to create IPython notebooks

Aaron O'Leary 840 Jan 04, 2023
Toci is a markdown tool to generate an outline from a given Jupyter notebook.

Toci is a markdown tool to generate an outline from a given Jupyter notebook. It traverses the markdown cells of a given ipynb file to form a toc for you.

Hakan Özler 7 Jan 22, 2022
A fast, extensible and spec-compliant Markdown parser in pure Python.

mistletoe mistletoe is a Markdown parser in pure Python, designed to be fast, spec-compliant and fully customizable. Apart from being the fastest Comm

Mi Yu 546 Jan 01, 2023
Remarkable Markdown Debian Package Fix

Remarkable debian package fix For some reason the Debian package for remarkable markdown editor has not been made to install properly on Ubuntu 20.04

Eric Seifert 37 Jan 02, 2023
A markdown generation library for Python.

Welcome to SnakeMD SnakeMD is your ticket to generating Markdown in Python. To prove it to you, we've generated this entire README using SnakeMD. See

The Renegade Coder 22 Dec 08, 2022
An automated scanning, enumeration, and note taking tool for pentesters

EV1L J3ST3R An automated scanning, enumeration, and note taking tool Created by S1n1st3r Meant to help easily go through Hack The Box machine and TryH

14 Oct 02, 2022
CiteURL is an extensible tool that parses legal citations and makes links to websites where you can read the cited language for free.

CiteURL is an extensible tool that parses legal citations and makes links to websites where you can read the cited language for free. It can be used t

15 Dec 27, 2022
A Python library to retrieve annotations and notes from Zotero and save them into Markdown files.

Zotero to Markdown Generate Markdown files from Zotero annotations and notes. With new Zotero PDF Reader, all highlights are saved in the Zotero datab

Essi Alizadeh 20 Nov 03, 2022
A markdown extension for converting Leiden+ epigraphic text to TEI XML/HTML

LeidenMark $ pip install leidenmark A Python Markdown extension for converting Leiden+ epigraphic text to TEI XML/HTML. Inspired by the Brill plain te

André van Delft 2 Aug 04, 2021
A Python implementation of John Gruber’s Markdown with Extension support.

Python-Markdown This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though

Python-Markdown 3.1k Dec 31, 2022
Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed. Now in Python!

markdown-it-py Markdown parser done right. Follows the CommonMark spec for baseline parsing Configurable syntax: you can add new rules and even replac

Executable Books 398 Dec 24, 2022
Markdown Presentations for Tech Conferences, Training, Developer Advocates, and Educators.

March 1, 2021: Service on gitpitch.com has been shutdown permanently. GitPitch 4.0 Docs Twitter About Watch the Introducing GitPitch 4.0 Video Visit t

David Russell 5.4k Jan 05, 2023
a small simple library for generating documentation from docstrings

inkpot a small simple library for generating documentation from docstrings inkpot is available on pip. Please give it a star if you like it! To know m

Axel Gard 5 Oct 20, 2022
A Straightforward Markdown Journal

Introducing Pepys: A straightforward markdown journal "It is rightly made for those who love to document their daily life events" - FOSSBytes Pepys is

Luke Briggs 23 Nov 12, 2022
😸Awsome markdown readme for your profile or your portfolio

GitHub Profile Readme Description That's a simple and minimalist README.md for your profile Usage You can download or copy to your repository and make

0 Jul 24, 2022