Skip to main content

Generate Akoma Ntoso from Plain Text Laws

Project description

Canadian Legal Enactments in Akoma Ntoso (CLEAN)

About

Akoma Ntoso is a markup language for legislative documents.

In the same way that Markdown is a plain-text markup language for generating HTML, CLEAN is a plain-text markup language for generating Akoma Ntoso representations of Canadian statutes and regulations.

Installation

pip install clean-law

Usage

Write your markup, load it into a string variable, and run

from clean.clean import generate_akn

text = """Title

1. Section one."""

print(generate_akn(text))

# <?xml version="1.0" encoding="UTF-8"?><akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0"><act><preface><p class="title"><shortTitle>Title</shortTitle></p></preface><body><section eId="sec_1"><num>1</num><content><p>Section one.</p></content></section></body></act></akomaNtoso>

Format

A CLEAN-formatted piece of legislation has the following features:

Title

The title of the act is the first line of the file.

Headers

Sections and Sub-Sections can have headers, which is a single line of text immediately above the section or subsection, preceded by a blank line.

It is necessary to precede headers with a blank line in order to distinguish them from sandwich text, described below.

Insert Indexes

When making amendments to legislation, we want to be able to insert parts without changing the numbering of the existing parts, at least until there is a revision of the statute book. This is accomplished by using insert indexes, which are always a period, followed by a number, which increases sequentially.

If you want to insert a new section between two existing inserted sections, the insert indexes can nest, as follows:

1.
  (1)
  (1.1) - first inserted sub-section. 
  (1.1.1) - third inserted sub-section.
  (1.2) - second inserted sub-section
  (2)

For all of the index types, sections, sub-sections, paragraphs, and sub-paragraphs, the insert indexes appear to the right of the index number, and before any closing punctuation, as follows:

1.1.
  (1.1)
    (a.1)
      (i.1)

Sections

Sections are indicated by a section index which is an arabic number followed by a period.

A section may have a header.

A section index may be followed by the text of the section. If it is, it may also have an indented list of sub-sections, or paragraphs (but not both). If It has an indented list of sub-sections or paragraphs, it can also have "sandwich text" at the bottom.

Here are some valid sections:

1. This is a section.
2. This is a section with
  (1) a subsection.

Section Three
3. This is a section with a header, and
  (a) paragraphs
and sandwich text.
3.1 As with all text, it
can be spread across multiple lines.

Note that you can use indexes, such as in a cross-reference, inside the text of a section, but only if the index does not appear at the start of a line.

1. If you want to refer to sub-section (2), this
will work just fine.

2. If you want to refer to sub-section
(1) this will not work.

Sub-Sections

Sub-sections are indicated with an index of an arabic number in parentheses. They must be indented from their parent section. They can have a header, which also must be indented the same amount. They must be followed by legal text, and may also then have an indented list of paragraphs. If there is an indented list of paragraphs, it may be followed by sandwich text.

Legal text can go across multiple lines, but if they appear at the start of a line, that will cause confusion.

1. This is a section.
  (1) This is the first sub-section.
    (a) the first subsection has paragraphs.
  with sandwich text.

  Named Sub-Subection
  (2) This is a subsection with a header, and
  which refers to subsection (1) in a way
  that works. 

Paragraphs

Paragraphs are indented from a section or sub-section, and are indicated with a lower-case alphabetic character or characters surrounded by parenthesis. They must then have legal text, which can span across lines in the same way as in sections and sub-sections. A paragraph can have an indented list of sub-paragraphs. Paragraphs cannot have a header.

Sub-Paragraphs

Sub-paragraphs are indented from a paragraph, and are indicated wth a lower-case roman numeral surrounded in parentheses. They must have legal text, which can span across lines in the usual way. Sub-paragraphs cannot have further sub-divisions, and cannot have a header.

Spans

Akoma Ntoso provides a mechanism for you to identify a sub-part of a block of text inside a law. In CLEAN you can create these named spans by using the following syntax: [name]{contents}.

1. This is an example of the text of a section [name]{with
a named span of text} included in it.

The name given to a span between the square brackets must not have any spaces in it. It should be unique to be useful. Spans can be nested inside one another.

An Example

An example act might look like this:

Rock Paper Scissors Act

Players
1. A game of rock paper scissors has two players.
2. There are three signs:
  (a) Rock,
  (b) Paper, and
  (c) Scissors.

Defeating Relationships
3.
  (1) Rock beats Scissors,
  (2) Scissors beats Paper, and
  (3) Paper beats Rock.

Winner
4. The winner of a game is the player who throws
a sign that beats the sign of the other player.

Known Issues

Some things to be aware of if you are playing with it:

  • there is no validation of roman numerals. If it uses i, v, x, etc., it will be accepted

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

clean-law-0.0.4.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

clean_law-0.0.4-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file clean-law-0.0.4.tar.gz.

File metadata

  • Download URL: clean-law-0.0.4.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.10.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for clean-law-0.0.4.tar.gz
Algorithm Hash digest
SHA256 cbe783fd00c8ddd4ffa9119e6839a28f0cb90315a59a28f9061f26b5a6598ef6
MD5 8c5c950673d597518cf16734b3dc0598
BLAKE2b-256 fe9d0a2fefedd2652ea01afec64465caff7c680501cadd8f0e7392e6c61be202

See more details on using hashes here.

File details

Details for the file clean_law-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: clean_law-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.10.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for clean_law-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 22660771d31b00686fa88b021331f009550e7f3622039f216deab177a2b045c5
MD5 69be19a1c76cb90c48994c7882076de8
BLAKE2b-256 c0de64772ff05c65f346f238751e7731b753291ec1e769a7ab9c0d446bf4dad1

See more details on using hashes here.

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