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


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pandoc-attrs, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size pandoc-attrs-0.1.7.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page