Python module to read extended file content and metadata
Extended Content Reader
Copyright (c) 2016-2017 David Betz
pip install econtent
Python 2 and 3
Files have content and metadata. Markdown has already helps us go from boring text files to rich text (without RTF or proprietary voodoo), but it’s not enough. My content needs sections and it needs metadata. They already have a create date and a modified date, but I often need to overwrite these. That’s where this component comes in. It’s been helping me for a few years now (well, this is the Python refactor/port of my original/production/more complex .NET version).
It’s easier to following if you just look at the example…
The following example is ridiculous, but it’s an example of the type of stuff you might store in a file:
The current python project reads that file as the following object:
That’s really useful information without the needs to play around with parsing file internals.
The created, modified, filename, extension, and basename are read from the file metadata, but created and modified can be overwritten using @_created@ and @_modified@ tokens.
But, it’s not just metadata. On my technical website, I require color syntax for various programming languages. Preformatting makes the code unreadable. So, I need sections(@@begin…@@/@@end@@. On my research website, I require extensive citations and footnotes. So, I need linkable content (@@XXXX@@).
See test_read.py for usage.
- one entry == blog entry
- one entry == one quote (with citation data)
- one entry == one podcast mp3; you would use something like @audio@ which would tell your custom system that this entry is describing that particular mp3
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.