mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-07 02:26:19 +00:00
f636349007
The basic idea is that if we don't find a variable `foo` then we fallback to retrieving the value from the tiddler `$:/global/foo`, if it exists. This allows us to replace the usual importvariables-based mechanism for global definitions, avoiding cluttering up the variable namespace with every macro. In order to permit subprocedures to be overridden, we also introduce a mechanism for conditional definitions: preceding the word definition|procedure|function|widget with a + causes the definition only to occur if the specified variable doesn't already exist. In the next commit we'll apply this mechanism to the tabs macro
27 lines
420 B
Plaintext
27 lines
420 B
Plaintext
title: Globals/Procedures
|
|
description: Global procedures in shadow variables
|
|
type: text/vnd.tiddlywiki-multiple
|
|
tags: [[$:/tags/wiki-test-spec]]
|
|
|
|
title: Output
|
|
|
|
\whitespace trim
|
|
|
|
<<this-is-one>>
|
|
|
|
|
<<this-is-one blah>>
|
|
+
|
|
title: $:/global/this-is-one
|
|
|
|
\whitespace trim
|
|
|
|
\procedure example()
|
|
ONE
|
|
\end
|
|
|
|
\parameters (foo:"nothing")
|
|
<<example>>-<$text text=<<foo>>/>
|
|
+
|
|
title: ExpectedResult
|
|
|
|
<p>ONE-nothing</p><p>|ONE-blah</p> |