Skip to main content

a very simple markup language.

Project description

vsml: a (v)ery (s)imple (m)arkup (l)anguage

“avoiding complexity reduces bugs.” - linus torvalds

table of contents

features

current features

  • simple ini-like syntax
  • lightning fast python functions
  • comments

planned features

  • toml-like subsections
  • make initFile check for more possible issues

file syntax

# a comment before a section!
[ExampleSection]
ExampleKey1=ExampleValue1
ExampleKey2=ExampleValue2

# a comment between sections!

[ExampleSection2]
# a comment inside a section!
ExampleKey1=ExampleValue1
ExampleKey2=ExampleValue2
ExampleKey3=ExampleValue3
# a comment at the end of the file!

functions

initFile

the initFile function checks if the file exists, and can be written to.

if it is possible to write to the file, it will strip the file of unneeded whitespace so that the following functions will work properly.

in future versions, this function will attempt to fix files with syntax errors.

it is highly recommended to run this function before any others.

usage:

initFile("/path/to/file.vsml")

findSec

the findSec function returns the first line, and last line of a section, in the form of a list.

usage:

findSec("/path/to/file.vsml", "ExampleSection1") # returned: [ 0, 2 ]

findKey

the findKey function returns where a key is in a file.

usage:

findKey("/path/to/file.vsml", "ExampleKey1", "ExampleSection1") # returned: 1

readKeyValue

the readKeyValue function returns the value of a key.

usage:

readKeyValue("/path/to/file.vsml", "ExampleKey1", "ExampleSection1") # returned: "testValue1"

editKeyValue

the editKeyValue function changes the value of a key.

usage:

editKeyValue("/path/to/file.vsml", "ExampleKey1", "NotExampleValue1", "ExampleSection1")

rename

the rename function changes the name of a key, or a section.

usage (key):

rename("/path/to/file.vsml", "NotExampleKey1", "ExampleSection1", key="ExampleKey1")

usage (section):

rename("/path/to/file.vsml", "NotExampleSection1", "ExampleSection1")

add

the add function adds a key, or section.

usage (key, by section):

add("/path/to/file.vsml", section="ExampleSection1", key="ExampleKey2", value="ExampleValue2")

usage (key, by line number):

add("/path/to/file.vsml", lineNum=27, key="ExampleKey2", value="ExampleValue2")

usage (section, add to end of file):

add("/path/to/file.vsml", section="ExampleSection2")

usage (section, by line number):

add("/path/to/file.vsml", lineNum=26, section="ExampleSection2")

delete

the delete function deletes a key, or section.

usage (key):

delete("/path/to/file.vsml", section="ExampleSection1", key="ExampleKey1")

usage (section):

delete("/path/to/file.vsml", section="ExampleSection1")

usage (line number):

delete("/path/to/file.vsml", lineNum=27)

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

vsml-0.3.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file vsml-0.3.1.tar.gz.

File metadata

  • Download URL: vsml-0.3.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for vsml-0.3.1.tar.gz
Algorithm Hash digest
SHA256 809466c94c9240b2b725c215dc6f72daf4f494e7070301a70cea594cefa1e396
MD5 29e15a741ee3e885f978566e98c531f0
BLAKE2b-256 8ae282615c97f774a4fb235f4b333e8152c813373a1607b6f5a08df4b411d276

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page