Skip to main content

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 # Haven't uploaded to pypi yet
pip install .

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.tiddlers is a list of all the Tiddler objects.
  • TiddlyWiki.export_list() is the same but converted to dicts.
  • TiddlyWiki.parse() parsesthe file. It is run automatically under normal circumstances.
  • 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.

TODO: Upload to pypi.

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

tiddlywiki_parser-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiddlywiki_parser-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file tiddlywiki_parser-1.0.0.tar.gz.

File metadata

  • Download URL: tiddlywiki_parser-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.2

File hashes

Hashes for tiddlywiki_parser-1.0.0.tar.gz
Algorithm Hash digest
SHA256 28955ba6b17f118f097cc92f0a0ac4fff6dbe4c33cf0d61ae76208b73d30fa80
MD5 654883a05bf005f9054f150f0f375724
BLAKE2b-256 a8843a8e20091d63db71644daeb13d99854713932d9781d003c8014d6224d182

See more details on using hashes here.

File details

Details for the file tiddlywiki_parser-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tiddlywiki_parser-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2041d407090a2e56d50864b08ec90a83fc2da25fc5baadd7dd7322e769480cdb
MD5 67c48376be1acc2641082bc53f029a41
BLAKE2b-256 70c84312ac800a34cd933e07721678a9c7230695e632ca161f9d78c69ab2a0cf

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