A lightweight library for working with Akoma Ntoso Act documents
Cobalt is a lightweight Python library for working with Akoma Ntoso Act documents. It makes it easy to work with Akoma Ntoso metadata, FRBR URIs and generate Tables of Contents for a document.
It is lightweight because most operations are done on the XML document directly without intermediate objects. You still need to understand how Akoma Ntoso works.
$ pip install cobalt
Use it like this:
>>> from cobalt import Act >>> act = Act() >>> act.title = "Act 10 of 1980" >>> act.frbr_uri = "/za/act/1980/10" >>> act.year '1980' >>> act.number '10' >>> print act.to_xml() [ lots of xml ]
Clone the repo
Install development dependencies:
pip install -e .[dev]
Make your changes
nosetests && flake8 cobalt
Send a pull request
Releasing a New Version
Run the tests!
Update VERSION appropriately
Update the Change Log section in README.rst
Commit and push to github
Release to PyPI:
python setup.py sdist bdist_wheel upload
License and Copyright
Cobalt is licensed under the LPGL 3.0 license.
Cobalt is Copyright 2015-2017 AfricanLII.
- Inject original img src as data-src
- Support for i18n in XSLT files, including all 11 South African languages from myconstitution.co.za
- Support for images
- Change how XSLT params are passed to the renderer
- Add expression_frbr_uri method to Act class
- When rendering HTML, ensure primary container elements and schedules have appropriate ids
- When rendering HTML, scope component/schedule ids to ensure they’re unique
- Render ref elements as HTML a elements
- Optionally prepend a resolver URL before a elements
- Convert EOL elements to BR when changing XML to HTML
- Support dates before 1900. Contributed by rkunal.
- lifecycle and identification meta elements now have a configurable source attribute
- TOCElement items now include a best-effort title
- Use HTML5 semantic elements section and article when generating HTML for acts
- FIX use schedule FRBRalias as heading
- Transforming XML to HTML now includes all attributes as data- attributes
- Refactor TOC helpers into own file
- Fix .format in FrbrUri
- first release
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|cobalt-0.3.2-py2-none-any.whl (18.8 kB) Copy SHA256 hash SHA256||Wheel||2.7||Mar 9, 2018|
|cobalt-0.3.2.tar.gz (15.9 kB) Copy SHA256 hash SHA256||Source||None||Mar 9, 2018|