1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-06 20:14:22 +00:00

Merge branch 'master' into geospatial-plugin

This commit is contained in:
jeremy@jermolene.com 2022-12-08 08:29:48 +00:00
commit 54a44516a7
5 changed files with 42 additions and 22 deletions

View File

@ -4,5 +4,7 @@ title: $:/core/save/all-external-js
\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)$
\end
\define coreURL() %24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js
{{$:/core/templates/tiddlywiki5-external-js.html}}
\define defaultCoreURL() %24%3A%2Fcore%2Ftemplates%2Ftiddlywiki5.js
<$let coreURL={{{ [[coreURL]is[variable]then<coreURL>else<defaultCoreURL>] }}}>
{{$:/core/templates/tiddlywiki5-external-js.html}}
</$let>

View File

@ -4,5 +4,7 @@ title: $:/core/save/offline-external-js
\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)$
\end
\define coreURL() tiddlywikicore-$(version)$.js
{{$:/core/templates/tiddlywiki5-external-js.html}}
\define defaultCoreURL() tiddlywikicore-$(version)$.js
<$let coreURL={{{ [[coreURL]is[variable]then<coreURL>else<defaultCoreURL>] }}}>
{{$:/core/templates/tiddlywiki5-external-js.html}}
</$let>

View File

@ -1,6 +1,6 @@
caption: Macro Definitions
created: 20150220181617000
modified: 20221022135909352
modified: 20221207094236472
tags: WikiText
title: Macro Definitions in WikiText
type: text/vnd.tiddlywiki
@ -19,22 +19,6 @@ Alternatively, the entire definition can be presented on a single line without a
\define sayhi(name:"Bugs Bunny") Hi, I'm $name$.
```
Macro definitions can be nested by specifying the name of the macro in the `\end` marker. For example:
<<wikitext-example-without-html src:"""\define special-button(caption:"Click me")
\define actions()
<$action-sendmessage $message="tm-notify" $param="HelloThere"/>
\end actions
<$button actions=<<actions>>>
$caption$
</$button>
\end special-button
<<special-button>>
""">>
A more formal [[presentation|Macro Definition Syntax]] of this syntax is also available.
!! Accessing variables and parameters
Inside the macro there are several methods for accessing variables defined outside of the macro or parameters from the macro parameter list.
@ -93,3 +77,26 @@ To make a macro available to all tiddlers, define it in a tiddler that has the t
It is also possible to write a macro as a [[JavaScript module|https://tiddlywiki.com/dev/index.html#JavaScript%20Macros]]. ~JavaScript macros are available to all tiddlers, and offer the maximum flexibility.
A tiddler can manually import macro definitions from a [[selection|Title Selection]] of other tiddlers by using the <<.wlink ImportVariablesWidget>> widget.
!! Nested Macro Definitions
Macro definitions can be nested to any number of required levels by specifying the name of the macro in the `\end` marker. Nested macro definitions must appear at the start of the definition that contains them. For example:
<<wikitext-example-without-html src:"""\define special-button(caption:"Click me")
\define actions()
<$action-sendmessage $message="tm-notify" $param="HelloThere"/>
\end actions
<$button actions=<<actions>>>
$caption$
</$button>
\end special-button
<<special-button>>
""">>
Note that the textual substitution of macro parameters that occurs when the outer macro is rendered will apply to the nested definitions as well. That generally means that textual substitution of macro parameters should not be used within nested macros.
Parameters of nested macros can also be accessed via the `<<__variablename__>>` syntax. As ordinary variables, these parameters are available within nested child macros (and grandchildren etc).
A more formal [[presentation|Macro Definition Syntax]] of this syntax is also available.

View File

@ -332,7 +332,7 @@ DynannotateWidget.prototype.applySnippets = function() {
// Output the match
container.appendChild($tw.utils.domMaker("span",{
text: textMap.string.slice(match.startPos,match.endPos),
"class": "tc-dynannotate-snippet-highlight " + self.getAttribute("searchClass")
"class": "tc-dynannotate-snippet-highlight " + self.getAttribute("searchClass","")
}));
// Does the context of this match merge into the next?
merged = index < matches.length - 1 && matches[index + 1].startPos - match.endPos <= 2 * contextLength;

View File

@ -1999,6 +1999,15 @@ html body.tc-body.tc-single-tiddler-window {
margin: auto;
}
/* Make search dropdown visible on small screens. issue #7003 */
@media (max-width: <<sidebarbreakpoint>>) {
.tc-sidebar-search .tc-block-dropdown-wrapper {
position: initial;
}
}
/*
** Modals
*/