1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

added update for triple double-quotes macro params

This commit is contained in:
buggyj 2014-06-20 09:52:37 +02:00
parent d13de81c7a
commit 9992b542a3
3 changed files with 8 additions and 8 deletions

View File

@ -12,15 +12,15 @@ title: $:/plugins/tiddlywiki/tw2parser/macrodefs
\end
\define __system_tabinstance(state, currentTab, prompts, labels)
<span title=<<entryof "$currentTab$" '$prompts$'>> ><$button set=<<qualify "$state$">> setTo="$currentTab$" selectedClass="tw-tab-selected">
<<entryof "$currentTab$" '$labels$' >>
<span title=<<entryof "$currentTab$" """$prompts$""">> ><$button set=<<qualify "$state$">> setTo="$currentTab$" selectedClass="tw-tab-selected">
<<entryof "$currentTab$" """$labels$""" >>
</$button></span>
\end
\define __system_tabs(tabsList,prompts,labels,state:"$:/state/tab")
<div class="tw-tab-buttons">
<$list filter="$tabsList$" variable="currentTab">
<$macrocall $name="__system_tabinstance" state="$state$" prompts='$prompts$' labels='$labels$'currentTab=<<currentTab>>/>
<$macrocall $name="__system_tabinstance" state="$state$" prompts="""$prompts$""" labels="""$labels$""" currentTab=<<currentTab>>/>
</$list>
</div>
<div class="tw-tab-divider"/>

View File

@ -53,12 +53,12 @@ function gettiddlername(title) {
var parserparams = function(paramString) {
var params = [],
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
paramMatch = reParam.exec(paramString);
while(paramMatch) {
// Process this parameter
var paramInfo = {
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6]
};
if(paramMatch[1]) {
paramInfo.name = paramMatch[1];
@ -85,7 +85,7 @@ var tabshandler = function(paramstring) {
}
//Create a list of names (tiddlers, tiddler/sections, tiddler/slices), and create maps from name -> label and name -> prompt
//Use json to implement maps
return "'"+tabslist +"' '"+JSON.stringify(promptarray)+"' '"+JSON.stringify(labelarray)+"' '"+cookie+"'";
return '"""'+tabslist +'""" """'+JSON.stringify(promptarray)+'""" """'+JSON.stringify(labelarray)+'""" """'+cookie+'"""';
};
var namedapter = {tabs:'__system_tabs'};
var paramadapter = {

View File

@ -103,12 +103,12 @@ var enclosedTextHelper = function(w) {
var insertMacroCall = function(w,output,macroName,paramString) {
var params = [],
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
reParam = /\s*(?:([A-Za-z0-9\-_]+)\s*:)?(?:\s*(?:"""([\s\S]*?)"""|"([^"]*)"|'([^']*)'|\[\[([^\]]*)\]\]|([^"'\s]+)))/mg,
paramMatch = reParam.exec(paramString);
while(paramMatch) {
// Process this parameter
var paramInfo = {
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5]
value: paramMatch[2] || paramMatch[3] || paramMatch[4] || paramMatch[5] || paramMatch[6]
};
if(paramMatch[1]) {
paramInfo.name = paramMatch[1];