1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Update wikiparserrules operator for no operand (#2193)

* return all wikiparserrules w/o operand

* simpler layout & code / updated instruction details

Also wanted to link each rule to the official docs using a dictionary at
`$:/language/Docs/ParserRules/`. However, without #2194 this is not
doable.
This commit is contained in:
Tobias Beer 2016-10-08 14:04:11 +02:00 committed by Jeremy Ruston
parent 994432e28e
commit f575389d89
3 changed files with 24 additions and 23 deletions

View File

@ -52,7 +52,7 @@ Palette/HideEditor/Caption: hide editor
Palette/Prompt: Current palette:
Palette/ShowEditor/Caption: show editor
Parsing/Caption: Parsing
Parsing/Hint: Here you can globally disable individual wiki parser rules. Take care as disabling some parser rules can prevent ~TiddlyWiki functioning correctly (you can restore normal operation with [[safe mode|http://tiddlywiki.com/#SafeMode]] )
Parsing/Hint: Here you can globally disable/enable wiki parser rules. For changes to take effect, save and reload your wiki. Disabling certain parser rules can prevent <$text text="TiddlyWiki"/> from functioning correctly. Use [[safe mode|http://tiddlywiki.com/#SafeMode]] to restore normal operation.
Parsing/Block/Caption: Block Parse Rules
Parsing/Inline/Caption: Inline Parse Rules
Parsing/Pragma/Caption: Pragma Parse Rules

View File

@ -16,10 +16,11 @@ Filter operator for returning the names of the wiki parser rules in this wiki
Export our filter function
*/
exports.wikiparserrules = function(source,operator,options) {
var results = [];
var results = [],
operand = operator.operand;
$tw.utils.each($tw.modules.types.wikirule,function(mod) {
var exp = mod.exports;
if(exp.types[operator.operand]) {
if(!operand || exp.types[operand]) {
results.push(exp.name);
}
});

View File

@ -4,30 +4,30 @@ caption: {{$:/language/ControlPanel/Parsing/Caption}}
\define lingo-base() $:/language/ControlPanel/Parsing/
\define parsing-inner(typeCap)
<li>
<$checkbox tiddler="""$:/config/WikiParserRules/$typeCap$/$(currentTiddler)$""" field="text" checked="enable" unchecked="disable" default="enable"> ''<$text text=<<currentTiddler>>/>'': </$checkbox>
</li>
\define toggle(Type)
<$checkbox
tiddler="""$:/config/WikiParserRules/$Type$/$(rule)$"""
field="text"
checked="enable"
unchecked="disable"
default="enable">
<<rule>>
</$checkbox>
\end
\define parsing-outer(typeLower,typeCap)
<ul>
<$list filter="[wikiparserrules[$typeLower$]]">
<<parsing-inner typeCap:"$typeCap$">>
\define rules(type,Type)
<$list filter="[wikiparserrules[$type$]]" variable="rule">
<dd><<toggle $Type$>></dd>
</$list>
</ul>
\end
<<lingo Hint>>
! <<lingo Pragma/Caption>>
<<parsing-outer typeLower:"pragma" typeCap:"Pragma">>
! <<lingo Inline/Caption>>
<<parsing-outer typeLower:"inline" typeCap:"Inline">>
! <<lingo Block/Caption>>
<<parsing-outer typeLower:"block" typeCap:"Block">>
<dl>
<dt><<lingo Pragma/Caption>></dt>
<<rules pragma Pragma>>
<dt><<lingo Inline/Caption>></dt>
<<rules inline Inline>>
<dt><<lingo Block/Caption>></dt>
<<rules block Block>>
</dl>