Skip to main content

lsf

LSF (Lion's Sectioned Format) is a plain-text container format.

It features:

  • header & content sections
  • titles for all sections (except the header)
  • key-value pairs for all sections (optionally)
  • body text for each section (optionally)

LSF files are always UTF-8 encoded.

Installing

pip install lsf-lions-sectioned-format

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 keys and body text content.

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"))
    print("  " + str(len(section[lsf.BODY])) + " characters in body")

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...",
 TITLELN: 10,
 KEYS: {"key1": "value 1", "key2": "value 2", ...},
 BODY: "Central\nBody\nText\n",
 BODYLN: 16}

...which corresponds to section:

10. == ...a title... ==
11. key1: value 1
12. key2: value 2
    ...
15. 
16. Central
17. Body
18. Text

(The line numbers are not part of the source; They are supplied only so that you can see how TITLELN and BODYLN function.)

It's safe to manipulate data in place.

Release files for lsf-lions-sectioned-format 2021.6.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lsf-lions-sectioned-format 2021.6.29
File Size Uploaded
lsf-lions-sectioned-format-2021.6.29.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lsf-lions-sectioned-format 2021.6.29
File Interpreter ABI Platform
lsf_lions_sectioned_format-2021.6.29-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / lsf-lions-sectioned-format-2021.6.29.tar.gz

Download URL lsf-lions-sectioned-format-2021.6.29.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9e9c3982621ac10538a14e55fbae7d9f4a593257e76c970e9d0a350b343f7d2f
BLAKE2b-256 checksum
How to use checksums
fb28cdd8986e11afdc30040cd4aa46f7ff7843a86ab4545f4223e4e0645a3d7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0

Release files / lsf_lions_sectioned_format-2021.6.29-py3-none-any.whl

Download URL lsf_lions_sectioned_format-2021.6.29-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81ff790fa75493dd669fff0ca7a8369e69ed199bb60ede6fdeafa77e922a906f
BLAKE2b-256 checksum
How to use checksums
a294cdf1ef77f53a0cf6a99de26df6dc4a9741b62518a6c616c69d2ef79bdeed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

2021.6.29 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page