Skip to main content

Opinionated parsing of gemtext.

Project description

trimgmi

Opinionated parsing of gemtext.

Usage

See "convert", "command" and "sample" modules for examples.

FIXME: Document this in more detail.

Description

Gemtext (GMI) is a lightweight, line-oriented markup language designed for the Gemini internet protocol. This module parses gemtext, ignoring extraneous whitespace. Text after closing ``` marks is also ignored.

The resulting objects can be rendered line-by-line without further parsing logic.

Also included are:

  • round-trip render back to GMI with minimal whitespace
  • simple render to CommonMark
  • opinionated render to HTML
  • primitive command line tools for the above

Read more about gemtext (requires Gemini client):

Read more about gemtext (proxy for web clients):

Implementation

This module has no external dependencies.

This implementation is deliberately verbose so that a developer can confirm by reading that the parser follows the gemtext specification. Optimising the core module is out-of-scope.

Testing

The following commands should run without changing the target files:

trimgi test_search
# example.gmi remains tidy
# example.txt remains untidy
# *.license remain unchanged

convertgmi gmi README test_output/README.gmi  # identical
convertgmi md README test_output/README.md  # readable
convertgmi html README test_output/README.html  # readable

FIXME: Implement and document a comprehensive round-trip test harness.

Build

python setup.py sdist bdist_wheel

If everything works as expected you should end up with the files:

dist/trimgmi-<version>-py3-none-any.whl
dist/trimgmi-<version>.tar.gz

You can now optionally upload to PyPI:

twine upload dist/*

Sharing and contributions

trimgmi
https://gitlab.com/lofidevops/trimgmi
Copyright 2022 David Seaward and contributors
SPDX-License-Identifier: GPL-3.0-or-later

Shared under GPL-3.0-or-later. We adhere to the Contributor Covenant 2.0 without modification, and certify origin per DCO 1.1 with a signed-off-by line (git -s). Contributions under the same terms are welcome.

For details see the LICENSES folder, CODE_OF_CONDUCT.md (report via private ticket) and CONTRIBUTING.DCO.txt.

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

trimgmi-0.0.3.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

trimgmi-0.0.3-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file trimgmi-0.0.3.tar.gz.

File metadata

  • Download URL: trimgmi-0.0.3.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for trimgmi-0.0.3.tar.gz
Algorithm Hash digest
SHA256 099d03b29616ff1b85c6a060967beaabb52e7e6e0266636d3fa43723b57c1a8b
MD5 922e14b758e90c274a1dfb3eb7a0d9e1
BLAKE2b-256 81f1d47eca1fa8cf199b2ff19128347f200c0e9fa4fe1a9279c241d21298e991

See more details on using hashes here.

File details

Details for the file trimgmi-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: trimgmi-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for trimgmi-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3a042faf72c887ada2eb7dcd895b13b5f8c1861cd047369040c227ab26bd2534
MD5 b63262ee448a7b583e063c75a289a5f3
BLAKE2b-256 ddc798261d2618ef402b573a2dfc66557c2475fba1735155c2da3762f98efd37

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