1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-04-25 04:03:15 +00:00

Lots of enhancement to the text-slicer plugin

Now includes a special document view column on the left. Headings can
be expanded/collapsed, and tiddler titles can be inspected and renamed
via the toolbar. Clicking on an entry opens the associated tiddler. The
default tiddler view template includes a special section for tiddlers
that are part of a document
This commit is contained in:
Jermolene 2015-08-30 19:15:04 +01:00
parent 0d55f2c46b
commit 4cac7b6784
25 changed files with 311 additions and 220 deletions

View File

@ -0,0 +1,3 @@
title: $:/themes/tiddlywiki/vanilla/options/sidebarlayout
fluid-fixed

View File

@ -0,0 +1,3 @@
title: $:/themes/tiddlywiki/vanilla/metrics/storyleft
400px

View File

@ -27,21 +27,33 @@ These tiddlers are bound together using tagging: child tiddlers are tagged with
!! Slicing Process !! Slicing Process
Slicing generates the following component tiddlers: 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''.
!!! Document !!! Document
The document itself is represented by a tiddler with the following fields: The document itself is represented by a tiddler with the following fields:
* ''toc-type'': the text "document"
* ''title'': the text ''"Sliced up "'' plus the title of the tiddler that was sliced * ''title'': the text ''"Sliced up "'' plus the title of the tiddler that was sliced
* ''text'': the text `{{||$:/plugins/tiddlywiki/text-slicer/templates/display-document}}` * ''text'': left blank for description of the document
!!! Headings !!! Headings
Tiddlers representing headings have the following fields: Tiddlers representing headings have the following fields:
* ''title'': the text of the heading (which must be unique) * ''toc-type'': the text "heading"
* ''text'': the text `<<display-heading-tiddler level:'h1'>>`, with the appropriate heading number * ''toc-heading-level'': the heading level "h1", "h2", "h3" etc.
* ''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) * ''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 * ''tags'': tagged with the title of the parent heading
** In addition, any CSS classes found in the HTML are converted into tags ** In addition, any CSS classes found in the HTML are converted into tags
@ -50,35 +62,29 @@ Tiddlers representing headings have the following fields:
Tiddlers representing paragraphs have the following fields: Tiddlers representing paragraphs have the following fields:
* ''title'': an automatically generated unique title. See below * ''toc-type'': the text "paragraph"
* ''title'': an automatically generated unique title
* ''text'': the text of the paragraph * ''text'': the text of the paragraph
* ''tags'': tagged with the title of the parent heading * ''tags'': tagged with the title of the parent heading
** In addition, any CSS classes found in the HTML are converted into tags ** In addition, any CSS classes found in the HTML are converted into tags
The automatically generated title is made up of concatenating the following elements:
* the word ''para''
* a dash ''-''
* the first few words of the paragraph (up to 40 characters), separated with dashes ''-''
* if necessary, a space and a numerical index to make the title unique
For example, ''para-how-to-use-pentagonal-tiles 23''.
!!! Lists !!! Lists
Lists are represented by several tiddlers: one for the list itself, and one for each item in the list. 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: The tiddler representing the list itself has the following fields:
* ''toc-type'': the text "list"
* ''toc-list-type'': the text "ul" or "ol"
* ''title'': an automatically generated unique title * ''title'': an automatically generated unique title
* ''text'': the text `<<display-list-tiddler type:'ul'>>` with the appropriate list type ("ul" or "ol") * ''text'': the default filter used to generate the titles of the list items
* ''list'': ordered list of titles of tiddlers representing the items in this list * ''list'': ordered list of titles of tiddlers representing the items in this list
* ''tags'': tagged with the title of the parent heading * ''tags'': tagged with the title of the parent heading
** In addition, any CSS classes found in the HTML are converted into tags ** In addition, any CSS classes found in the HTML are converted into tags
The tiddlers representing items within the list have the following fields: The tiddlers representing items within the list have the following fields:
* ''toc-type'': the text "item"
* ''title'': an automatically generated unique title * ''title'': an automatically generated unique title
* ''text'': the text of the list item * ''text'': the text of the list item
* ''tags'': tagged with the title of the tiddler representing the list itself * ''tags'': tagged with the title of the tiddler representing the list itself

View File

