Library to extract tiddlers from a tiddlywiki file.
Project description
tiddlywiki_parser
Parse the tiddler our of a tiddlywiki for backup, git management or anything else.
A simple tool to extract the tiddlers from a Tiddlywiki (A personal, non-linear web notebook (aka a wiki in a file)).
TODO: Right now tiddlers are basically just dicts and don't do anything to help with data processing. I'd like to be able to search and extract fields and tags at the very least.
Warning
This is barely more than a hobby project at this point. I'm turning it into a
package because I'd like to import it in another project, but if you're using
a different version of Tiddlywiki or use it differently than me, I can't
suggest, much less promise or guarantee that it will work.
If you have a case where it doesn't work, create an Issue, and I'll take a look at it.
Install
pip install tiddlywiki_parser
Usage
import tiddlywiki_parser.readers as readers
import tiddlywiki_parser.writiers as writers
from tiddlywiki_parser.tiddlywiki import TiddlyWiki
raw_content = readers.read('/path/to/tiddlywiki/file')
tiddlywiki = TiddlyWiki(raw_content)
writers.export('/path/to/destination/file.json, tiddlywiki.export_list(), save_json=True)
readers.read()can also take a url.TiddlyWiki.tiddlersis a list of all the Tiddler objects.TiddlyWiki.export_list()is the same but converted to dicts.TiddlyWiki.parse()parses the file. It is run automatically under normal circumstances.TiddlyWiki.remake(delete_list=['title1', 'title2'])- Builds a new tiddlywiki deleting the specified titles, and with any changes made to tiddlers. Must change raw_text, which is html, not text, which is a clean string. Titles cannot be changed.
Tiddler.dict()returns the dict version of the Tiddler object.writers.export()will write the tiddlywiki either as individual files or a s a json file.
Command Line
There is a command line packaged with the package. It will parse a tiddlywiki file and save the tiddlers either as individual files or as a single json file.
usage: tiddlywiki_parser [-h] [--json] source output
positional arguments:
source The path to the html file
output The path to the output dir (or file).
options:
-h, --help show this help message and exit
--json Save as a json file instead of as individual tiddlers. output
must be a dir.
source can be either a local file or a url.
output is the where the data should be written. It's either a directory for a writing individual files or a json file if --json is specified.
Packaging
This should now be a proper package, and it uses uv for all the packaging stuff.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tiddlywiki_parser-1.1.0.tar.gz.
File metadata
- Download URL: tiddlywiki_parser-1.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c700d3881161e72b11f5be40269b9d48881a63f95ce4b2784d02c1abec33e92c
|
|
| MD5 |
b103933d254ba7770b5702e644f620ab
|
|
| BLAKE2b-256 |
4ce3b0fc7701f17eb95a93da8b1c5cf42796ceea4b54197f1018ac6f4f5009fa
|
File details
Details for the file tiddlywiki_parser-1.1.0-py3-none-any.whl.
File metadata
- Download URL: tiddlywiki_parser-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d76deeccd2fbbffacf2772246600f79a2a417e599d623c84984d2f22b939bb
|
|
| MD5 |
60b3d6e520191bf2d2d6c7014ba34a2c
|
|
| BLAKE2b-256 |
86a77c618949125b1ea529d80a2bafc01f40f82cbb7e5f19525aa59cced5013a
|