Skip to main content

An Attribute class to be used with pandocfilters

Project description

pandoc-attrs

This is a simple parser / emitter for pandoc block attributes, intended for use with pandocfilters.

It can read and write attributes in any of these formats: - markdown - html - dictionary - pandoc

Installation:

pip install pandoc-attrs

Usage:

from pandocattrs import PandocAttributes

attrs = '#id .class1 .class2 key=value'
attributes = PandocAttributes(attrs, format='markdown')

attributes.to_markdown()
>>> '{#id .class1 .class2 key=value}'

attributes.to_dict()
>>> {'id': 'id', 'classes': ['class1', 'class2'], 'key'='value'}

attributes.to_html()
>>> id="id" class="class1 class2" key='value'

attributes.to_pandoc()
>>> ['id', ['class1', 'class2'], [['key', 'value']]]

attributes.id
>>> 'id'

attributes.classes
>>> ['class1', 'class2']

attributes.kvs
>>> OrderedDict([('key', 'value')])

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

pandoc-attrs-0.1.7.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file pandoc-attrs-0.1.7.tar.gz.

File metadata

  • Download URL: pandoc-attrs-0.1.7.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

File hashes

Hashes for pandoc-attrs-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b717e80f4739323c40993e248fd379f900ce3dfd4a596509df0b8a39aab11525
MD5 c9e043de035ac516eaa7f78ebebb1bad
BLAKE2b-256 f883120151a2f4286ca9ce7f76655a959cfcbf5c4ab26b8b459d1a1f81f92f88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page