2017-12-14 14:16:54 +00:00
title: $:/plugins/tiddlywiki/text-slicer/docs/model
tags: $:/plugins/tiddlywiki/text-slicer/docs
caption: Document Model
2015-08-03 08:13:36 +00:00
2015-09-04 08:05:33 +00:00
Individual tiddlers are created for each heading, paragraph and list item. They are linked together into a hierarchical outline using lists.
2015-08-03 08:13:36 +00:00
For example, consider a tiddler titled ''Example'' containing this simple text:
<<<
! This is a heading
This is a paragraph.
* And the first list item
* Second list item
<<<
It will be sliced up into:
* a tiddler for the overall document
** a tiddler for the heading
*** a tiddler for the paragraph
*** a tiddler for the list
**** and a tiddler for each list item
2015-09-04 08:05:33 +00:00
These tiddlers are bound together using lists: the parent tiddler has a ''list'' field that lists each child in the correct order.
2015-08-28 18:13:50 +00:00
!! Slicing Process
2015-08-30 18:15:04 +00:00
Slicing generates the following component tiddlers.
Tiddler titles are generated automatically in most cases (but can subsequently be changed manually). The automatically generated title is made up of concatenating the following elements:
* root text (e.g. ''para'')
* a dash ''-''
* the first few words of the text of the item (up to 40 characters), separated with dashes ''-''
* if necessary, a dash ''-'' and a numerical index to make the title unique
For example, ''para-how-to-use-pentagonal-tiles 23''.
2015-08-28 18:13:50 +00:00
2015-09-03 07:54:48 +00:00
Any CSS classes used in the original document are assigned as tags to the associated tiddlers.
2015-08-28 18:40:58 +00:00
!!! Document
The document itself is represented by a tiddler with the following fields:
2015-08-30 18:15:04 +00:00
* ''toc-type'': the text "document"
2015-08-28 18:40:58 +00:00
* ''title'': the text ''"Sliced up "'' plus the title of the tiddler that was sliced
2015-08-31 13:15:44 +00:00
* ''text'': Available for comments about the document
* ''list'': ordered list of tiddlers making up the root level of this document
2015-08-28 18:13:50 +00:00
!!! Headings
Tiddlers representing headings have the following fields:
2015-08-30 18:15:04 +00:00
* ''toc-type'': the text "heading"
* ''toc-heading-level'': the heading level "h1", "h2", "h3" etc.
* ''title'': an automatically generated unique title
* ''text'': the text of the heading
2015-08-28 18:13:50 +00:00
* ''list'': ordered list of tiddlers tagged with this heading (i.e. the child headings, paragraphs and lists displayed under this heading)
** In addition, any CSS classes found in the HTML are converted into tags
!!! Paragraphs
Tiddlers representing paragraphs have the following fields:
2015-08-30 18:15:04 +00:00
* ''toc-type'': the text "paragraph"
* ''title'': an automatically generated unique title
2015-08-28 18:13:50 +00:00
* ''text'': the text of the paragraph
2015-09-04 08:05:33 +00:00
* ''tags'': any CSS classes found in the HTML are converted into tags
2015-08-28 18:13:50 +00:00
!!! Lists
Lists are represented by several tiddlers: one for the list itself, and one for each item in the list.
The tiddler representing the list itself has the following fields:
2015-08-30 18:15:04 +00:00
* ''toc-type'': the text "list"
* ''toc-list-type'': the text "ul" or "ol"
2015-09-04 07:42:07 +00:00
* ''toc-list-filter'': the default filter used to generate the titles of the list items
2015-08-28 18:13:50 +00:00
* ''title'': an automatically generated unique title
* ''list'': ordered list of titles of tiddlers representing the items in this list
2015-09-04 08:05:33 +00:00
* ''tags'': any CSS classes found in the HTML are converted into tags
2015-08-28 18:13:50 +00:00
The tiddlers representing items within the list have the following fields:
2015-08-30 18:15:04 +00:00
* ''toc-type'': the text "item"
2015-08-28 18:13:50 +00:00
* ''title'': an automatically generated unique title
* ''text'': the text of the list item
2015-09-04 08:05:33 +00:00
* ''tags'': any CSS classes found in the HTML are converted into tags
2015-10-08 17:04:24 +00:00
2015-10-14 18:25:11 +00:00
!!! Definition lists
Definition lists are represented by several tiddlers: one for the definition list itself, and one for each term and definition in the list.
The tiddler representing the definition list itself has the following fields:
* ''toc-type'': the text "def-list"
2015-10-24 10:01:43 +00:00
* ''toc-list-filter'': the default filter used to generate the titles of the definition list items
2015-10-14 18:25:11 +00:00
* ''title'': an automatically generated unique title
* ''list'': ordered list of titles of tiddlers representing the items (terms and/or definition) in the definition list
* ''tags'': any CSS classes found in the HTML are converted into tags
The tiddlers representing terms within the definition list have the following fields:
* ''toc-type'': the text "term"
* ''title'': an automatically generated unique title
* ''text'': the text of the definition list term
* ''tags'': any CSS classes found in the HTML are converted into tags
The tiddlers representing definitions within the definition list have the following fields:
* ''toc-type'': the text "definition"
* ''title'': an automatically generated unique title
* ''text'' : the text of the definition list definition
* ''tags'': any CSS classes found in the HTML are converted into tags
2015-10-08 17:04:24 +00:00
!!! Images
Tiddlers representing images have the following fields:
* ''toc-type'': the text "image"
* ''title'': an automatically generated unique title
* ''type'': appropriate content type for the image (eg "image/jpeg")
2016-02-01 21:26:11 +00:00
!!! Notes
Notes are available during editing but hidden for static renderings. The slicing mechanism does not generate notes; they can only be subsequently added manually. Tiddlers representing notes have the following fields:
* ''toc-type'': the text "note"
* ''title'': an automatically generated unique title
* ''text'': the text of the note
* ''tags'': any CSS classes found in the HTML are converted into tags