@ -1,23 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/macros
tags: $:/tags/Macro
\define display-heading-tiddler(level:"h1")
<$level$><$view field="title"/></$level$>
<$list filter='[tag<currentTiddler>!has[draft.of]]'>
<$tiddler>
{{||$:/plugins/tiddlywiki/text-slicer/templates/display-tiddler}}
</$tiddler>
</$list>
\end
\define display-list-tiddler(type:"ol")
<$type$>
<$list filter='[tag<currentTiddler>!has[draft.of]]'>
<li>
<$tiddler>
{{||$:/plugins/tiddlywiki/text-slicer/templates/display-tiddler}}
</$tiddler>
</li>
</$list>
</$type$>
\end

View File

@ -0,0 +1,12 @@
title: $:/plugins/tiddlywiki/text-slicer/preview-column
tags: $:/tags/AboveStory
<$scrollable fallthrough="no" class="tc-document-preview-column">
<$set name="tv-default-heading-state" value="closed">
<$list filter="[toc-type[document]!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/template-document"/>
</$set>
</$scrollable>

View File

@ -25,7 +25,7 @@ exports.startup = function() {
$tw.rootWidget.addEventListener("tm-slice-tiddler",function(event) { $tw.rootWidget.addEventListener("tm-slice-tiddler",function(event) {
var slicer = new Slicer($tw.wiki,event.param); var slicer = new Slicer($tw.wiki,event.param);
slicer.sliceTiddler(event.param) slicer.sliceTiddler(event.param)
slicer.outputTiddlers(event.param); slicer.outputTiddlers();
slicer.destroy(); slicer.destroy();
}); });
}; };
@ -48,11 +48,6 @@ Slicer.prototype.destroy = function() {
} }
}; };
Slicer.prototype.nextId = function() {
return ++this.currentId;
};
Slicer.prototype.addTiddler = function(fields) { Slicer.prototype.addTiddler = function(fields) {
if(fields.title) { if(fields.title) {
this.tiddlers[fields.title] = $tw.utils.extend({},this.tiddlers[fields.title],fields); this.tiddlers[fields.title] = $tw.utils.extend({},this.tiddlers[fields.title],fields);
@ -121,34 +116,38 @@ Slicer.prototype.getSourceDocument = function() {
} }
}; };
Slicer.prototype.makeParagraphTitle = function(text) { Slicer.prototype.makeUniqueTitle = function(prefix,rawText) {
// Remove characters other than lowercase alphanumeric and spaces // Remove characters other than lowercase alphanumeric and spaces
var self = this, var self = this,
cleanText = text.toLowerCase().replace(/[^\s\xA0]/mg,function($0,$1,$2) { cleanText;
if(rawText) {
cleanText = rawText.toLowerCase().replace(/[^\s\xA0]/mg,function($0,$1,$2) {
if(($0 >= "a" && $0 <= "z") || ($0 >= "0" && $0 <= "9")) { if(($0 >= "a" && $0 <= "z") || ($0 >= "0" && $0 <= "9")) {
return $0; return $0;
} else { } else {
return " "; return " ";
} }
}); });
// Split on word boundaries // Split on word boundaries
var words = cleanText.split(/[\s\xA0]+/mg); var words = cleanText.split(/[\s\xA0]+/mg);
// Remove common words // Remove common words
words = words.filter(function(word) { words = words.filter(function(word) {
return word && (self.stopWordList.indexOf(word) === -1); return word && (self.stopWordList.indexOf(word) === -1);
}); });
// Accumulate the number of words that will fit // Accumulate the number of words that will fit
var c = 0, var c = 0,
s = ""; s = "";
while(c < words.length && (s.length + words[c].length + 1) < 50) { while(c < words.length && (s.length + words[c].length + 1) < 50) {
s += "-" + words[c++]; s += "-" + words[c++];
}
prefix = prefix + s;
} }
// Check for duplicates // Check for duplicates
var baseTitle = "para" + s; var baseTitle = prefix;
c = 0; c = 0;
var title = baseTitle; var title = baseTitle;
while(this.tiddlers[title] || this.wiki.tiddlerExists(title) || this.wiki.isShadowTiddler(title) || this.wiki.findDraft(title)) { while(this.tiddlers[title] || this.wiki.tiddlerExists(title) || this.wiki.isShadowTiddler(title) || this.wiki.findDraft(title)) {
title = baseTitle + " " + (++c); title = baseTitle + "-" + (++c);
} }
return title; return title;
}; };
@ -158,10 +157,10 @@ Slicer.prototype.processNodeList = function(domNodeList) {
} }
Slicer.prototype.processNode = function(domNode) { Slicer.prototype.processNode = function(domNode) {
var parentTitle, tags, var title, parentTitle, tags,
text = domNode.textContent, text = domNode.textContent,
nodeType = domNode.nodeType; nodeType = domNode.nodeType;
if(nodeType === 1) { if(nodeType === 1) { // DOM element nodes
var tagName = domNode.tagName.toLowerCase(); var tagName = domNode.tagName.toLowerCase();
if(tagName === "h1" || tagName === "h2" || tagName === "h3" || tagName === "h4") { if(tagName === "h1" || tagName === "h2" || tagName === "h3" || tagName === "h4") {
if(!this.isBlank(text)) { if(!this.isBlank(text)) {
@ -172,23 +171,27 @@ Slicer.prototype.processNode = function(domNode) {
} }
this.addToList(parentTitle,text); this.addToList(parentTitle,text);
this.parentStack.push({type: tagName, title: this.addTiddler({ this.parentStack.push({type: tagName, title: this.addTiddler({
title: text, "toc-type": "heading",
text: "<<display-heading-tiddler level:'" + tagName + "'>>", "toc-heading-level": tagName,
title: this.makeUniqueTitle("heading",text),
text: text,
list: [], list: [],
tags: tags tags: tags
})}); })});
} }
} else if(tagName === "ul" || tagName === "ol") { } else if(tagName === "ul" || tagName === "ol") {
var listTitle = this.sliceTitle + "-list-" + this.nextId(); title = this.makeUniqueTitle("list-" + tagName);
parentTitle = this.parentStack[this.parentStack.length - 1].title; parentTitle = this.parentStack[this.parentStack.length - 1].title;
tags = [parentTitle]; tags = [parentTitle];
if(domNode.className.trim() !== "") { if(domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,listTitle); this.addToList(parentTitle,title);
this.parentStack.push({type: tagName, title: this.addTiddler({ this.parentStack.push({type: tagName, title: this.addTiddler({
title: listTitle, "toc-type": "list",
text: "<<display-list-tiddler type:'" + tagName + "'>>", "toc-list-type": tagName,
title: title,
text: "[tag<currentTiddler>!has[draft.of]]",
list: [], list: [],
tags: tags tags: tags
})}); })});
@ -196,15 +199,16 @@ Slicer.prototype.processNode = function(domNode) {
this.parentStack.pop(); this.parentStack.pop();
} else if(tagName === "li") { } else if(tagName === "li") {
if(!this.isBlank(text)) { if(!this.isBlank(text)) {
var listItemTitle = this.sliceTitle + "-listitem-" + this.nextId(); title = this.makeUniqueTitle("list-item",text);
parentTitle = this.parentStack[this.parentStack.length - 1].title; parentTitle = this.parentStack[this.parentStack.length - 1].title;
tags = [parentTitle]; tags = [parentTitle];
if(domNode.className.trim() !== "") { if(domNode.className.trim() !== "") {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,listItemTitle); this.addToList(parentTitle,title);
this.addTiddler({ this.addTiddler({
title: listItemTitle, "toc-type": "item",
title: title,
text: text, text: text,
list: [], list: [],
tags: tags tags: tags
@ -218,7 +222,8 @@ Slicer.prototype.processNode = function(domNode) {
tags = tags.concat(domNode.className.split(" ")); tags = tags.concat(domNode.className.split(" "));
} }
this.addToList(parentTitle,this.addTiddler({ this.addToList(parentTitle,this.addTiddler({
title: this.makeParagraphTitle(text), "toc-type": "paragraph",
title: this.makeUniqueTitle("paragraph",text),
text: text, text: text,
tags: tags tags: tags
})); }));
@ -235,30 +240,29 @@ Slicer.prototype.sliceTiddler = function(title) {
var domNode = this.getSourceDocument(); var domNode = this.getSourceDocument();
this.parentStack.push({type: "h0", title: this.addTiddler({ this.parentStack.push({type: "h0", title: this.addTiddler({
title: "Sliced up " + title, title: "Sliced up " + title,
text: "{{||$:/plugins/tiddlywiki/text-slicer/templates/display-document}}", text: "Document sliced at " + (new Date()),
list: [] list: [],
"toc-type": "document"
})}); })});
this.processNodeList(domNode.childNodes); this.processNodeList(domNode.childNodes);
}; };
// Output directly to the output tiddlers // Output directly to the output tiddlers
Slicer.prototype.outputTiddlers = function(navigateFromTitle) { Slicer.prototype.outputTiddlers = function() {
var self = this;
$tw.utils.each(this.tiddlers,function(tiddlerFields) { $tw.utils.each(this.tiddlers,function(tiddlerFields) {
var title = tiddlerFields.title; var title = tiddlerFields.title;
if(title) { if(title) {
$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),tiddlerFields,$tw.wiki.getModificationFields())); $tw.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddlerFields,self.wiki.getModificationFields()));
} }
}); });
// Navigate to output
var story = new $tw.Story({wiki: $tw.wiki});
story.navigateTiddler("Sliced up " + this.sliceTitle,navigateFromTitle);
}; };
// Output via an import tiddler // Output via an import tiddler
Slicer.prototype.outputTiddlers_viaImportTiddler = function(tiddlers,navigateFromTitle) { Slicer.prototype.outputTiddlers_viaImportTiddler = function(tiddlers) {
// Get the current slicer output tiddler // Get the current slicer output tiddler
var slicerOutputTiddler = $tw.wiki.getTiddler(SLICER_OUTPUT_TITLE), var slicerOutputTiddler = this.wiki.getTiddler(SLICER_OUTPUT_TITLE),
slicerOutputData = $tw.wiki.getTiddlerData(SLICER_OUTPUT_TITLE,{}), slicerOutputData = this.wiki.getTiddlerData(SLICER_OUTPUT_TITLE,{}),
newFields = new Object({ newFields = new Object({
title: SLICER_OUTPUT_TITLE, title: SLICER_OUTPUT_TITLE,
type: "application/json", type: "application/json",
@ -275,10 +279,7 @@ Slicer.prototype.outputTiddlers_viaImportTiddler = function(tiddlers,navigateFro
}); });
// Save the slicer output tiddler // Save the slicer output tiddler
newFields.text = JSON.stringify(slicerOutputData,null,$tw.config.preferences.jsonSpaces); newFields.text = JSON.stringify(slicerOutputData,null,$tw.config.preferences.jsonSpaces);
$tw.wiki.addTiddler(new $tw.Tiddler(slicerOutputTiddler,newFields)); this.wiki.addTiddler(new $tw.Tiddler(slicerOutputTiddler,newFields));
// Navigate to output
var story = new $tw.Story({wiki: $tw.wiki});
story.navigateTiddler(SLICER_OUTPUT_TITLE,navigateFromTitle);
}; };
})(); })();

View File

@ -0,0 +1,76 @@
title: $:/plugins/tiddlywiki/text-slicer/styles
tags: $:/tags/Stylesheet
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline macrocallblock
.tc-document-preview-column {
position: fixed;
overflow-y: auto;
overflow-x: visible;
-webkit-overflow-scrolling: touch;
background-color: <<colour page-background>>;
right: auto;
left: 0;
top: 0;
bottom: 0;
width: {{$:/themes/tiddlywiki/vanilla/metrics/storyleft}};
font-size: 0.9em;
}
.tc-document-preview-column .tc-sliced-document-header {
margin-left: 24px;
}
.tc-view-template-document-tiddler-heading {
border-top: 2px solid <<colour muted-foreground>>;
}
.tc-view-template-document-tiddler {
font-size: 0.9em;
}
.tc-sliced-document {
margin-bottom: 3px;
border-bottom: 2px solid <<colour muted-foreground>>;
}
.tc-document-tiddler {
font-family: Georgia, Times, 'Times New Roman', serif;
}
.tc-text-slicer-rename input {
display: block;
width: 100%;
}
.tc-document-tiddler-link {
cursor: pointer;
}
.tc-document-tiddler-link:hover {
background: <<color background>>;
}
.tc-document-tiddler-toolbar {
position: absolute;
width: 24px;
text-align: center;
}
.tc-document-preview-column .tc-table-of-contents {
margin-left: 24px;
}
.tc-document-preview-column .tc-document-tiddler-toolbar {
margin-left: -24px;
}
.tc-table-of-contents .tc-slice-toolbar button {
color: inherit;
background-color: inherit;
}
.tc-tiddler-frame .tc-document-tiddler-toolbar {
left: 52px;
}

View File

@ -1,47 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/display-document
\define config-show-toolbar()
$:/plugins/tiddlywiki/text-slicer/config/show-toolbar/$(currentTiddler)$
\end
\define config-view-type()
$:/plugins/tiddlywiki/text-slicer/config/view-type/$(currentTiddler)$
\end
\define toc-document()
<<display-heading-tiddler level:'h1'>>
\end
\define display-document()
<$set name="tv-show-toolbar" value={{$(config-show-toolbar)$}}>
View: <$select tiddler=<<config-view-type>> default="toc-tabbed-internal-nav">
<option value="toc-document">Document</option>
<option value="toc-selective-expandable">Outline</option>
<option value="toc-tabbed-internal-nav">Tabbed outline</option>
</$select>
<$checkbox tiddler=<<config-show-toolbar>> field="text" checked="yes" unchecked="no" default="no"> Show toolbar</$checkbox>
<div class='tc-table-of-contents'>
<$set name="tv-show-toolbar" value={{$(config-show-toolbar)$}}>
<$list filter="[field:title[$(config-view-type)$]]" variable="listItem" emptyMessage="""
<$macrocall $name="toc-tabbed-internal-nav" tag=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/templates/toc-entry"/>
""">
<$macrocall $name={{$(config-view-type)$}} tag=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/templates/toc-entry"/>
</$list>
</$set>
</div>
</$set>
\end
<<display-document>>

View File

@ -1,8 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/display-tiddler
<$list filter="[<tv-show-toolbar>prefix[yes]]" variable="hasToolbar">
{{||$:/plugins/tiddlywiki/text-slicer/templates/tiddler-toolbar}}
</$list>
<$list filter="[draft.of<currentTiddler>limit[1]]" emptyMessage="""<$transclude mode='block'/>""">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/edit-tiddler" mode="block"/>
</$list>

View File

@ -0,0 +1,43 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/template-document
\define config-show-toolbar()
$:/config/plugins/tiddlywiki/text-slicer/show-toolbar/$(currentTiddler)$
\end
\define config-heading-status()
$:/config/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$
\end
\define body()
<$set name="tv-heading-status-config-title" value=<<config-heading-status>>>
<$set name="tv-show-toolbar" value={{$(config-show-toolbar)$}}>
<div class="tc-sliced-document">
<div class="tc-sliced-document-header">
''Document'': <$link><$view field="title"/></$link>
<$checkbox tiddler=<<config-show-toolbar>> field="text" checked="yes" unchecked="no" default="no"> Show toolbar</$checkbox>
</div>
<div class='tc-table-of-contents'>
<$set name="tv-show-toolbar" value={{$(config-show-toolbar)$}}>
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/template-tiddler" listItem="item"/>
</$set>
</div>
</div>
</$set>
</$set>
\end
<<body>>

View File

@ -1,11 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/edit-tiddler
<$set name="storyTiddler" value=<<currentTiddler>>>
<$keyboard key="escape" message="tm-cancel-tiddler">
<$keyboard key="ctrl+enter" message="tm-save-tiddler">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]] -[[$:/core/ui/EditTemplate/controls]] -[[$:/core/ui/EditTemplate/title]]" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
</$keyboard>
</$keyboard>
</$set>

View File

@ -0,0 +1,32 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/template-heading
\define config-heading-status()
$(tv-heading-status-config-title)$/$(currentTiddler)$
\end
\define body(level:"h1")
<$set name="tv-heading-status-config-title" value=<<config-heading-status>>>
<div class="tc-document-tiddler">
<div class="tc-document-tiddler-toolbar">
<$reveal type="nomatch" state=<<tv-heading-status-config-title>> text="open" default=<<tv-default-heading-state>>>
<$button set=<<tv-heading-status-config-title>> setTo="open" class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
</$button>
</$reveal>
<$reveal type="match" state=<<tv-heading-status-config-title>> text="open" default=<<tv-default-heading-state>>>
<$button set=<<tv-heading-status-config-title>> setTo="close" class="tc-btn-invisible">
{{$:/core/images/right-arrow}}
</$button>
</$reveal>
</div>
<$link tag="$level$" class="tc-document-tiddler-link">
<$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/template-tiddler" listItem="item"/>
</$reveal>
</div>
</$set>
\end
<$macrocall $name="body" level={{!!toc-heading-level}}/>

View File

@ -0,0 +1,7 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/template-item
<$link tag="li" class="tc-document-tiddler-link">
<$transclude/>
</$link>

View File

@ -0,0 +1,9 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/template-list
\define body(type:"ul")
<$type$>
<$list filter={{!!text}} template="$:/plugins/tiddlywiki/text-slicer/templates/template-tiddler" listItem="item"/>
</$type$>
\end
<$macrocall $name="body" type={{!!toc-list-type}}/>

View File

@ -0,0 +1,7 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/template-paragraph
<$link tag="div" class="tc-document-tiddler-link">
<$transclude/>
</$link>

View File

@ -1,5 +1,5 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/tiddler-toolbar title: $:/plugins/tiddlywiki/text-slicer/templates/tiddler-toolbar
<div class="tc-slice-toolbar" style="background:#def;"> <div class="tc-slice-toolbar">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TextSlicerToolbar]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list> <$list filter="[all[shadows+tiddlers]tag[$:/tags/TextSlicerToolbar]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
</div> </div>

View File

@ -0,0 +1,25 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/template-tiddler
<$list filter="[<tv-show-toolbar>prefix[yes]]" variable="hasToolbar">
{{||$:/plugins/tiddlywiki/text-slicer/templates/tiddler-toolbar}}
</$list>
<$reveal type="match" state="!!toc-type" text="document">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/template-document" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="heading">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/template-heading" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="paragraph">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/template-paragraph" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="list">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/template-list" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="item">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/template-item" mode="block"/>
</$reveal>

View File

@ -1,3 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/toc-entry
<$transclude/>

View File

@ -1,13 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/toolbar/cancel
tags: $:/tags/TextSlicerToolbar
\define body()
<$button>
<$action-sendmessage $message="tm-cancel-tiddler" $param=<<currentTiddler>> suppressNavigation="yes"/>
cancel
</$button>
\end
<$list filter="[draft.of<currentTiddler>limit[1]]">
<<body>>
</$list>

View File

@ -1,13 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/toolbar/done
tags: $:/tags/TextSlicerToolbar
\define body()
<$button>
<$action-sendmessage $message="tm-save-tiddler" $param=<<currentTiddler>> suppressNavigation="yes"/>
done
</$button>
\end
<$list filter="[draft.of<currentTiddler>limit[1]]">
<<body>>
</$list>

View File

@ -1,12 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/toolbar/edit
tags: $:/tags/TextSlicerToolbar
\define body()
<$button>
<$action-sendmessage $message="tm-edit-tiddler" $param=<<currentTiddler>> suppressNavigation="yes"/>
edit
</$button>
\end
<$list filter="[draft.of<currentTiddler>limit[1]]" emptyMessage="""<<body>>""">
</$list>

View File

@ -1,18 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/toolbar/rename
tags: $:/tags/TextSlicerToolbar
\define renameProxyTitle()
$:/config/plugins/tiddlywiki/text-slicer/rename-$(currentTiddler)$
\end
\define body()
<$edit-text tag="input" tiddler=<<renameProxyTitle>> placeholder="Rename" default=<<currentTiddler>>/>
<$button>
<$action-sendmessage $message="tm-rename-tiddler" from=<<currentTiddler>> to={{$(renameProxyTitle)$}}/>
<$action-deletetiddler $tiddler=<<renameProxyTitle>>/>
rename
</$button>
\end
<$list filter="[draft.of<currentTiddler>limit[1]]" emptyMessage="""<<body>>""">
</$list>

View File

@ -1,4 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/toolbar/tags
tags: $:/tags/TextSlicerToolbar
<span class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></span>

View File

@ -1,4 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/toolbar/title
tags: $:/tags/TextSlicerToolbar
<$link><$text text=<<currentTiddler>>/></$link>

View File

@ -0,0 +1,23 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/view-template-tiddler
tags: $:/tags/ViewTemplate
<$reveal type="nomatch" state="!!toc-type" text="">
<div class="tc-view-template-document-tiddler-heading">
//This tiddler is part of a document. The content as it appears in the document appears below.//
</div>
<div class="tc-view-template-document-tiddler">
<$set name="tv-default-heading-state" value="open">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/template-tiddler"/>
</$set>
</div>
</$reveal>