A lightweight library for working with Akoma Ntoso Act documents
Project description
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.
Read the full documentation at cobalt.readthedocs.org.
Quickstart
Install using:
$ 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 ]
Contributing
Clone the repo
Install development dependencies:
pip install -e .[dev]
Make your changes
Run tests:
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
Build artefacts:
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.
Change Log
3.1.1
FIX issue where a four-digit number in an FRBR URI confuses the parser
3.1.0
Replace arrow with iso8601, avoiding arrow issue 612
3.0.0
Python 3.6 and 3.7 support
Drop support for Python 2.x
2.2.0
FIX don’t mistake numbers in uris with subtypes and numeric numbers as actors
FIX link to GitHub
Unicode literals when parsing FRBR URIs
2.1.0
FIX don’t strip empty whitespace during objectify.fromstring
2.0.0
FIX don’t pretty-print XML, it introduces meaningful whitespace
1.0.1
FIX FrbrUri clone bug when a URI had a language.
1.0.0
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.
0.3.2
Inject original img src as data-src
0.3.1
Support for i18n in XSLT files, including all 11 South African languages from myconstitution.co.za
0.3.0
Support for images
Change how XSLT params are passed to the renderer
Add expression_frbr_uri method to Act class
0.2.1
When rendering HTML, ensure primary container elements and schedules have appropriate ids
0.2.0
When rendering HTML, scope component/schedule ids to ensure they’re unique
0.1.11
Render ref elements as HTML a elements
Optionally prepend a resolver URL before a elements
0.1.10
Convert EOL elements to BR when changing XML to HTML
0.1.9
Support dates before 1900. Contributed by rkunal.
0.1.8
lifecycle and identification meta elements now have a configurable source attribute
0.1.7
TOCElement items now include a best-effort title
0.1.6
Use HTML5 semantic elements section and article when generating HTML for acts
0.1.5
FIX use schedule FRBRalias as heading
0.1.4
Transforming XML to HTML now includes all attributes as data- attributes
0.1.3
Refactor TOC helpers into own file
Fix .format in FrbrUri
0.1.1
first release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cobalt-3.1.1.tar.gz
.
File metadata
- Download URL: cobalt-3.1.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb663cd3978cc7abd8fff761c7c668e55b8c8da307ebaaab7739bb613f44957b |
|
MD5 | 29029bd6a599710c11fa5231cdb49403 |
|
BLAKE2b-256 | 9e2585ddd9c9596e2ea610f4f5bf18f0ffe5a19e81a430eb1e5e88d7970a5d1e |
File details
Details for the file cobalt-3.1.1-py3-none-any.whl
.
File metadata
- Download URL: cobalt-3.1.1-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0a231af6093fa78d5b0f2c56be8cfe86b13931a3e6ea0c274b7271bbb68ec64 |
|
MD5 | 371448c0c129688ec0a9e9bdda69e2f4 |
|
BLAKE2b-256 | 5107769ce7192f6fc93ca3dd18f97704ad48ce8459987cd5fd3be5ed8201bd17 |