1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-05 21:33:52 +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/Prompt: Current palette:
Palette/ShowEditor/Caption: show editor Palette/ShowEditor/Caption: show editor
Parsing/Caption: Parsing 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/Block/Caption: Block Parse Rules
Parsing/Inline/Caption: Inline Parse Rules Parsing/Inline/Caption: Inline Parse Rules
Parsing/Pragma/Caption: Pragma 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 Export our filter function
*/ */
exports.wikiparserrules = function(source,operator,options) { exports.wikiparserrules = function(source,operator,options) {
var results = []; var results = [],
operand = operator.operand;
$tw.utils.each($tw.modules.types.wikirule,function(mod) { $tw.utils.each($tw.modules.types.wikirule,function(mod) {
var exp = mod.exports; var exp = mod.exports;
if(exp.types[operator.operand]) { if(!operand || exp.types[operand]) {
results.push(exp.name); results.push(exp.name);
} }
}); });

View File

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