Managing Markup Files
Project description
Bibliothek
🏛 Managing Markup Files
Example
from typing import Tuple
from bibliothek.toc import ToC, Note
t = ToC(base='path/to/dir', file_pattern=r'^.+\.md')
@t.on_sort('path', 'to')
def _(note: Note):
return note['created date']
@t.on_sort('path')
def _(note: Note):
return note['last updated date']
@t.before_generate
def _() -> str:
return '# ToC'
@t.after_generate
def _() -> str:
return '_Generate by Bibliothek_'
@t.before_dir
def _(curr_dir: Tuple[str]) -> str:
return f'## {curr_dir[-1]}' if len(curr_dir) > 0 else None
@t.after_dir
def _(curr_dir: Tuple[str]) -> str:
return '\n'
@t.on_note
def _(note: Note) -> str:
# path would be inserted into front matter and auto escaped
return f'- [{note["title"]}]({note["path"]})'
print(t)
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
bibliothek-0.1.3.tar.gz
(4.6 kB
view hashes)
Built Distribution
bibliothek-0.1.3-py3-none-any.whl
(18.7 kB
view hashes)
Close
Hashes for bibliothek-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53dae2cfa8df464b9de8f0be3fb838effad85bfd10a1dd4331a1fd0e5516c014 |
|
MD5 | ba1a0636379a475ebd643b71e3ebff9c |
|
BLAKE2b-256 | 82b6058a03b93ad411d288af15adab3bb0d5c25bee9461b0d6b5dd495ff10bd3 |