Turn entities to and fro various representations.
This is the base Class and interface Class used to transform strings of various forms to model objects and model objects to strings of various forms.
Bases: object
A Serialization is a collection of methods that either turn an input string into the object named by the method, or turn the object into a string form.
The interface is fairly simple: For the data entities that exist in the TiddlyWeb system there (optionally) exists <entity>_as and as_<entity> methods in each Serialization.
*_as returns a string form of the entity, perhaps as HTML, Text, YAML, Atom, whatever the Serialization does.
as_* takes a provided entity and string and updates the skeletal entity to represent the information contained in the string (in the Serialization format).
There are also three supporting methods, list_tiddlers, list_recipes() and list_bags() that provide convenience methods for presenting a collection of either in the Serialization form. A string is returned.
If a method doesn’t exist a NoSerializationError is raised and the calling code is expected to do something intelligent when trapping it.
Take input_string, which is a serialized bag and turn it into a Bag (if possible).
Take input_string, which is a serialized recipe and turn it into a Recipe (if possible).
Not called directly, but made public for future use. Turn a string into a list of tags.
Take input_string, which is a serialized tiddler and turn it into a Tiddler (if possible).
Serialize a Bag into this serializer’s form.
Provided a List of BagS, make a serialized list of those bags (e.g. a a list of HTML links).
Provided a List of RecipeS, make a serialized list of those recipes (e.g. a a list of HTML links).
Provided a bag, output the included tiddlers.
Serialize a Recipe into this serializer’s form.
Not called directly, but made public for future use. Turn a list of tags into a serialized list.
Serialize a Bag into this serializer’s form.
HTML based serializers.
Bases: tiddlyweb.serializations.SerializationInterface
Serialize entities and collections to and from HTML representations. This is primarily used to create browser based presentations.
Bag as html.
List the bags on the system as html.
List the recipes on the system as html.
List the tiddlers as html.
Recipe as html.
Transform the provided tiddler into an HTML representation of the tiddler packaged in a DIV. Render the content using the render_wikitext subsystem.
JSON based serializer.
Bases: tiddlyweb.serializations.SerializationInterface
Turn various entities to and from JSON.
Turn a JSON string into a bag.
Turn a JSON dictionary into a Recipe if it is in the proper form. Include the policy.
Turn a JSON dictionary into a Tiddler.
Create a JSON dictionary representing a Bag and Policy.
Create a JSON list of bag names from the provided bags.
Create a JSON list of recipe names from the provided recipes.
List the tiddlers as JSON. The format is a list of dicts in the form described by self._tiddler_dict.
A recipe as a JSON dictionary.
Create a JSON dictionary representing a tiddler, as described by _tiddler_dict plus the text of the tiddler.
Text based serializers.
Bases: tiddlyweb.serializations.SerializationInterface
Serialize entities and collections to and from textual representations. This is primarily used by the text Store.
Turn a string back into a recipe.
Transform a text representation of a tiddler into tiddler attributes.
Turn extended tiddler fields into RFC 822-style header strings.
Return a linefeed separated list of recipe names.
Return a linefeed separated list of recipe names.
List the tiddlers as text.
Recipe as text.
Represent a tiddler as a text string: headers, blank line, text.
omit_* arguments are non-standard options, usable only when this method is called directly (outside the regular Serializer interface)
If omit_empty is True, don’t emit empty Tiddler members.
omit_members can represent a list of members to not include in the output.