Read/write LSF plain-text container format files
Project description
lsf
LSF (Lion's Sectioned Format) is a plain-text container format.
It features:
- header & content sections
- titles for all sections (except the header)
- tags for all sections
- body text for each section
LSF files are always UTF-8 encoded.
An example LSF File
title: My Blog
tags: blog
This is my blog.
== 2021-01-20 ==
tags: blogpost datepage github
date: 2021-01-20
Today I uploaded my lsf module to PyPI.
== 2021-01-18 ==
tags: blogpost datepage holiday
date: 2021-02-10
Today was Martin Luther King Day.
This file has a header section, and two content sections (2021-01-20, 2021-01-18). All sections have tags and body text content.
lsf-lions-own-sectioned-format
The "lsf-lions-own-sectioned-format" distribution package contains lsf.py, which reads and write LSF files.
Example of Use
Here's reading an LSF file:
import lsf
L = lsf.loadfile("basic_blog.lsf")
for section in L:
print(section[lsf.TITLE])
print(" " + section[lsf.KEYS].get("tags"))
And adding a section:
lsf.append(L, "A Title", {"date": "2021-01-19", "tags": "test"}, "This is a new entry.")
And saving to the file:
lsf.savefile(L, "basic_blog.lsf")
Section Dictionaries
Each section has a dictionary of the form:
{TITLE: "...a title...",
KEYS: {"key1": "value 1", "key2": "value 2", ...},
BODY: "Central\nBody\nText\n"}
...which corresponds to section:
== ...a title... ==
key1: value 1
key2: value 2
...
Central
Body
Text
It's safe to manipulate data in place.
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
Close
Hashes for lsf-lions-sectioned-format-2021.1.20.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe282f601dcb0406e6e9c0c5f3bf5ee347351285c2dc3a834ad1e5e82ae4f501 |
|
MD5 | bf2855a9782c45bb48f016afe3e34dc1 |
|
BLAKE2b-256 | 19bcd92e155176ae31bab327031042bab688121de1f75e26af1dc9c07b1f9de2 |
Close
Hashes for lsf_lions_sectioned_format-2021.1.20-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bb0a2d60c04b9dd97adc5b2810ae3ef9c8ab5cc4f9e49ec8ea46e71f1751ea3 |
|
MD5 | 8b4a181007f9b32aad0d50ca32266850 |
|
BLAKE2b-256 | d359077b194c465ef3d590474bc5c068564e3c27ee99a0aae0c38536c0301bac |