1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Text-slicer: Switch from weaving with tags to lists alone

Many reasons:
* to allow subtrees to be grafted more easily
* to keep the tags for an entry clean by removing structural tags and
leaving the semantic tags
* to avoid the duplication of expressing the same relationship through
both the tags and list fields
This commit is contained in:
Jermolene 2015-09-04 09:05:33 +01:00
parent 4ea5dce284
commit f0a655d8b2
4 changed files with 12 additions and 16 deletions

View File

@ -2,7 +2,7 @@ title: $:/plugins/tiddlywiki/text-slicer/docs
! Introduction
This plugin contains tools to help work with documents that are structured as a hierarchical outline of tiddlers. The structural relationships within the document are expressed as tags that weave the individual tiddlers together.
This plugin contains tools to help work with documents that are structured as a hierarchical outline of tiddlers. The structural relationships within the document are expressed as lists: for example, headings have a list specifying the content to be shown under the heading.
TiddlyWiki is built on the philosophy that text is easier to re-use and work with if it is sliced up into separate chunks that can be independently manipulated, and then woven back together to make up stories and narratives for publication.
@ -53,7 +53,7 @@ To preview a document, locate it in the preview column and click the button labe
!! Introduction
Individual tiddlers are created for each heading, paragraph and list item. They are linked together into a hierarchical outline using TiddlyWiki's tagging mechanism.
Individual tiddlers are created for each heading, paragraph and list item. They are linked together into a hierarchical outline using lists.
For example, consider a tiddler titled ''Example'' containing this simple text:
@ -74,7 +74,7 @@ It will be sliced up into:
*** a tiddler for the list
**** and a tiddler for each list item
These tiddlers are bound together using tagging: child tiddlers are tagged with the title of their parent, and the parent tiddler has a ''list'' field that lists each child in the correct order.
These tiddlers are bound together using lists: the parent tiddler has a ''list'' field that lists each child in the correct order.
!! Slicing Process
@ -100,7 +100,6 @@ The document itself is represented by a tiddler with the following fields:
* ''text'': Available for comments about the document
* ''list'': ordered list of tiddlers making up the root level of this document
Note that the relationship between the document and component tiddlers is that the components are listed in the ''list'' field. This differs from the relationship between headings and their components, which use the ''tags'' field of the components to tie them to the heading. The purpose of this difference is to make it possible to clone doument tiddlers without losing the connection to the constituent parts.
!!! Headings
@ -111,7 +110,6 @@ Tiddlers representing headings have the following fields:
* ''title'': an automatically generated unique title
* ''text'': the text of the heading
* ''list'': ordered list of tiddlers tagged with this heading (i.e. the child headings, paragraphs and lists displayed under this heading)
* ''tags'': tagged with the title of the parent heading
** In addition, any CSS classes found in the HTML are converted into tags
!!! Paragraphs
@ -121,8 +119,7 @@ Tiddlers representing paragraphs have the following fields:
* ''toc-type'': the text "paragraph"
* ''title'': an automatically generated unique title
* ''text'': the text of the paragraph
* ''tags'': tagged with the title of the parent heading
** In addition, any CSS classes found in the HTML are converted into tags
* ''tags'': any CSS classes found in the HTML are converted into tags
!!! Lists
@ -135,12 +132,11 @@ The tiddler representing the list itself has the following fields:
* ''toc-list-filter'': the default filter used to generate the titles of the list items
* ''title'': an automatically generated unique title
* ''list'': ordered list of titles of tiddlers representing the items in this list
* ''tags'': tagged with the title of the parent heading
** In addition, any CSS classes found in the HTML are converted into tags
* ''tags'': any CSS classes found in the HTML are converted into tags
The tiddlers representing items within the list have the following fields:
* ''toc-type'': the text "item"
* ''title'': an automatically generated unique title
* ''text'': the text of the list item
* ''tags'': tagged with the title of the tiddler representing the list itself
* ''tags'': any CSS classes found in the HTML are converted into tags

View File

@ -150,7 +150,7 @@ Slicer.prototype.processNode = function(domNode) {
if(!this.isBlank(text)) {
title = this.makeUniqueTitle("heading",text);
parentTitle = this.popParentStackUntil(tagName);
tags = [parentTitle];
tags = [];
if(domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" "));
}
@ -167,7 +167,7 @@ Slicer.prototype.processNode = function(domNode) {
} else if(tagName === "ul" || tagName === "ol") {
title = this.makeUniqueTitle("list-" + tagName);
parentTitle = this.parentStack[this.parentStack.length - 1].title;
tags = [parentTitle];
tags = [];
if(domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" "));
}
@ -187,7 +187,7 @@ Slicer.prototype.processNode = function(domNode) {
if(!this.isBlank(text)) {
title = this.makeUniqueTitle("list-item",text);
parentTitle = this.parentStack[this.parentStack.length - 1].title;
tags = [parentTitle];
tags = [];
if(domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" "));
}
@ -203,7 +203,7 @@ Slicer.prototype.processNode = function(domNode) {
} else if(tagName === "p") {
if(!this.isBlank(text)) {
parentTitle = this.parentStack[this.parentStack.length - 1].title;
tags = [parentTitle];
tags = [];
if(domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" "));
}

View File

@ -23,7 +23,7 @@ $(tv-heading-status-config-title)$/$(tv-heading-status-config-prefix)$/$(current
<$view field="text"/>
</$link>
<$reveal type="nomatch" state=<<tv-heading-status-config-title>> text="open" default=<<tv-default-heading-state>>>
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
</$reveal>
</div>
</$set>

View File

@ -4,7 +4,7 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/heading
<$level$>
<$view field="text"/>
</$level$>
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
\end
<$macrocall $name="body" level={{!!toc-heading-level}}/>