Build text/gemini files from Python
Project description
gemini_builder
This Python package makes creation of Gemini text documents for Project Gemini a little easier.
To create a document, instantiate the Page class and add lines using the appropriate methods. Finally, you can convert the page to a string, print it, etc.
Methods
The following methods are used to add content to the page:
add_raw_line(raw_line)
Add any text as a line. Be cautious or you will screw everything up.
add_text(line=None)
Add normal text as a line. Can also be used to add an empty line.
add_heading(text, level=1)
Add a heading line. You can provide a level of 1, 2 or 3.
add_link(url, label=None)
Add a link line. The URL must already be properly quoted.
add_quote(quote)
Add a quote line.
add_list(items)
Add a list. The items argument should be an iterable that returns strings.
add_preformatted_lines(preformatted_lines, alt_text=None):
Add a block of preformatted lines. The preformatted_lines argument should be an iterable that returns strings. The optional alt_text argument will be added to the opening toggle line if present.
Exceptions
The following exceptions can be thrown:
GeminiBuilderException
Base class for all exceptions. Not instantiated.
InvalidHeadingLevelException
You tried to add a heading with a level that is not 1, 2 or 3.
NotIterableException
You tried to add a list but provided a non-iterable argument.
InvalidTextLineException
You provided a text line that starts with one of the reserved characters. Use add_raw_line to add any raw content.
PreformattedLineCannotStartLikeThisException
One of your pre-formatted lines begins with the reserved sequence for preformatted lines.
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 gemini_builder-0.1.0.tar.gz
.
File metadata
- Download URL: gemini_builder-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23e2e70e7613e03a596a5107c786bbaa03fa86432f1c20123879f600e5f7f481 |
|
MD5 | e8ed0f9c57ee32082272d953e1c820e0 |
|
BLAKE2b-256 | a016d1cc943635f30932fe854f61c830590a6a116a7e45f3ecb72b641711c417 |
File details
Details for the file gemini_builder-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: gemini_builder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0d9c6da98b415b45ccf27a59d51ce870e570478f523736430af434c12f92a34 |
|
MD5 | 3a23601ca7f3785c73b821c1bbb4e383 |
|
BLAKE2b-256 | daee9e59775d3a4bc972bda0165c63827c55b814b141e4c629892e33ecf94de9 |