mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-27 13:34:35 +00:00
Major updates to text-slicer plugin
* In the interests of performance and expressiveness, switched to using a Sax parser instead of a DOM implementation. * Use extensible declarative rules to control the slicing process * Added new optional set of rules for slicing by heading, where the paragraphs underneath a heading are packed into the same tiddler as the heading * Added a modal dialogue for specifying parameters when slicing in the browser
This commit is contained in:
189
plugins/tiddlywiki/text-slicer/modules/rules/html-by-heading.tid
Normal file
189
plugins/tiddlywiki/text-slicer/modules/rules/html-by-heading.tid
Normal file
@@ -0,0 +1,189 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/slicer-rules/html-by-heading.json
|
||||
name: html-by-heading
|
||||
caption: By Heading (HTML)
|
||||
description: One tiddler per heading, threaded (HTML)
|
||||
inherits-from: html-by-paragraph
|
||||
type: application/json
|
||||
tags: $:/tags/text-slicer/slicer-rules
|
||||
|
||||
[
|
||||
{
|
||||
"selector": "address,center,fieldset,form,hr,iframe,isindex,noframes,noscript,ol,ul,li,pre,table",
|
||||
"actions": {}
|
||||
},
|
||||
{
|
||||
"selector": "blockquote",
|
||||
"actions": {
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "<<<\n",
|
||||
"suffix": "<<<\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "dd",
|
||||
"actions": {
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "\n: ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "dl",
|
||||
"actions": {
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "\n",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "dt",
|
||||
"actions": {
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "\n; ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "h1",
|
||||
"actions": {
|
||||
"startNewChunk": {
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": "h1"
|
||||
},
|
||||
"mergeNext": true,
|
||||
"setCaption": true,
|
||||
"isParent": true,
|
||||
"headingLevel": 1,
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "! ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "h2",
|
||||
"actions": {
|
||||
"startNewChunk": {
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": "h2"
|
||||
},
|
||||
"mergeNext": true,
|
||||
"setCaption": true,
|
||||
"isParent": true,
|
||||
"headingLevel": 2,
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "!! ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "h3",
|
||||
"actions": {
|
||||
"startNewChunk": {
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": "h3"
|
||||
},
|
||||
"mergeNext": true,
|
||||
"setCaption": true,
|
||||
"isParent": true,
|
||||
"headingLevel": 3,
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "!!! ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "h4",
|
||||
"actions": {
|
||||
"startNewChunk": {
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": "h4"
|
||||
},
|
||||
"mergeNext": true,
|
||||
"setCaption": true,
|
||||
"isParent": true,
|
||||
"headingLevel": 4,
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "!!!! ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "h5",
|
||||
"actions": {
|
||||
"startNewChunk": {
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": "h5"
|
||||
},
|
||||
"mergeNext": true,
|
||||
"setCaption": true,
|
||||
"isParent": true,
|
||||
"headingLevel": 5,
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "!!!!! ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "h6",
|
||||
"actions": {
|
||||
"startNewChunk": {
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": "h6"
|
||||
},
|
||||
"mergeNext": true,
|
||||
"setCaption": true,
|
||||
"isParent": true,
|
||||
"headingLevel": 6,
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "!!!!!! ",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "p",
|
||||
"actions": {
|
||||
"markup": {
|
||||
"wiki": {
|
||||
"prefix": "",
|
||||
"suffix": "\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"selector": "*",
|
||||
"actions": {
|
||||
"dontRenderTag": true
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user