Extended Content Reader
Copyright (c) 2016-2017 David Betz
Installation
pip install econtent
Compatibility
Python 2 and 3
Purpose
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:
item01.txt
hollow unbraced needs mineral high fingerd strings red tragical having definement invisible@@footnote|78@@. flames grow pranks obey hearsed variable grandsire bodykins possessd worser oerthrown oerweigh healthful kingly wise faculty loggats best.
unfortified chopine hill witchcraft countries toward nerve grief duty rivals.
@@begin|format:javascript@@
alert((function() {
var item = 'item01';
return item.split('').reverse()
})());
@@format:python@@
print('item01'[::-1])
@@end@@
patience unhouseld pours lapsed would passion point blastments lady spectators.
@author@ Billy Speareshakes
@title@ Thy Wonderful Randomious
@page@ 728
@footnote|78@ nose thee something disclaiming wrung antiquity rend illume halt osric list
@_created@ 2016-07-27T19:38:10Z
@_modified@ 2016-07-27T19:38:10Z
There are two paragraphs, followed by a block of JavaScript, then a block of Python, then another paragraph, then a bunch of metadata. It’s a rediclous example because it combines concepts from both research website (citations and footnotes) and my netfxharmonics.com website (the javascript section, which in that context in final rendering would be rendered with JavaScript colored syntax).
The current python project reads that file as the following object:
{
'_': {
0: 'hollow unbraced needs mineral high fingerd strings red tragical having definement invisible@@footnote|78@@. flames grow pranks obey hearsed variable grandsire bodykins possessd worser oerthrown oerweigh healthful kingly wise faculty loggats best.\nunfortified chopine hill witchcraft countries toward nerve grief duty rivals.',
1: {
0: {
'_': " alert((function() {\n var item = 'item01';\n return item.split('').reverse()\n })());",
'format': 'javascript'
},
1: {
'_': " print('item01'[::-1])",
'format': 'python'
}
},
2: 'patience unhouseld pours lapsed would passion point blastments lady spectators.',
},
'author': 'Billy Speareshakes',
'title': 'Thy Wonderful Randomious',
'page': '728',
'footnote': {
78: 'nose thee something disclaiming wrung antiquity rend illume halt osric list',
},
'_created': '2016-07-27T19:38:10Z',
'_modified': '2016-07-27T19:38:10Z',
'_filename': 'item01.txt',
'_extension': 'txt',
'_basename': 'item01',
}
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.
Use Cases
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
Metadata
Release files for econtent 1.4.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| econtent-1.4.6.tar.gz | 6.7 kB | Without provenance | Details for econtent-1.4.6.tar.gz |
Release files / econtent-1.4.6.tar.gz
| Download URL | econtent-1.4.6.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2b7cdaa9a956ab25b54be6867ec75ccde22d022c80441ee42a38acbdfda4bbe
|
|
BLAKE2b-256 checksum How to use checksums |
9814ce641d424a010eceba949ed9d08f36a4c13d01d2e2bb3e091ae84d696068
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for econtent 1.4.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.