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 tag:
git tag vX.X.X git push -u origin --tags
rm -rf build dist && python setup.py sdist bdist_wheel
Upload to PyPI:
twine upload dist/*
License and Copyright
Cobalt is licensed under the LPGL 3.0 license.
Cobalt is Copyright 2015-2017 AfricanLII.
- Replace arrow with iso8601, avoiding [arrow issue 612](https://github.com/crsmithdev/arrow/issues/612)
- Python 3.6 and 3.7 support
- Drop support for Python 2.x
- FIX don’t mistake numbers in uris with subtypes and numeric numbers as actors
- FIX link to GitHub
- Unicode literals when parsing FRBR URIs
- FIX don’t strip empty whitespace during objectify.fromstring
- FIX don’t pretty-print XML, it introduces meaningful whitespace
- FIX FrbrUri clone bug when a URI had a language.
- Move table of contents, render and other locale (legal tradition) specific functionality out of Cobalt.
- FIX bug that returned the incorrect language when extracting a document’s expression URI.
- 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||File type||Python version||Upload date||Hashes|
|Filename, size cobalt-3.1.0-py3-none-any.whl (10.2 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size cobalt-3.1.0.tar.gz (12.2 kB)||File type Source||Python version None||Upload date||Hashes View hashes|