1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-29 00:33:15 +00:00

Merge branch 'master' into geospatial-plugin

This commit is contained in:
jeremy@jermolene.com 2023-05-14 21:49:00 +01:00
commit a14f038780
56 changed files with 422 additions and 195 deletions

View File

@ -5,7 +5,7 @@
# Default to the current version number for building the plugin library # Default to the current version number for building the plugin library
if [ -z "$TW5_BUILD_VERSION" ]; then if [ -z "$TW5_BUILD_VERSION" ]; then
TW5_BUILD_VERSION=v5.2.8 TW5_BUILD_VERSION=v5.3.0
fi fi
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]" echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"

View File

@ -112,7 +112,7 @@ CheckboxWidget.prototype.getValue = function() {
var list; var list;
if(this.checkboxListField) { if(this.checkboxListField) {
if($tw.utils.hop(tiddler.fields,this.checkboxListField)) { if($tw.utils.hop(tiddler.fields,this.checkboxListField)) {
list = tiddler.getFieldList(this.checkboxListField); list = tiddler.getFieldList(this.checkboxListField) || [];
} else { } else {
list = $tw.utils.parseStringArray(this.checkboxDefault || "") || []; list = $tw.utils.parseStringArray(this.checkboxDefault || "") || [];
} }
@ -208,16 +208,20 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
if(this.checkboxListField || this.checkboxListIndex) { if(this.checkboxListField || this.checkboxListIndex) {
var fieldContents, listContents, oldPos, newPos; var fieldContents, listContents, oldPos, newPos;
if(this.checkboxListField) { if(this.checkboxListField) {
fieldContents = tiddler ? tiddler.fields[this.checkboxListField] : undefined; fieldContents = (tiddler ? tiddler.fields[this.checkboxListField] : undefined) || [];
} else { } else {
fieldContents = this.wiki.extractTiddlerDataItem(this.checkboxTitle,this.checkboxListIndex); fieldContents = this.wiki.extractTiddlerDataItem(this.checkboxTitle,this.checkboxListIndex);
} }
if($tw.utils.isArray(fieldContents)) { if($tw.utils.isArray(fieldContents)) {
// Make a copy so we can modify it without changing original that's refrenced elsewhere // Make a copy so we can modify it without changing original that's refrenced elsewhere
listContents = fieldContents.slice(0); listContents = fieldContents.slice(0);
} else { } else if(typeof fieldContents === "string") {
listContents = $tw.utils.parseStringArray(fieldContents) || []; listContents = $tw.utils.parseStringArray(fieldContents);
// No need to copy since parseStringArray returns a fresh array, not refrenced elsewhere // No need to copy since parseStringArray returns a fresh array, not refrenced elsewhere
} else {
// Field was neither an array nor a string; it's probably something that shouldn't become
// an array (such as a date field), so bail out *without* triggering actions
return;
} }
oldPos = notValue ? listContents.indexOf(notValue) : -1; oldPos = notValue ? listContents.indexOf(notValue) : -1;
newPos = value ? listContents.indexOf(value) : -1; newPos = value ? listContents.indexOf(value) : -1;

View File

@ -51,7 +51,8 @@ MacroCallWidget.prototype.execute = function() {
var positionalName = 0, var positionalName = 0,
parseTreeNodes = [{ parseTreeNodes = [{
type: "transclude", type: "transclude",
isBlock: this.parseTreeNode.isBlock isBlock: this.parseTreeNode.isBlock,
children: this.parseTreeNode.children
}]; }];
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$variable",this.macroName); $tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$variable",this.macroName);
$tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$type",this.parseType); $tw.utils.addAttributeToParseTreeNode(parseTreeNodes[0],"$type",this.parseType);

View File

@ -48,7 +48,7 @@ SlotWidget.prototype.execute = function() {
var pointer = this.parentWidget, var pointer = this.parentWidget,
depth = this.slotDepth; depth = this.slotDepth;
while(pointer) { while(pointer) {
if(pointer instanceof TranscludeWidget) { if(pointer instanceof TranscludeWidget && pointer.hasVisibleSlots()) {
depth--; depth--;
if(depth <= 0) { if(depth <= 0) {
break; break;

View File

@ -45,7 +45,7 @@ TranscludeWidget.prototype.execute = function() {
var target = this.getTransclusionTarget(), var target = this.getTransclusionTarget(),
parseTreeNodes = target.parseTreeNodes; parseTreeNodes = target.parseTreeNodes;
this.sourceText = target.text; this.sourceText = target.text;
this.sourceType = target.type; this.parserType = target.type;
this.parseAsInline = target.parseAsInline; this.parseAsInline = target.parseAsInline;
// Process the transclusion according to the output type // Process the transclusion according to the output type
switch(this.transcludeOutput || "text/html") { switch(this.transcludeOutput || "text/html") {
@ -58,7 +58,7 @@ TranscludeWidget.prototype.execute = function() {
break; break;
default: default:
// text/plain // text/plain
var plainText = this.wiki.renderText("text/plain",this.sourceType,this.sourceText,{parentWidget: this}); var plainText = this.wiki.renderText("text/plain",this.parserType,this.sourceText,{parentWidget: this});
parseTreeNodes = [{type: "text", text: plainText}]; parseTreeNodes = [{type: "text", text: plainText}];
break; break;
} }
@ -171,99 +171,101 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
} }
var parser; var parser;
// Get the parse tree // Get the parse tree
if(this.transcludeVariable) { if(this.hasAttribute("$variable")) {
// Transcluding a variable if(this.transcludeVariable) {
var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}), // Transcluding a variable
srcVariable = variableInfo && variableInfo.srcVariable; var variableInfo = this.getVariableInfo(this.transcludeVariable,{params: this.getOrderedTransclusionParameters()}),
if(srcVariable) { srcVariable = variableInfo && variableInfo.srcVariable;
if(srcVariable.isFunctionDefinition) { if(variableInfo.text) {
// Function to return parameters by name or position if(srcVariable.isFunctionDefinition) {
var fnGetParam = function(name,index) { // Function to return parameters by name or position
// Parameter names starting with dollar must be escaped to double dollars var fnGetParam = function(name,index) {
if(name.charAt(0) === "$") { // Parameter names starting with dollar must be escaped to double dollars
name = "$" + name; if(name.charAt(0) === "$") {
} name = "$" + name;
// Look for the parameter by name }
if(self.hasAttribute(name)) { // Look for the parameter by name
return self.getAttribute(name); if(self.hasAttribute(name)) {
// Look for the parameter by index return self.getAttribute(name);
} else if(self.hasAttribute(index + "")) { // Look for the parameter by index
return self.getAttribute(index + ""); } else if(self.hasAttribute(index + "")) {
} else { return self.getAttribute(index + "");
return undefined; } else {
} return undefined;
}, }
result = this.evaluateVariable(this.transcludeVariable,{params: fnGetParam})[0] || ""; },
parser = { result = this.evaluateVariable(this.transcludeVariable,{params: fnGetParam})[0] || "";
tree: [{ parser = {
type: "text", tree: [{
text: result
}],
source: result,
type: "text/vnd.tiddlywiki"
};
if(parseAsInline) {
parser.tree[0] = {
type: "text",
text: result
};
} else {
parser.tree[0] = {
type: "element",
tag: "p",
children: [{
type: "text", type: "text",
text: result text: result
}] }],
} source: result,
} type: "text/vnd.tiddlywiki"
} else { };
var cacheKey = (parseAsInline ? "inlineParser" : "blockParser") + (this.transcludeType || ""); if(parseAsInline) {
if(variableInfo.isCacheable && srcVariable[cacheKey]) { parser.tree[0] = {
parser = srcVariable[cacheKey]; type: "text",
} else { text: result
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable.configTrimWhiteSpace}); };
if(variableInfo.isCacheable) { } else {
srcVariable[cacheKey] = parser; parser.tree[0] = {
} type: "element",
} tag: "p",
} children: [{
if(parser) { type: "text",
// Add parameters widget for procedures and custom widgets text: result
if(srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition) { }]
parser = {
tree: [
{
type: "parameters",
children: parser.tree
}
],
source: parser.source,
type: parser.type
}
$tw.utils.each(srcVariable.params,function(param) {
var name = param.name;
// Parameter names starting with dollar must be escaped to double dollars
if(name.charAt(0) === "$") {
name = "$" + name;
} }
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
});
} else {
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
parser = {
tree: [
{
type: "vars",
children: parser.tree
}
],
source: parser.source,
type: parser.type
} }
$tw.utils.each(variableInfo.params,function(param) { } else {
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],"__" + param.name + "__",param.value) var cacheKey = (parseAsInline ? "inlineParser" : "blockParser") + (this.transcludeType || "");
}); if(variableInfo.isCacheable && srcVariable[cacheKey]) {
parser = srcVariable[cacheKey];
} else {
parser = this.wiki.parseText(this.transcludeType,variableInfo.text || "",{parseAsInline: parseAsInline, configTrimWhiteSpace: srcVariable.configTrimWhiteSpace});
if(variableInfo.isCacheable) {
srcVariable[cacheKey] = parser;
}
}
}
if(parser) {
// Add parameters widget for procedures and custom widgets
if(srcVariable.isProcedureDefinition || srcVariable.isWidgetDefinition) {
parser = {
tree: [
{
type: "parameters",
children: parser.tree
}
],
source: parser.source,
type: parser.type
}
$tw.utils.each(srcVariable.params,function(param) {
var name = param.name;
// Parameter names starting with dollar must be escaped to double dollars
if(name.charAt(0) === "$") {
name = "$" + name;
}
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],name,param["default"])
});
} else {
// For macros and ordinary variables, wrap the parse tree in a vars widget assigning the parameters to variables named "__paramname__"
parser = {
tree: [
{
type: "vars",
children: parser.tree
}
],
source: parser.source,
type: parser.type
}
$tw.utils.each(variableInfo.params,function(param) {
$tw.utils.addAttributeToParseTreeNode(parser.tree[0],"__" + param.name + "__",param.value)
});
}
} }
} }
} }
@ -382,6 +384,13 @@ TranscludeWidget.prototype.getTransclusionSlotFill = function(name,defaultParseT
} }
}; };
/*
Return whether this transclusion should be visible to the slot widget
*/
TranscludeWidget.prototype.hasVisibleSlots = function() {
return this.getAttribute("$fillignore","no") === "no";
}
/* /*
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
*/ */

View File

@ -324,7 +324,7 @@ Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
}; };
/* /*
Evaluate a variable and associated actual parameters and result the resulting array. Evaluate a variable and associated actual parameters and return the resulting array.
The way that the variable is evaluated depends upon its type: The way that the variable is evaluated depends upon its type:
* Functions are evaluated as parameterised filter strings * Functions are evaluated as parameterised filter strings
* Macros are returned as plain text with substitution of parameters * Macros are returned as plain text with substitution of parameters

View File

@ -1149,7 +1149,7 @@ exports.makeTranscludeWidget = function(title,options) {
if(options.importVariables) { if(options.importVariables) {
parseTreeImportVariables.attributes.filter.value = options.importVariables; parseTreeImportVariables.attributes.filter.value = options.importVariables;
} else if(options.importPageMacros) { } else if(options.importPageMacros) {
parseTreeImportVariables.attributes.filter.value = "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]"; parseTreeImportVariables.attributes.filter.value = this.getTiddlerText("$:/core/config/GlobalImportFilter");
} }
parseTreeDiv.tree[0].children.push(parseTreeImportVariables); parseTreeDiv.tree[0].children.push(parseTreeImportVariables);
parseTreeImportVariables.children.push(parseTreeTransclude); parseTreeImportVariables.children.push(parseTreeTransclude);

View File

@ -3,5 +3,5 @@ title: $:/core/templates/exporters/StaticRiver/Content
\define renderContent() \define renderContent()
{{{ $(exportFilter)$ ||$:/core/templates/static-tiddler}}} {{{ $(exportFilter)$ ||$:/core/templates/static-tiddler}}}
\end \end
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
<<renderContent>> <<renderContent>>

View File

@ -7,5 +7,5 @@ condition: [<count>compare:lte[1]]
\define renderContent() \define renderContent()
{{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}} {{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}}
\end \end
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
<<renderContent>> <<renderContent>>

View File

@ -1,7 +1,7 @@
title: $:/core/save/all-external-js title: $:/core/save/all-external-js
\whitespace trim \whitespace trim
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
\define saveTiddlerFilter() \define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ [is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
\end \end

View File

@ -1,7 +1,7 @@
title: $:/core/save/offline-external-js title: $:/core/save/offline-external-js
\whitespace trim \whitespace trim
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
\define saveTiddlerFilter() \define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ [is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
\end \end

View File

@ -1,6 +1,6 @@
title: $:/core/save/all title: $:/core/save/all
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
\define saveTiddlerFilter() \define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ [is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
\end \end

View File

@ -2,7 +2,7 @@ title: $:/core/templates/server/static.tiddler.html
\whitespace trim \whitespace trim
\define tv-wikilink-template() $uri_encoded$ \define tv-wikilink-template() $uri_encoded$
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

View File

@ -4,7 +4,7 @@ title: $:/core/templates/single.tiddler.window
\define containerClasses() \define containerClasses()
tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
\end \end
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
<$vars <$vars
tv-config-toolbar-icons={{$:/config/Toolbar/Icons}} tv-config-toolbar-icons={{$:/config/Toolbar/Icons}}

View File

@ -4,7 +4,7 @@ title: $:/core/templates/static.tiddler.html
\define tv-config-toolbar-icons() no \define tv-config-toolbar-icons() no
\define tv-config-toolbar-text() no \define tv-config-toolbar-text() no
\define tv-config-toolbar-class() tc-btn-invisible \define tv-config-toolbar-class() tc-btn-invisible
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
`<!doctype html> `<!doctype html>
<html> <html>
<head> <head>

View File

@ -30,15 +30,15 @@ Block transclusions are shown in red, and inline transclusions are shown in gree
<!-- Look for a parameter starting with $ to determine if we are in legacy mode --> <!-- Look for a parameter starting with $ to determine if we are in legacy mode -->
<$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage=""" <$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage="""
<!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode --> <!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode -->
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>>> <$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>> $$fillignore="yes">
<!-- Reach back up to the grandparent transclusion to get the correct slot value --> <!-- Reach back up to the grandparent transclusion to get the correct slot value -->
<$slot $name="ts-raw" $depth="2"/> <$slot $name="ts-raw"/>
</$genesis> </$genesis>
"""> """>
<!-- Non-legacy mode: we use dollar signs for the recursionMarker and mode --> <!-- Non-legacy mode: we use dollar signs for the recursionMarker and mode -->
<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>>> <$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>> $$fillignore="yes">
<!-- Reach back up to the grandparent transclusion to get the correct slot fill value --> <!-- Reach back up to the grandparent transclusion to get the correct slot fill value -->
<$slot $name="ts-raw" $depth="2"/> <$slot $name="ts-raw"/>
</$genesis> </$genesis>
</$list> </$list>
</$genesis> </$genesis>

View File

@ -211,7 +211,7 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
</div> </div>
\end \end
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
\whitespace trim \whitespace trim
<div> <div>

View File

@ -2,7 +2,7 @@ title: $:/core/ui/EditTemplate/body/preview/output
tags: $:/tags/EditPreview tags: $:/tags/EditPreview
caption: {{$:/language/EditTemplate/Body/Preview/Type/Output}} caption: {{$:/language/EditTemplate/Body/Preview/Type/Output}}
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]] [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!has[draft.of]] \import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View/Body]!is[draft]]
<$set name="tv-tiddler-preview" value="yes"> <$set name="tv-tiddler-preview" value="yes">
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateBodyFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/body/default]] }}} /> <$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateBodyFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/body/default]] }}} />

View File

@ -1,6 +1,6 @@
title: $:/core/ui/PageStylesheet title: $:/core/ui/PageStylesheet
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
\whitespace trim \whitespace trim
<$set name="currentTiddler" value={{$:/language}}> <$set name="currentTiddler" value={{$:/language}}>

View File

@ -4,7 +4,7 @@ description: {{$:/language/PageTemplate/Description}}
icon: $:/core/images/layout-button icon: $:/core/images/layout-button
\whitespace trim \whitespace trim
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
<$vars <$vars
tv-config-toolbar-icons={{$:/config/Toolbar/Icons}} tv-config-toolbar-icons={{$:/config/Toolbar/Icons}}

View File

@ -5,10 +5,10 @@ title: $:/core/ui/ViewTemplate
$:/state/folded/$(currentTiddler)$ $:/state/folded/$(currentTiddler)$
\end \end
\define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/> \define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/>
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]] \import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View]!is[draft]]
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>> <$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}} role="article"> <div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}} role="article">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!is[draft]]" variable="listItem">
<$transclude tiddler=<<listItem>>/> <$transclude tiddler=<<listItem>>/>
</$list> </$list>
</div> </div>

View File

@ -1,7 +1,7 @@
title: $:/core/ui/ViewTemplate/body title: $:/core/ui/ViewTemplate/body
tags: $:/tags/ViewTemplate tags: $:/tags/ViewTemplate
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!has[draft.of]] \import [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View/Body]!is[draft]]
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes"> <$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">

View File

@ -0,0 +1,2 @@
title: $:/core/config/GlobalImportFilter
text: [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global]!is[draft]]

View File

@ -3,14 +3,26 @@ tags: $:/tags/Macro
\define translink(title,mode:"block") \define translink(title,mode:"block")
\whitespace trim \whitespace trim
<div style="border:1px solid #ccc; padding: 0.5em; background: black; foreground; white;"> <$list filter="[<__mode__>match[block]]">
<div class="tc-translink">
<div>
<$link to="""$title$"""> <$link to="""$title$""">
<$text text="""$title$"""/> <h1><$text text="""$title$"""/></h1>
</$link> </$link>
<div style="border:1px solid #ccc; padding: 0.5em; background: white; foreground; black;"> <$transclude tiddler="""$title$""" mode="block">
<$transclude tiddler="""$title$""" mode="$mode$"> <$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
"<$text text="""$title$"""/>" is missing
</$transclude> </$transclude>
</div> </div>
</div> </div>
</$list>
<$list filter="[<__mode__>match[inline]]">
<span class="tc-translink">
<$link to="""$title$""">
<$text text="""$title$"""/>
</$link>
&#32;(<$transclude tiddler="""$title$""" mode="inline">
<$set name="currentTiddler" value="""$title$"""><$transclude tiddler="$:/language/MissingTiddler/Hint"/></$set>
</$transclude>)
</span>
</$list>
\end \end

View File

@ -5,7 +5,7 @@ title: $:/core/ui/ViewTemplate
$:/state/folded/$(currentTiddler)$ $:/state/folded/$(currentTiddler)$
\end \end
\define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/> \define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/>
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!has[draft.of]] \import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View]!is[draft]]
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>> <$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}> <div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}>
<$set name="state" value={{{ [[$:/state/viewtemplate/visibility/]addsuffix<currentTiddler>] }}}> <$set name="state" value={{{ [[$:/state/viewtemplate/visibility/]addsuffix<currentTiddler>] }}}>

View File

@ -5,7 +5,7 @@ type: text/vnd.tiddlywiki
\define tv-wikilink-template() https://tiddlywiki.com/static/$uri_doubleencoded$.html \define tv-wikilink-template() https://tiddlywiki.com/static/$uri_doubleencoded$.html
<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]"> <$importvariables filter={{$:/core/config/GlobalImportFilter}}>
Bienvenue sur <<tw>>, un carnet de notes personnel web et non-linéaire que tout le monde peut utiliser et conserver, sans dépendre d'une quelconque entreprise. Bienvenue sur <<tw>>, un carnet de notes personnel web et non-linéaire que tout le monde peut utiliser et conserver, sans dépendre d'une quelconque entreprise.

View File

@ -0,0 +1,40 @@
title: Transclude/Macro/Missing
description: Transcluding a missing or blank variable
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$macrocall $name="missingmacro">
Fallback content
</$macrocall>
<$transclude $variable="missingmacro">
Fallback content
</$transclude>
<$macrocall $name="">
Fallback content
</$macrocall>
<$transclude $variable="">
Fallback content
</$transclude>
<$let emptyVariable="">
<$macrocall $name="emptyVariable">
Fallback content
</$macrocall>
<$transclude $variable="emptyVariable">
Fallback content
</$transclude>
</$let>
+
title: ExpectedResult
<p>Fallback content</p><p>Fallback content</p><p>Fallback content</p><p>Fallback content</p><p>Fallback content</p><p>Fallback content</p>

View File

@ -56,7 +56,7 @@ Tests the checkbox widget thoroughly.
* Test data for checkbox widget tests * Test data for checkbox widget tests
*/ */
const fieldModeTests = [ var fieldModeTests = [
{ {
testName: "field mode checked", testName: "field mode checked",
tiddlers: [{title: "TiddlerOne", text: "Jolly Old World", expand: "yes"}], tiddlers: [{title: "TiddlerOne", text: "Jolly Old World", expand: "yes"}],
@ -95,16 +95,16 @@ Tests the checkbox widget thoroughly.
}, },
]; ];
const indexModeTests = fieldModeTests.map(data => { var indexModeTests = fieldModeTests.map(data => {
const newData = {...data}; var newData = {...data};
const newName = data.testName.replace('field mode', 'index mode'); var newName = data.testName.replace('field mode', 'index mode');
const newTiddlers = data.tiddlers.map(tiddler => { var newTiddlers = data.tiddlers.map(tiddler => {
return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\nexpand: ${tiddler.expand}\ntwo: b`} return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\nexpand: ${tiddler.expand}\ntwo: b`}
}); });
const newWidgetText = data.widgetText.replace("field='expand'", "index='expand'"); var newWidgetText = data.widgetText.replace("field='expand'", "index='expand'");
const newChange = {}; var newChange = {};
for (const key of Object.keys(data.expectedChange)) { for (var key of Object.keys(data.expectedChange)) {
const oldChange = data.expectedChange[key]; var oldChange = data.expectedChange[key];
if (oldChange.expand) { if (oldChange.expand) {
newChange[key] = { text: `one: a\nexpand: ${oldChange.expand}\ntwo: b` } newChange[key] = { text: `one: a\nexpand: ${oldChange.expand}\ntwo: b` }
} else { } else {
@ -119,7 +119,26 @@ Tests the checkbox widget thoroughly.
return newData; return newData;
}); });
const listModeTests = [ var listModeTestsForDateFields = [
{
testName: "list mode created date field",
tiddlers: [{title: "Colors", created: "201304152222", modified: "202301022222"}],
widgetText: "<$checkbox tiddler='Colors' listField='created' checked='green' />",
startsOutChecked: false,
finalValue: false,
expectedChange: { "Colors": { created: new Date("2013-04-15T22:22:00Z")}} // created field should *not* be touched by a listField checkbox
},
{
testName: "list mode modified date field",
tiddlers: [{title: "Colors", created: "201304152222", modified: "202301022222"}],
widgetText: "<$checkbox tiddler='Colors' listField='modified' checked='green' />",
startsOutChecked: false,
finalValue: false,
expectedChange: { "Colors": { modified: new Date("2023-01-02T22:22:00Z")}} // modified field should *not* be touched by a listField checkbox
},
]
var listModeTests = [
{ {
testName: "list mode add", testName: "list mode add",
tiddlers: [{title: "Colors", colors: "orange yellow"}], tiddlers: [{title: "Colors", colors: "orange yellow"}],
@ -235,11 +254,11 @@ Tests the checkbox widget thoroughly.
]; ];
// https://github.com/Jermolene/TiddlyWiki5/issues/6871 // https://github.com/Jermolene/TiddlyWiki5/issues/6871
const listModeTestsWithListField = ( var listModeTestsWithListField = (
listModeTests listModeTests
.filter(data => data.widgetText.includes("listField='colors'")) .filter(data => data.widgetText.includes("listField='colors'"))
.map(data => { .map(data => {
const newData = { var newData = {
...data, ...data,
tiddlers: data.tiddlers.map(tiddler => ({...tiddler, list: tiddler.colors, colors: undefined})), tiddlers: data.tiddlers.map(tiddler => ({...tiddler, list: tiddler.colors, colors: undefined})),
widgetText: data.widgetText.replace("listField='colors'", "listField='list'"), widgetText: data.widgetText.replace("listField='colors'", "listField='list'"),
@ -250,11 +269,11 @@ Tests the checkbox widget thoroughly.
return newData; return newData;
}) })
); );
const listModeTestsWithTagsField = ( var listModeTestsWithTagsField = (
listModeTests listModeTests
.filter(data => data.widgetText.includes("listField='colors'")) .filter(data => data.widgetText.includes("listField='colors'"))
.map(data => { .map(data => {
const newData = { var newData = {
...data, ...data,
tiddlers: data.tiddlers.map(tiddler => ({...tiddler, tags: tiddler.colors, colors: undefined})), tiddlers: data.tiddlers.map(tiddler => ({...tiddler, tags: tiddler.colors, colors: undefined})),
widgetText: data.widgetText.replace("listField='colors'", "listField='tags'"), widgetText: data.widgetText.replace("listField='colors'", "listField='tags'"),
@ -266,20 +285,20 @@ Tests the checkbox widget thoroughly.
}) })
); );
const indexListModeTests = listModeTests.map(data => { var indexListModeTests = listModeTests.map(data => {
const newData = {...data}; var newData = {...data};
const newName = data.testName.replace('list mode', 'index list mode'); var newName = data.testName.replace('list mode', 'index list mode');
const newTiddlers = data.tiddlers.map(tiddler => { var newTiddlers = data.tiddlers.map(tiddler => {
if (tiddler.hasOwnProperty('colors')) { if (tiddler.hasOwnProperty('colors')) {
return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\ncolors: ${tiddler.colors}\ntwo: b`} return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\ncolors: ${tiddler.colors}\ntwo: b`}
} else if (tiddler.hasOwnProperty('someField')) { } else if (tiddler.hasOwnProperty('someField')) {
return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\nsomeField: ${tiddler.someField}\ntwo: b`} return {title: tiddler.title, type: "application/x-tiddler-dictionary", text: `one: a\nsomeField: ${tiddler.someField}\ntwo: b`}
} }
}); });
const newWidgetText = data.widgetText.replace("listField='colors'", "listIndex='colors'").replace(/\$field/g, '$index').replace("listField='someField'", "listIndex='someField'"); var newWidgetText = data.widgetText.replace("listField='colors'", "listIndex='colors'").replace(/\$field/g, '$index').replace("listField='someField'", "listIndex='someField'");
const newChange = {}; var newChange = {};
for (const key of Object.keys(data.expectedChange)) { for (var key of Object.keys(data.expectedChange)) {
const oldChange = data.expectedChange[key]; var oldChange = data.expectedChange[key];
if (oldChange.colors) { if (oldChange.colors) {
newChange[key] = { text: `one: a\ncolors: ${oldChange.colors}\ntwo: b` } newChange[key] = { text: `one: a\ncolors: ${oldChange.colors}\ntwo: b` }
} else if (oldChange.someField !== undefined) { } else if (oldChange.someField !== undefined) {
@ -296,7 +315,7 @@ Tests the checkbox widget thoroughly.
return newData; return newData;
}); });
const filterModeTests = [ var filterModeTests = [
{ {
testName: "filter mode false -> true", testName: "filter mode false -> true",
tiddlers: [{title: "Colors", colors: "red orange yellow"}], tiddlers: [{title: "Colors", colors: "red orange yellow"}],
@ -482,9 +501,10 @@ Tests the checkbox widget thoroughly.
}, },
]; ];
const checkboxTestData = fieldModeTests.concat( var checkboxTestData = fieldModeTests.concat(
indexModeTests, indexModeTests,
listModeTests, listModeTests,
listModeTestsForDateFields,
listModeTestsWithListField, listModeTestsWithListField,
listModeTestsWithTagsField, listModeTestsWithTagsField,
indexListModeTests, indexListModeTests,
@ -494,7 +514,7 @@ Tests the checkbox widget thoroughly.
/* /*
* Checkbox widget tests using the test data above * Checkbox widget tests using the test data above
*/ */
for (const data of checkboxTestData) { for (var data of checkboxTestData) {
it('checkbox widget test: ' + data.testName, function() { it('checkbox widget test: ' + data.testName, function() {
// Setup // Setup
@ -505,7 +525,7 @@ Tests the checkbox widget thoroughly.
// Check initial state // Check initial state
const widget = findNodeOfType('checkbox', widgetNode); var widget = findNodeOfType('checkbox', widgetNode);
// Verify that the widget is or is not checked as expected // Verify that the widget is or is not checked as expected
expect(widget.getValue()).toBe(data.startsOutChecked); expect(widget.getValue()).toBe(data.startsOutChecked);
@ -519,16 +539,16 @@ Tests the checkbox widget thoroughly.
widget.handleChangeEvent(null); widget.handleChangeEvent(null);
// Check state again: in most tests, checkbox should be inverse of what it was // Check state again: in most tests, checkbox should be inverse of what it was
const finalValue = data.hasOwnProperty('finalValue') ? data.finalValue : !data.startsOutChecked; var finalValue = data.hasOwnProperty('finalValue') ? data.finalValue : !data.startsOutChecked;
expect(widget.getValue()).toBe(finalValue); expect(widget.getValue()).toBe(finalValue);
// Check that tiddler(s) has/have gone through expected change(s) // Check that tiddler(s) has/have gone through expected change(s)
for (const key of Object.keys(data.expectedChange)) { for (var key of Object.keys(data.expectedChange)) {
const tiddler = wiki.getTiddler(key); var tiddler = wiki.getTiddler(key);
const change = data.expectedChange[key]; var change = data.expectedChange[key];
for (const fieldName of Object.keys(change)) { for (var fieldName of Object.keys(change)) {
const expectedValue = change[fieldName]; var expectedValue = change[fieldName];
const fieldValue = tiddler.fields[fieldName]; var fieldValue = tiddler.fields[fieldName];
expect(fieldValue).toEqual(expectedValue); expect(fieldValue).toEqual(expectedValue);
} }
} }

View File

@ -45,7 +45,7 @@ Special tags assign special behaviour or appearance to all of the tiddlers to wh
For example: For example:
* $:/tags/Macro causes the macros defined in a tiddler to be available globally * $:/tags/Global causes the definitions in a tiddler to be available globally
* $:/tags/Stylesheet causes the tiddler to be interpreted as a CSS stylesheet * $:/tags/Stylesheet causes the tiddler to be interpreted as a CSS stylesheet
* $:/tags/SideBar causes the tiddler to be displayed as a sidebar tab * $:/tags/SideBar causes the tiddler to be displayed as a sidebar tab

View File

@ -36,7 +36,7 @@ The initial startup actions are useful for customising TiddlyWiki according to e
Note that global macros are not available within initial startup action tiddlers by default. If you need to access them then you'll need to explicitly include them with an [[Pragma: \import]] at the top of the tiddler: Note that global macros are not available within initial startup action tiddlers by default. If you need to access them then you'll need to explicitly include them with an [[Pragma: \import]] at the top of the tiddler:
``` ```
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
``` ```
!! Post-Render Startup Actions !! Post-Render Startup Actions

View File

@ -77,11 +77,11 @@ In the [[Keyboard Shortcuts Tab|$:/core/ui/ControlPanel/KeyboardShortcuts]] the
> If the tiddler has the tag <<tag $:/tags/KeyboardShortcut>>, the field ''key'' with the [[Keyboard Shortcut Descriptor]] as its value and some actions in its text field, the actions will be triggered when the mechanism detects the configured key-combination > If the tiddler has the tag <<tag $:/tags/KeyboardShortcut>>, the field ''key'' with the [[Keyboard Shortcut Descriptor]] as its value and some actions in its text field, the actions will be triggered when the mechanism detects the configured key-combination
<br> <br>
<$macrocall $name=".tip" _="""''Macros'' defined ''outside'' a global keyboard-shortcut (through a tiddler tagged `$:/tags/Macro`) need to be ''imported'' in order to be accessible. <$macrocall $name=".tip" _="""''Macros'' defined ''outside'' a global keyboard-shortcut (through a tiddler tagged `$:/tags/Global`) need to be ''imported'' in order to be accessible.
The [[import pragma|Pragma]] can be used for that"""/> The [[import pragma|Pragma]] can be used for that"""/>
<pre> <pre>
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
</pre> </pre>
If the tiddler that contains the macro definition is known and - for example - titled `my-macro-tiddler` If the tiddler that contains the macro definition is known and - for example - titled `my-macro-tiddler`

View File

@ -1,22 +1,18 @@
created: 20160810122928198 created: 20160810122928198
modified: 20160810122934291 modified: 20230505104214168
tags: [[Editor toolbar]] tags: [[Editor toolbar]]
title: Using Excise title: Using Excise
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
! Excise text ! Excise text
From the EditorToolbar you can export selected text to a new tiddler and insert a [[link|Linking in WikiText]] [[Transclusion]] or [[macro|Macros]] in its place. Click ''Excise text'' (<<.icon $:/core/images/excise>>), input name of the new tiddler, and choose excise method. From the EditorToolbar you can export selected text to a new tiddler and insert a [[link|Linking in WikiText]] [[Transclusion]] or [[macro|Macros]] in its place. Click ''Excise text'' (<<.icon $:/core/images/excise>>), input name of the new tiddler, and choose excise method.
!! How to excise text !! How to excise text
# Highlight the relevant piece of text # Highlight the relevant piece of text
#Click ''Excise text'' (<<.icon $:/core/images/excise>>) # Click ''Excise text'' (<<.icon $:/core/images/excise>>)
# Give the new tiddler a title. # Give the new tiddler a title.
# Chosse if the new tiddler will be tagged with the title of the current tiddler''*''. # Chosse if the new tiddler will be tagged with the title of the current tiddler (see note below).
# Choose replacing method. [[link|Linking in WikiText]] [[Transclusion]] or [[macro|Macros]]. # Choose replacing method: [[link|Linking in WikiText]], [[transclusion|Transclusion]], or [[macro|Macros]].
# Click the ''{{$:/language/Buttons/Excise/Caption/Excise}}'' button # Click the ''{{$:/language/Buttons/Excise/Caption/Excise}}'' button
<<.strong Note!>> If you choose the option to `Tag new tiddler with the title of this tiddler`, the new tiddler will be tagged with the name of the current tiddler before it has been edited. If you have changed the title of the current tiddler, save it first and edit it again to perform excision with this option.
''*NOTE:'' If you choose tic the option to `Tag new tiddler with the title of this tiddler`. The tag will be the'' draft title''. If you create a new tiddler (or clone an existing one), the draft title and the tag, will be `New Tiddler`. __You have to save the tiddler and re-edit it to get the new title as tag.__

View File

@ -0,0 +1,21 @@
created: 20230505090333510
modified: 20230505090333510
tags: Macros [[Core Macros]]
title: translink Macro
type: text/vnd.tiddlywiki
caption: translink
The <<.def translink>> [[macro|Macros]] returns a frame with the title and [[transcluded|Transclusion]] text of a chosen tiddler. The title links to the transcluded tiddler.
If the chosen tiddler is missing, an appropriate message will be shown instead of the transcluded text.
This is the default macro used when [[excising|Using Excise]] text and replacing it with a macro.
!! Parameters
; title
: The title of the tiddler to be transcluded
; mode
: The mode of the [[transclude widget|TranscludeWidget]] used inside the macro, defaults to `block`
<<.macro-examples "translink">>

View File

@ -0,0 +1,9 @@
created: 20230505092952569
modified: 20230505092952569
tags: [[translink Macro]] [[Macro Examples]]
title: translink Macro (Examples)
type: text/vnd.tiddlywiki
<$macrocall $name=".example" n="1" eg="""<<translink "Philosophy of Tiddlers">>"""/>
<$macrocall $name=".example" n="2" eg="""<<translink "Philosophy of Tiddlers" inline>>"""/>
<$macrocall $name=".example" n="3" eg="""<<translink Foo>>"""/>

View File

@ -13,7 +13,7 @@ Excises the currently selected text into a new tiddler and replaces it with a li
|!Name |!Description | |!Name |!Description |
|title |Title of the new tiddler the selected content is excised to| |title |Title of the new tiddler the selected content is excised to|
|type |Type of the replacement to be inserted: Can be one of <<.value "transclude">>, <<.value "link">> or <<.value "macro">>| |type |Type of the replacement to be inserted: Can be one of <<.value "transclude">>, <<.value "link">> or <<.value "macro">>|
|macro |In case //type=<<.value "macro">>//, specifies the name of the macro to be inserted. The title of the new tiddler is provided as the first parameter to the macro. Defaults to the ''translink'' macro| |macro |In case //type=<<.value "macro">>//, specifies the name of the macro to be inserted. The title of the new tiddler is provided as the first parameter to the macro. Defaults to the [[translink macro|translink Macro]]|
|tagnew |If '<<.value "yes">>', will tag the new tiddler with the title of the tiddler currently being edited | |tagnew |If '<<.value "yes">>', will tag the new tiddler with the title of the tiddler currently being edited |
</div> </div>

View File

@ -13,5 +13,5 @@ The ''\import'' [[pragma|Pragmas]] is used to import definitions from other tidd
For example: For example:
``` ```
\import [all[shadows+tiddlers]tag[$:/tags/Macro]] \import [all[shadows+tiddlers]tag[$:/tags/Global]]
``` ```

View File

@ -34,10 +34,10 @@ Procedures are implemented as a special kind of [[variable|Variables]] and so in
The [[Pragma: \import]] or <<.wlink ImportVariablesWidget>> widget can be used to copy procedure definitions from another tiddler. The [[Pragma: \import]] or <<.wlink ImportVariablesWidget>> widget can be used to copy procedure definitions from another tiddler.
!! `$:/tags/Macro` Tag !! `$:/tags/Global` Tag
Global procedures can be defined using the [[SystemTag: $:/tags/Macro]]. Global procedures can be defined using the [[SystemTag: $:/tags/Global]].
The tag [[SystemTag: $:/tags/Macro/View]] is used to define procedures that should only be available within the main view template and the preview panel. The tag [[SystemTag: $:/tags/Global/View]] is used to define procedures that should only be available within the main view template and the preview panel.
The tag [[SystemTag: $:/tags/Macro/View/Body]] is used to define procedures that should only be available within the main view template body and the preview panel. The tag [[SystemTag: $:/tags/Global/View/Body]] is used to define procedures that should only be available within the main view template body and the preview panel.

View File

@ -4,7 +4,7 @@ title: ReadMe
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
\define tv-wikilink-template() https://tiddlywiki.com/static/$uri_doubleencoded$.html \define tv-wikilink-template() https://tiddlywiki.com/static/$uri_doubleencoded$.html
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
Welcome to TiddlyWiki, a non-linear personal web notebook that anyone can use and keep forever, independently of any corporation. Welcome to TiddlyWiki, a non-linear personal web notebook that anyone can use and keep forever, independently of any corporation.

View File

@ -4,7 +4,7 @@ tags: $:/tags/RawMarkupWikified/TopBody
title: $:/SplashScreen title: $:/SplashScreen
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
\procedure show-icon(title) \procedure show-icon(title)
<$wikify name="icon" text={{{ [<title>addprefix[{{]addsuffix[}}]] }}} output="html"> <$wikify name="icon" text={{{ [<title>addprefix[{{]addsuffix[}}]] }}} output="html">

View File

@ -0,0 +1,9 @@
caption: $:/tags/Global
created: 20230419103154329
description: marks global definitions
modified: 20230419103154329
tags: SystemTags
title: SystemTag: $:/tags/Global
type: text/vnd.tiddlywiki
The [[system tag|SystemTags]] `$:/tags/Global` marks global definitions that are made available everywhere.

View File

@ -0,0 +1,9 @@
caption: $:/tags/Global/View
created: 20230419103154329
description: marks global definitions only active in View template
modified: 20230419103154329
tags: SystemTags
title: SystemTag: $:/tags/Global/View
type: text/vnd.tiddlywiki
The [[system tag|SystemTags]] `$:/tags/Global/View` marks definitions that are only made available within the main view templates and the preview panel.

View File

@ -0,0 +1,9 @@
caption: $:/tags/Global/View/Body
created: 20230419103154329
description: marks global definitions only active in View template body
modified: 20230419103154329
tags: SystemTags
title: SystemTag: $:/tags/Global/View/Body
type: text/vnd.tiddlywiki
The [[system tag|SystemTags]] `$:/tags/Global/View/Body` marks definitions that are only made available within the main view template bodies and the preview panel.

View File

@ -6,4 +6,4 @@ tags: SystemTags
title: SystemTag: $:/tags/Macro title: SystemTag: $:/tags/Macro
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
The [[system tag|SystemTags]] `$:/tags/Macro` marks global macros The [[system tag|SystemTags]] `$:/tags/Macro` marks global macros. It is now deprecated in favour of [[SystemTag $:/tags/Global]].

View File

@ -6,4 +6,4 @@ tags: SystemTags
title: SystemTag: $:/tags/Macro/View title: SystemTag: $:/tags/Macro/View
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
The [[system tag|SystemTags]] `$:/tags/Macro/View` marks macros that are only made available within the main view templates and the preview panel. The [[system tag|SystemTags]] `$:/tags/Macro/View` marks macros that are only made available within the main view templates and the preview panel. It is now deprecated in favour of [[SystemTag $:/tags/Global/View]].

View File

@ -6,4 +6,4 @@ tags: SystemTags
title: SystemTag: $:/tags/Macro/View/Body title: SystemTag: $:/tags/Macro/View/Body
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
The [[system tag|SystemTags]] `$:/tags/Macro/View/Body` marks macros that are only made available within the main view template bodies and the preview panel. The [[system tag|SystemTags]] `$:/tags/Macro/View/Body` marks macros that are only made available within the main view template bodies and the preview panel. It is now deprecated in favour of [[SystemTag $:/tags/Global/View/Body]].

View File

@ -10,9 +10,9 @@ The first example shows how <<.def thisTiddler>> works whithin transcluded templ
The second example shows <<.def thisTiddler>> in the body of tiddler and inside a macro. The second example shows <<.def thisTiddler>> in the body of tiddler and inside a macro.
<$macrocall $name=".example" n="1" eg="""<$text text=<<thisTiddler>>/>"""/> <$macrocall $name=".example" n="2" eg="""<$text text=<<thisTiddler>>/>"""/>
<$macrocall $name=".example" n="2" eg="""\define example() <$text text=<<thisTiddler>>/> <$macrocall $name=".example" n="3" eg="""\define example() <$text text=<<thisTiddler>>/>
<<example>> <<example>>
"""/> """/>

View File

@ -1,4 +1,4 @@
caption: currentTiddler caption: thisTiddler
created: 20230304122810114 created: 20230304122810114
modified: 20230505200086200 modified: 20230505200086200
tags: Variables [[Core Variables]] tags: Variables [[Core Variables]]

View File

@ -1,6 +1,6 @@
caption: fill caption: fill
created: 20220909111836951 created: 20220909111836951
modified: 20230419103154328 modified: 20230511123456782
tags: Widgets tags: Widgets
title: FillWidget title: FillWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -9,7 +9,7 @@ type: text/vnd.tiddlywiki
<<.from-version "5.3.0">> The <<.wlink FillWidget>> widget is used within a <<.wlink TranscludeWidget>> widget to specify the content that should be copied to the named "slot". Slots are defined by the <<.wlink SlotWidget>> widget within the transcluded content. <<.from-version "5.3.0">> The <<.wlink FillWidget>> widget is used within a <<.wlink TranscludeWidget>> widget to specify the content that should be copied to the named "slot". Slots are defined by the <<.wlink SlotWidget>> widget within the transcluded content.
See the <<.wlink TranscludeWidget>> widget for details. See the <<.wlink TranscludeWidget>> widget for details and an example. More examples can be found in the <<.wlink SlotWidget>> widget documentation.
! Attributes ! Attributes

View File

@ -1,6 +1,6 @@
caption: slot caption: slot
created: 20220909111836951 created: 20220909111836951
modified: 20230419103154329 modified: 20230511123922283
tags: Widgets tags: Widgets
title: SlotWidget title: SlotWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -17,3 +17,59 @@ The content of the <<.wlink SlotWidget>> widget is used as a fallback for the sl
|!Attribute |!Description | |!Attribute |!Description |
|$name |The name of the slot being defined | |$name |The name of the slot being defined |
|$depth |Optional number indicating how deep the <<.wlink SlotWidget>> widget is compared to the matching <<.wlink FillWidget>> widget as measured by the number of nested transclude widgets (defaults to 1). Transclude widgets whose <<.attr $fillignore>> attribute is set to ''yes'' are ignored, and do not affect the depth count |
! Examples
!! Quoted content
When content contains quotes, passing it through attributes and parameters can be challenging. However, passing the content using the <<.wlink FillWidget>> widget content eliminates the need to wrap it in quotes, making the process easier.
<$let bold_slot='<b>
<$slot $name="body"/>
</b>
'>
If a variable named <<.var bold_slot>> contains the following <<.wlink SlotWidget>> definition:
<$codeblock code={{{[[bold_slot]getvariable[]]}}}/>
then the slot can be filled using this variable transclusion:
<<wikitext-example-without-html src:'<$transclude $variable=bold_slot>
<$fill $name=body>
"""
some text
using [[Hard Linebreaks in WikiText]]
syntax
"""
</$fill>
</$transclude>
'>>
</$let>
!! Depth
<$let table_slot="|!depth|!slot1|!slot2|
|1|<$slot $name=slot1/>|<$slot $name=slot2/>|
|2|<$slot $name=slot1 $depth=2>missing</$slot>|<$slot $name=slot2 $depth=2>missing</$slot>|
"
table_fill="""<$transclude $variable=table_slot $mode=block>
<$fill $name=slot1>outer1</$fill>
<$fill $name=slot2>outer2
<$transclude $variable=table_slot $mode=block>
<$fill $name=slot1>inner1</$fill>
<$fill $name=slot2>inner2</$fill>
</$transclude>
</$fill>
</$transclude>
""">
If a variable named <<.var table_slot>> contains the following <<.wlink SlotWidget>> definition:
<$codeblock code={{{[[table_slot]getvariable[]]}}}/>
then the slot values can be filled at different transclusion depths:
<$transclude $variable="wikitext-example-without-html" src=<<table_fill>>/>
The <<.var slot1>> slot is filled at both depths with a simple string (outer1 and outer2). For <<.var slot2>>, the outer instance is a simple string but the inner instance recursively transcludes the same <<.var table_slot>> variable again. The recursion ends at the third transclusion call since both "inner" slots are filled with simple strings.

View File

@ -1,6 +1,6 @@
caption: transclude caption: transclude
created: 20130824142500000 created: 20130824142500000
modified: 20230419103154329 modified: 20230511022612458
tags: Widgets tags: Widgets
title: TranscludeWidget title: TranscludeWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -51,6 +51,7 @@ Modern mode is recommended for use in new applications.
|$type | |Optional ContentType used when transcluding variables, indexes or fields other than the ''text'' field| |$type | |Optional ContentType used when transcluding variables, indexes or fields other than the ''text'' field|
|$output |- |ContentType for the output rendering (defaults to `text/html`, can also be `text/plain` or `text/raw`) | |$output |- |ContentType for the output rendering (defaults to `text/html`, can also be `text/plain` or `text/raw`) |
|$recursionMarker |recursionMarker |Set to ''no'' to prevent creation of [[Legacy Transclusion Recursion Marker]] (defaults to ''yes'') | |$recursionMarker |recursionMarker |Set to ''no'' to prevent creation of [[Legacy Transclusion Recursion Marker]] (defaults to ''yes'') |
|$fillignore |- |Set to ''yes'' to make this transclusion invisible to the <<.attr $depth>> attribute of the <<.wlink SlotWidget>> widget (defaults to ''no'') |
|//{attributes not starting with $}// | |Any other attributes that do not start with a dollar are used as parameters to the transclusion | |//{attributes not starting with $}// | |Any other attributes that do not start with a dollar are used as parameters to the transclusion |
|//{other attributes starting with $}// | |Other attributes starting with a single dollar sign are reserved for future use | |//{other attributes starting with $}// | |Other attributes starting with a single dollar sign are reserved for future use |
|//{attributes starting with $$}// | |Attributes starting with two dollar signs are used as parameters to the transclusion, but with the name changed to use a single dollar sign | |//{attributes starting with $$}// | |Attributes starting with two dollar signs are used as parameters to the transclusion, but with the name changed to use a single dollar sign |
@ -145,7 +146,7 @@ The output will be equivalent to:
</li> </li>
</ol> </ol>
``` ```
See <<.wlink SlotWidget>> for more examples.
! Missing Transclusion Targets ! Missing Transclusion Targets

View File

@ -529,3 +529,5 @@ HuanC Fu, @hffqyd, 2023/03/03
Michelle Saad, @michsa, 2023-03-08 Michelle Saad, @michsa, 2023-03-08
Yukai Chou, @muzimuzhi, 2023-04-07 Yukai Chou, @muzimuzhi, 2023-04-07
Carmine Guida, @carmineguida, 2023-05-17

View File

@ -22,7 +22,7 @@ title: $:/plugins/tiddlywiki/blog/templates/html-page/page
<body class="tc-body"> <body class="tc-body">
`{{$:/StaticBanner||$:/core/templates/html-tiddler}}` `{{$:/StaticBanner||$:/core/templates/html-tiddler}}`
<section class="tc-story-river"> <section class="tc-story-river">
`<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]"> `<$importvariables filter={{$:/core/config/GlobalImportFilter}}>
<$view tiddler="$:/plugins/tiddlywiki/blog/templates/tiddler" format="htmlwikified"/> <$view tiddler="$:/plugins/tiddlywiki/blog/templates/tiddler" format="htmlwikified"/>
</$importvariables>` </$importvariables>`
</section> </section>

View File

@ -22,7 +22,7 @@ title: $:/plugins/tiddlywiki/blog/templates/html-page/post
<body class="tc-body"> <body class="tc-body">
`{{$:/StaticBanner||$:/core/templates/html-tiddler}}` `{{$:/StaticBanner||$:/core/templates/html-tiddler}}`
<section class="tc-story-river"> <section class="tc-story-river">
`<$importvariables filter="[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]"> `<$importvariables filter={{$:/core/config/GlobalImportFilter}}>
<$view tiddler="$:/plugins/tiddlywiki/blog/templates/tiddler" format="htmlwikified"/> <$view tiddler="$:/plugins/tiddlywiki/blog/templates/tiddler" format="htmlwikified"/>
<$view tiddler="$:/plugins/tiddlywiki/blog/templates/menu" format="htmlwikified"/> <$view tiddler="$:/plugins/tiddlywiki/blog/templates/menu" format="htmlwikified"/>
</$importvariables>` </$importvariables>`

View File

@ -1,6 +1,6 @@
title: $:/plugins/tiddlywiki/tiddlyweb/save/offline title: $:/plugins/tiddlywiki/tiddlyweb/save/offline
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [subfilter{$:/core/config/GlobalImportFilter}]
\define saveTiddlerFilter() \define saveTiddlerFilter()
[is[tiddler]] -[[$:/boot/boot.css]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[prefix[$:/temp/]] +[sort[title]] $(publishFilter)$ [is[tiddler]] -[[$:/boot/boot.css]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[prefix[$:/temp/]] +[sort[title]] $(publishFilter)$
\end \end

View File

@ -0,0 +1,3 @@
title: $:/language/Import/
Upgrader/Plugins/Suppressed/Version: Your plugin will be upgraded from <<incoming>> to <<existing>>.

View File

@ -3118,6 +3118,30 @@ select {
background: <<colour select-tag-background>>; background: <<colour select-tag-background>>;
} }
/*
** Translink macro
*/
.tc-translink {
background-color: <<colour pre-background>>;
border: 1px solid <<colour pre-border>>;
padding: 0 3px;
border-radius: 3px;
}
div.tc-translink > div {
margin: 1em;
}
div.tc-translink > div > a:first-child > h1 {
font-size: 1.2em;
font-weight: bold;
}
span.tc-translink > a:first-child {
font-weight: bold;
}
/* /*
** Classes for displaying globals ** Classes for displaying globals
*/ */
@ -3299,4 +3323,4 @@ select {
.tc-tiny-v-gap-bottom { .tc-tiny-v-gap-bottom {
margin-bottom: 3px; margin-bottom: 3px;
} }