Skip to main content

An Attribute class to be used with pandocfilters

Project description

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-attributes

Usage:

from pandocattributes 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-attributes-0.1.6.tar.gz (2.8 kB view hashes)

Uploaded Source

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