mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +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:
parent
0d55f2c46b
commit
4cac7b6784
3
editions/text-slicer/tiddlers/system/sidebarlayout.tid
Normal file
3
editions/text-slicer/tiddlers/system/sidebarlayout.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/themes/tiddlywiki/vanilla/options/sidebarlayout
|
||||
|
||||
fluid-fixed
|
3
editions/text-slicer/tiddlers/system/storyleft.tid
Normal file
3
editions/text-slicer/tiddlers/system/storyleft.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/themes/tiddlywiki/vanilla/metrics/storyleft
|
||||
|
||||
400px
|
@ -27,21 +27,33 @@ These tiddlers are bound together using tagging: child tiddlers are tagged with
|
||||
|
||||
!! 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
|
||||
|
||||
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
|
||||
* ''text'': the text `{{||$:/plugins/tiddlywiki/text-slicer/templates/display-document}}`
|
||||
* ''text'': left blank for description of the document
|
||||
|
||||
!!! Headings
|
||||
|
||||
Tiddlers representing headings have the following fields:
|
||||
|
||||
* ''title'': the text of the heading (which must be unique)
|
||||
* ''text'': the text `<<display-heading-tiddler level:'h1'>>`, with the appropriate heading number
|
||||
* ''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
|
||||
* ''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
|
||||
@ -50,35 +62,29 @@ Tiddlers representing headings 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
|
||||
* ''tags'': tagged with the title of the parent heading
|
||||
** 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 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:
|
||||
|
||||
* ''toc-type'': the text "list"
|
||||
* ''toc-list-type'': the text "ul" or "ol"
|
||||
* ''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
|
||||
* ''tags'': tagged with the title of the parent heading
|
||||
** In addition, 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
|
||||
|
||||
|
@ -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
|
12
plugins/tiddlywiki/text-slicer/preview-column.tid
Normal file
12
plugins/tiddlywiki/text-slicer/preview-column.tid
Normal 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>
|
@ -25,7 +25,7 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tm-slice-tiddler",function(event) {
|
||||
var slicer = new Slicer($tw.wiki,event.param);
|
||||
slicer.sliceTiddler(event.param)
|
||||
slicer.outputTiddlers(event.param);
|
||||
slicer.outputTiddlers();
|
||||
slicer.destroy();
|
||||
});
|
||||
};
|
||||
@ -48,11 +48,6 @@ Slicer.prototype.destroy = function() {
|
||||
}
|
||||
};
|
||||
|
||||
Slicer.prototype.nextId = function() {
|
||||
return ++this.currentId;
|
||||
};
|
||||
|
||||
|
||||
Slicer.prototype.addTiddler = function(fields) {
|
||||
if(fields.title) {
|
||||
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
|
||||
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")) {
|
||||
return $0;
|
||||
} else {
|
||||
return " ";
|
||||
}
|
||||
});
|
||||
// Split on word boundaries
|
||||
var words = cleanText.split(/[\s\xA0]+/mg);
|
||||
// Remove common words
|
||||
words = words.filter(function(word) {
|
||||
return word && (self.stopWordList.indexOf(word) === -1);
|
||||
});
|
||||
// Accumulate the number of words that will fit
|
||||
var c = 0,
|
||||
s = "";
|
||||
while(c < words.length && (s.length + words[c].length + 1) < 50) {
|
||||
s += "-" + words[c++];
|
||||
// Split on word boundaries
|
||||
var words = cleanText.split(/[\s\xA0]+/mg);
|
||||
// Remove common words
|
||||
words = words.filter(function(word) {
|
||||
return word && (self.stopWordList.indexOf(word) === -1);
|
||||
});
|
||||
// Accumulate the number of words that will fit
|
||||
var c = 0,
|
||||
s = "";
|
||||
while(c < words.length && (s.length + words[c].length + 1) < 50) {
|
||||
s += "-" + words[c++];
|
||||
}
|
||||
prefix = prefix + s;
|
||||
}
|
||||
// Check for duplicates
|
||||
var baseTitle = "para" + s;
|
||||
var baseTitle = prefix;
|
||||
c = 0;
|
||||
var title = baseTitle;
|
||||
while(this.tiddlers[title] || this.wiki.tiddlerExists(title) || this.wiki.isShadowTiddler(title) || this.wiki.findDraft(title)) {
|
||||
title = baseTitle + " " + (++c);
|
||||
title = baseTitle + "-" + (++c);
|
||||
}
|
||||
return title;
|
||||
};
|
||||
@ -158,10 +157,10 @@ Slicer.prototype.processNodeList = function(domNodeList) {
|
||||
}
|
||||
|
||||
Slicer.prototype.processNode = function(domNode) {
|
||||
var parentTitle, tags,
|
||||
var title, parentTitle, tags,
|
||||
text = domNode.textContent,
|
||||
nodeType = domNode.nodeType;
|
||||
if(nodeType === 1) {
|
||||
if(nodeType === 1) { // DOM element nodes
|
||||
var tagName = domNode.tagName.toLowerCase();
|
||||
if(tagName === "h1" || tagName === "h2" || tagName === "h3" || tagName === "h4") {
|
||||
if(!this.isBlank(text)) {
|
||||
@ -172,23 +171,27 @@ Slicer.prototype.processNode = function(domNode) {
|
||||
}
|
||||
this.addToList(parentTitle,text);
|
||||
this.parentStack.push({type: tagName, title: this.addTiddler({
|
||||
title: text,
|
||||
text: "<<display-heading-tiddler level:'" + tagName + "'>>",
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": tagName,
|
||||
title: this.makeUniqueTitle("heading",text),
|
||||
text: text,
|
||||
list: [],
|
||||
tags: tags
|
||||
})});
|
||||
}
|
||||
} 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;
|
||||
tags = [parentTitle];
|
||||
if(domNode.className.trim() !== "") {
|
||||
tags = tags.concat(domNode.className.split(" "));
|
||||
}
|
||||
this.addToList(parentTitle,listTitle);
|
||||
this.addToList(parentTitle,title);
|
||||
this.parentStack.push({type: tagName, title: this.addTiddler({
|
||||
title: listTitle,
|
||||
text: "<<display-list-tiddler type:'" + tagName + "'>>",
|
||||
"toc-type": "list",
|
||||
"toc-list-type": tagName,
|
||||
title: title,
|
||||
text: "[tag<currentTiddler>!has[draft.of]]",
|
||||
list: [],
|
||||
tags: tags
|
||||
})});
|
||||
@ -196,15 +199,16 @@ Slicer.prototype.processNode = function(domNode) {
|
||||
this.parentStack.pop();
|
||||
} else if(tagName === "li") {
|
||||
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;
|
||||
tags = [parentTitle];
|
||||
if(domNode.className.trim() !== "") {
|
||||
tags = tags.concat(domNode.className.split(" "));
|
||||
}
|
||||
this.addToList(parentTitle,listItemTitle);
|
||||
this.addToList(parentTitle,title);
|
||||
this.addTiddler({
|
||||
title: listItemTitle,
|
||||
"toc-type": "item",
|
||||
title: title,
|
||||
text: text,
|
||||
list: [],
|
||||
tags: tags
|
||||
@ -218,7 +222,8 @@ Slicer.prototype.processNode = function(domNode) {
|
||||
tags = tags.concat(domNode.className.split(" "));
|
||||
}
|
||||
this.addToList(parentTitle,this.addTiddler({
|
||||
title: this.makeParagraphTitle(text),
|
||||
"toc-type": "paragraph",
|
||||
title: this.makeUniqueTitle("paragraph",text),
|
||||
text: text,
|
||||
tags: tags
|
||||
}));
|
||||
@ -235,30 +240,29 @@ Slicer.prototype.sliceTiddler = function(title) {
|
||||
var domNode = this.getSourceDocument();
|
||||
this.parentStack.push({type: "h0", title: this.addTiddler({
|
||||
title: "Sliced up " + title,
|
||||
text: "{{||$:/plugins/tiddlywiki/text-slicer/templates/display-document}}",
|
||||
list: []
|
||||
text: "Document sliced at " + (new Date()),
|
||||
list: [],
|
||||
"toc-type": "document"
|
||||
})});
|
||||
this.processNodeList(domNode.childNodes);
|
||||
};
|
||||
|
||||
// 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) {
|
||||
var title = tiddlerFields.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
|
||||
Slicer.prototype.outputTiddlers_viaImportTiddler = function(tiddlers,navigateFromTitle) {
|
||||
Slicer.prototype.outputTiddlers_viaImportTiddler = function(tiddlers) {
|
||||
// Get the current slicer output tiddler
|
||||
var slicerOutputTiddler = $tw.wiki.getTiddler(SLICER_OUTPUT_TITLE),
|
||||
slicerOutputData = $tw.wiki.getTiddlerData(SLICER_OUTPUT_TITLE,{}),
|
||||
var slicerOutputTiddler = this.wiki.getTiddler(SLICER_OUTPUT_TITLE),
|
||||
slicerOutputData = this.wiki.getTiddlerData(SLICER_OUTPUT_TITLE,{}),
|
||||
newFields = new Object({
|
||||
title: SLICER_OUTPUT_TITLE,
|
||||
type: "application/json",
|
||||
@ -275,10 +279,7 @@ Slicer.prototype.outputTiddlers_viaImportTiddler = function(tiddlers,navigateFro
|
||||
});
|
||||
// Save the slicer output tiddler
|
||||
newFields.text = JSON.stringify(slicerOutputData,null,$tw.config.preferences.jsonSpaces);
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler(slicerOutputTiddler,newFields));
|
||||
// Navigate to output
|
||||
var story = new $tw.Story({wiki: $tw.wiki});
|
||||
story.navigateTiddler(SLICER_OUTPUT_TITLE,navigateFromTitle);
|
||||
this.wiki.addTiddler(new $tw.Tiddler(slicerOutputTiddler,newFields));
|
||||
};
|
||||
|
||||
})();
|
||||
|
76
plugins/tiddlywiki/text-slicer/styles.tid
Normal file
76
plugins/tiddlywiki/text-slicer/styles.tid
Normal 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;
|
||||
}
|
||||
|
@ -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>>
|
@ -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>
|
43
plugins/tiddlywiki/text-slicer/template-document.tid
Normal file
43
plugins/tiddlywiki/text-slicer/template-document.tid
Normal 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>>
|
@ -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>
|
32
plugins/tiddlywiki/text-slicer/template-heading.tid
Normal file
32
plugins/tiddlywiki/text-slicer/template-heading.tid
Normal 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}}/>
|
7
plugins/tiddlywiki/text-slicer/template-item.tid
Normal file
7
plugins/tiddlywiki/text-slicer/template-item.tid
Normal file
@ -0,0 +1,7 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/template-item
|
||||
|
||||
<$link tag="li" class="tc-document-tiddler-link">
|
||||
|
||||
<$transclude/>
|
||||
|
||||
</$link>
|
9
plugins/tiddlywiki/text-slicer/template-list.tid
Normal file
9
plugins/tiddlywiki/text-slicer/template-list.tid
Normal 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}}/>
|
7
plugins/tiddlywiki/text-slicer/template-paragraph.tid
Normal file
7
plugins/tiddlywiki/text-slicer/template-paragraph.tid
Normal file
@ -0,0 +1,7 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/template-paragraph
|
||||
|
||||
<$link tag="div" class="tc-document-tiddler-link">
|
||||
|
||||
<$transclude/>
|
||||
|
||||
</$link>
|
@ -1,5 +1,5 @@
|
||||
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>
|
||||
</div>
|
||||
|
25
plugins/tiddlywiki/text-slicer/template-tiddler.tid
Normal file
25
plugins/tiddlywiki/text-slicer/template-tiddler.tid
Normal 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>
|
@ -1,3 +0,0 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/toc-entry
|
||||
|
||||
<$transclude/>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -1,4 +0,0 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/toolbar/title
|
||||
tags: $:/tags/TextSlicerToolbar
|
||||
|
||||
<$link><$text text=<<currentTiddler>>/></$link>
|
23
plugins/tiddlywiki/text-slicer/view-template-tiddler.tid
Normal file
23
plugins/tiddlywiki/text-slicer/view-template-tiddler.tid
Normal 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>
|
||||
|
Loading…
Reference in New Issue
Block a user