From 58188cf8053bef87dbe97e4b05cdba67f75c615d Mon Sep 17 00:00:00 2001 From: Jermolene Date: Fri, 31 Jul 2015 13:33:33 +0100 Subject: [PATCH] Improvements to parser rule configuration * Ignore parser rule configuration in safe mode * Made text translatable * Added new setting for camelcase links * Added warning on parser rule configuration tab See #1875 --- core/language/en-GB/ControlPanel.multids | 8 ++++++++ core/modules/parsers/wikiparser/wikiparser.js | 13 +++++++------ core/ui/ControlPanel/Parsing.tid | 14 +++++++++----- core/ui/ControlPanel/Settings/CamelCase.tid | 8 ++++++++ editions/tw5.com/tiddlers/features/SafeMode.tid | 2 ++ 5 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 core/ui/ControlPanel/Settings/CamelCase.tid diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 1d2ef1166..fa3dcef8c 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -38,6 +38,11 @@ Palette/Editor/Reset/Caption: reset 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 paser rules can prevent ~TiddlyWiki functioning correctly (you can restore normal operation with [[safe mode|http://tiddlywiki.com/#SafeMode]] ) +Parsing/Block/Caption: Block Parse Rules +Parsing/Inline/Caption: Inline Parse Rules +Parsing/Pragma/Caption: Pragma Parse Rules Plugins/Add/Hint: Install plugins from the official library Plugins/Add/Caption: Get more plugins Plugins/Caption: Plugins @@ -71,6 +76,9 @@ Settings/AutoSave/Caption: Autosave Settings/AutoSave/Disabled/Description: Do not save changes automatically Settings/AutoSave/Enabled/Description: Save changes automatically Settings/AutoSave/Hint: Automatically save changes during editing +Settings/CamelCase/Caption: Camel Case Wiki Links +Settings/CamelCase/Hint: You can globally disable automatic linking of ~CamelCase phrases. Requires reload to take effect +Settings/CamelCase/Description: Enable automatic ~CamelCase linking Settings/Caption: Settings Settings/Hint: These settings let you customise the behaviour of TiddlyWiki. Settings/NavigationAddressBar/Caption: Navigation Address Bar diff --git a/core/modules/parsers/wikiparser/wikiparser.js b/core/modules/parsers/wikiparser/wikiparser.js index 4c88d6ef2..559c06d04 100644 --- a/core/modules/parsers/wikiparser/wikiparser.js +++ b/core/modules/parsers/wikiparser/wikiparser.js @@ -66,12 +66,13 @@ var WikiParser = function(type,text,options) { */ WikiParser.prototype.setupRules = function(proto,configPrefix) { var self = this; - $tw.utils.each(proto,function(object,name) { - if(self.wiki.getTiddlerText(configPrefix + name,"enable") !== "enable") { - delete proto[name]; -console.log("deleting",name) - } - }); + if(!$tw.safemode) { + $tw.utils.each(proto,function(object,name) { + if(self.wiki.getTiddlerText(configPrefix + name,"enable") !== "enable") { + delete proto[name]; + } + }); + } }; /* diff --git a/core/ui/ControlPanel/Parsing.tid b/core/ui/ControlPanel/Parsing.tid index fabf98c8d..de027f9c3 100644 --- a/core/ui/ControlPanel/Parsing.tid +++ b/core/ui/ControlPanel/Parsing.tid @@ -1,6 +1,8 @@ title: $:/core/ui/ControlPanel/Parsing -tags: $:/tags/ControlPanel -caption: Parsing +tags: $:/tags/ControlPanel/Advanced +caption: {{$:/language/ControlPanel/Parsing/Caption}} + +\define lingo-base() $:/language/ControlPanel/Parsing/ \define parsing-inner(typeCap)
  • @@ -16,14 +18,16 @@ caption: Parsing \end -! Pragma Parse Rules +<> + +! <> <> -! Inline Parse Rules +! <> <> -! Block Parse Rules +! <> <> diff --git a/core/ui/ControlPanel/Settings/CamelCase.tid b/core/ui/ControlPanel/Settings/CamelCase.tid new file mode 100644 index 000000000..36377bb85 --- /dev/null +++ b/core/ui/ControlPanel/Settings/CamelCase.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/ControlPanel/Settings/CamelCase +tags: $:/tags/ControlPanel/Settings +caption: {{$:/language/ControlPanel/Settings/CamelCase/Caption}} + +\define lingo-base() $:/language/ControlPanel/Settings/CamelCase/ +<> + +<$checkbox tiddler="$:/config/WikiParserRules/Inline/wikilink" field="text" checked="enable" unchecked="disable" default="enable"> <$link to="$:/config/WikiParserRules/Inline/wikilink"><> diff --git a/editions/tw5.com/tiddlers/features/SafeMode.tid b/editions/tw5.com/tiddlers/features/SafeMode.tid index d8aa2263f..813be6eaf 100644 --- a/editions/tw5.com/tiddlers/features/SafeMode.tid +++ b/editions/tw5.com/tiddlers/features/SafeMode.tid @@ -20,5 +20,7 @@ Safe mode triggers two changes: * All plugins are temporarily disabled. You can use the control panel to disable individual plugins * Any tiddlers that override shadow tiddlers are renamed to give them the prefix `SAFE: `, thus restoring the underlying shadow tiddler +* Certain configuration options are ignored, and the default settings used instead: +** WikiParserRuleConfiguration A report tiddler is displayed that allows you to inspect the tiddlers that were renamed.