mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Text-slicer: better static HTML generation
This commit is contained in:
parent
c20e5b47b6
commit
b379ab4f87
@ -16,6 +16,10 @@ Dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
||||
|
||||
@@
|
||||
|
||||
!! What's with all the < angle brackets
|
||||
|
||||
An opportunity to see how characters that need HTML encoding (like < angle brackets) are dealt with.
|
||||
|
||||
!!! Who uses TiddlyWiki?
|
||||
|
||||
@@.intro
|
||||
|
@ -142,7 +142,7 @@ Slicer.prototype.processNodeList = function(domNodeList) {
|
||||
|
||||
Slicer.prototype.processNode = function(domNode) {
|
||||
var title, parentTitle, tags,
|
||||
text = domNode.textContent,
|
||||
text = $tw.utils.htmlEncode(domNode.textContent),
|
||||
nodeType = domNode.nodeType;
|
||||
if(nodeType === 1) { // DOM element nodes
|
||||
var tagName = domNode.tagName.toLowerCase();
|
||||
|
@ -20,7 +20,7 @@ $(tv-heading-status-config-title)$/$(tv-heading-status-config-prefix)$/$(current
|
||||
</$reveal>
|
||||
</div>
|
||||
<$link tag="$level$" class="tc-document-tiddler-link">
|
||||
<$view field="text"/>
|
||||
<$transclude/>
|
||||
</$link>
|
||||
<$reveal type="nomatch" state=<<tv-heading-status-config-title>> text="open" default=<<tv-default-heading-state>>>
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
|
||||
|
@ -0,0 +1,7 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/plain/document
|
||||
|
||||
<$set name="tv-exclude-filter" value={{!!toc-exclude-filter}}>
|
||||
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/plain/tiddler"/>
|
||||
|
||||
</$set>
|
10
plugins/tiddlywiki/text-slicer/templates/plain/heading.tid
Normal file
10
plugins/tiddlywiki/text-slicer/templates/plain/heading.tid
Normal file
@ -0,0 +1,10 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/plain/heading
|
||||
|
||||
\define body(level:"h1")
|
||||
<$level$>
|
||||
<$transclude/>
|
||||
</$level$>
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/plain/tiddler"/>
|
||||
\end
|
||||
|
||||
<$macrocall $name="body" level={{!!toc-heading-level}}/>
|
11
plugins/tiddlywiki/text-slicer/templates/plain/item.tid
Normal file
11
plugins/tiddlywiki/text-slicer/templates/plain/item.tid
Normal file
@ -0,0 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/plain/item
|
||||
|
||||
\define body()
|
||||
<li>
|
||||
|
||||
<$transclude/>
|
||||
|
||||
</li>
|
||||
\end
|
||||
|
||||
<<body>>
|
11
plugins/tiddlywiki/text-slicer/templates/plain/list.tid
Normal file
11
plugins/tiddlywiki/text-slicer/templates/plain/list.tid
Normal file
@ -0,0 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/plain/list
|
||||
|
||||
\define body(type:"ul")
|
||||
<$type$>
|
||||
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||
<$list filter={{!!toc-list-filter}} template="$:/plugins/tiddlywiki/text-slicer/templates/plain/tiddler"/>
|
||||
</$list>
|
||||
</$type$>
|
||||
\end
|
||||
|
||||
<$macrocall $name="body" type={{!!toc-list-type}}/>
|
15
plugins/tiddlywiki/text-slicer/templates/plain/paragraph.tid
Normal file
15
plugins/tiddlywiki/text-slicer/templates/plain/paragraph.tid
Normal file
@ -0,0 +1,15 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/plain/paragraph
|
||||
|
||||
\define body()
|
||||
<div>
|
||||
|
||||
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||
|
||||
<$transclude/>
|
||||
|
||||
</$list>
|
||||
|
||||
</div>
|
||||
\end
|
||||
|
||||
<<body>>
|
25
plugins/tiddlywiki/text-slicer/templates/plain/tiddler.tid
Normal file
25
plugins/tiddlywiki/text-slicer/templates/plain/tiddler.tid
Normal file
@ -0,0 +1,25 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/plain/tiddler
|
||||
|
||||
<$vars toc-type={{!!toc-type}}>
|
||||
|
||||
<$list filter="[<toc-type>prefix[document]]" variable="item">
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/document" mode="block"/>
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[heading]]" variable="item">
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/heading" mode="block"/>
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[paragraph]]" variable="item">
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/paragraph" mode="block"/>
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[list]]" variable="item">
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/list" mode="block"/>
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[item]]" variable="item">
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/plain/item" mode="block"/>
|
||||
</$list>
|
||||
|
||||
</$vars>
|
@ -1,7 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/static/document
|
||||
|
||||
`<div class="tc-output-document">`
|
||||
|
||||
<$set name="tv-exclude-filter" value={{!!toc-exclude-filter}}>
|
||||
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||
|
||||
</$set>
|
||||
|
||||
`</div>`
|
||||
|
@ -1,10 +1,9 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/static/heading
|
||||
|
||||
\define body(level:"h1")
|
||||
<$level$>
|
||||
<$view field="text"/>
|
||||
</$level$>
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||
\end
|
||||
`<`<$text text={{!!toc-heading-level}}/>`>`
|
||||
|
||||
<$macrocall $name="body" level={{!!toc-heading-level}}/>
|
||||
<$view field="text" format="htmlencodedplainwikified"/>
|
||||
|
||||
`</`<$text text={{!!toc-heading-level}}/>`>`
|
||||
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||
|
@ -1,11 +1,9 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/static/item
|
||||
|
||||
\define body()
|
||||
<li class="tc-document-tiddler-link">
|
||||
`<li>`
|
||||
|
||||
<$transclude/>
|
||||
|
||||
</li>
|
||||
\end
|
||||
`</li>`
|
||||
|
||||
<<body>>
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||
|
@ -1,11 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/static/list
|
||||
|
||||
\define body(type:"ul")
|
||||
<$type$>
|
||||
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||
<$list filter={{!!toc-list-filter}} template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||
</$list>
|
||||
</$type$>
|
||||
\end
|
||||
|
||||
<$macrocall $name="body" type={{!!toc-list-type}}/>
|
||||
`<`<$text text={{!!toc-list-type}}/>`>`
|
||||
|
||||
<$list filter={{!!toc-list-filter}} template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||
|
||||
`</`<$text text={{!!toc-list-type}}/>`>`
|
||||
|
||||
</$list>
|
||||
|
@ -1,15 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/static/paragraph
|
||||
|
||||
\define body()
|
||||
<div class="tc-document-tiddler-link">
|
||||
|
||||
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||
|
||||
<$transclude/>
|
||||
`<p>`
|
||||
|
||||
<$view field="text" format="htmlencodedplainwikified"/>
|
||||
|
||||
`</p>`
|
||||
|
||||
</$list>
|
||||
|
||||
</div>
|
||||
\end
|
||||
|
||||
<<body>>
|
||||
|
@ -3,23 +3,33 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/tiddler
|
||||
<$vars toc-type={{!!toc-type}}>
|
||||
|
||||
<$list filter="[<toc-type>prefix[document]]" variable="item">
|
||||
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/document" mode="block"/>
|
||||
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[heading]]" variable="item">
|
||||
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/heading" mode="block"/>
|
||||
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[paragraph]]" variable="item">
|
||||
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/paragraph" mode="block"/>
|
||||
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[list]]" variable="item">
|
||||
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/list" mode="block"/>
|
||||
|
||||
</$list>
|
||||
|
||||
<$list filter="[<toc-type>prefix[item]]" variable="item">
|
||||
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/item" mode="block"/>
|
||||
|
||||
</$list>
|
||||
|
||||
</$vars>
|
||||
|
@ -9,7 +9,7 @@ title: $:/plugins/tiddlywiki/text-slicer/ui/document/header
|
||||
<$checkbox tiddler=<<config-show-toolbar>> field="text" checked="yes" unchecked="no" default="no"> Show toolbar</$checkbox>
|
||||
|
||||
<$button>
|
||||
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/templates/static/document" output="text/html"/>
|
||||
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/templates/plain/document"/>
|
||||
View document
|
||||
</$button>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user