1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +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 \end
\define __system_tabinstance(state, currentTab, prompts, labels) \define __system_tabinstance(state, currentTab, prompts, labels)
<span title=<<entryof "$currentTab$" '$prompts$'>> ><$button set=<<qualify "$state$">> setTo="$currentTab$" selectedClass="tw-tab-selected"> <span title=<<entryof "$currentTab$" """$prompts$""">> ><$button set=<<qualify "$state$">> setTo="$currentTab$" selectedClass="tw-tab-selected">
<<entryof "$currentTab$" '$labels$' >> <<entryof "$currentTab$" """$labels$""" >>
</$button></span> </$button></span>
\end \end
\define __system_tabs(tabsList,prompts,labels,state:"$:/state/tab") \define __system_tabs(tabsList,prompts,labels,state:"$:/state/tab")
<div class="tw-tab-buttons"> <div class="tw-tab-buttons">
<$list filter="$tabsList$" variable="currentTab"> <$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> </$list>
</div> </div>
<div class="tw-tab-divider"/> <div class="tw-tab-divider"/>

View File

@ -53,12 +53,12 @@ function gettiddlername(title) {
var parserparams = function(paramString) { var parserparams = function(paramString) {
var params = [], 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); paramMatch = reParam.exec(paramString);
while(paramMatch) { while(paramMatch) {
// Process this parameter // Process this parameter
var paramInfo = { 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]) { if(paramMatch[1]) {
paramInfo.name = 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 //Create a list of names (tiddlers, tiddler/sections, tiddler/slices), and create maps from name -> label and name -> prompt
//Use json to implement maps //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 namedapter = {tabs:'__system_tabs'};
var paramadapter = { var paramadapter = {

View File

@ -103,12 +103,12 @@ var enclosedTextHelper = function(w) {
var insertMacroCall = function(w,output,macroName,paramString) { var insertMacroCall = function(w,output,macroName,paramString) {
var params = [], 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); paramMatch = reParam.exec(paramString);
while(paramMatch) { while(paramMatch) {
// Process this parameter // Process this parameter
var paramInfo = { 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]) { if(paramMatch[1]) {
paramInfo.name = paramMatch[1]; paramInfo.name = paramMatch[1];