diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index 5a30c2986..00cb3c99c 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -40,10 +40,6 @@ Error/RetrievingSkinny: Error retrieving skinny tiddler list Error/SavingToTWEdit: Error saving to TWEdit Error/WhileSaving: Error while saving Error/XMLHttpRequest: XMLHttpRequest error code -Globals/Caption: Global <>: ''<>'' -Globals/ListItem: ''<>'' (<>) -Globals/Parameters/Caption: Parameters: -Globals/Text/Caption: Text: InternalJavaScriptError/Title: Internal JavaScript Error InternalJavaScriptError/Hint: Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser LayoutSwitcher/Description: Open the layout switcher diff --git a/core/language/en-GB/SideBar.multids b/core/language/en-GB/SideBar.multids index 5c46555c9..c4fda9c81 100644 --- a/core/language/en-GB/SideBar.multids +++ b/core/language/en-GB/SideBar.multids @@ -5,7 +5,6 @@ All/Caption: All Contents/Caption: Contents Drafts/Caption: Drafts Explorer/Caption: Explorer -Globals/Caption: Globals Missing/Caption: Missing More/Caption: More Open/Caption: Open diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index 684032eae..662665202 100755 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -386,7 +386,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ TranscludeWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(($tw.utils.count(changedAttributes) > 0) || (this.transcludeTitle && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh()) || (this.transcludeVariable && changedTiddlers["$:/global/" + this.transcludeVariable])) { + if(($tw.utils.count(changedAttributes) > 0) || (this.transcludeTitle && changedTiddlers[this.transcludeTitle] && this.parserNeedsRefresh())) { this.refreshSelf(); return true; } else { diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 966d6be3e..f85764132 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -155,20 +155,6 @@ Widget.prototype.getVariableInfo = function(name,options) { } // If the variable doesn't exist in the parent widget then look for a macro module var text = this.evaluateMacroModule(name,actualParams); - if(text === undefined) { - // Check for a shadow variable tiddler - var tiddler = this.wiki.getTiddler("$:/global/" + name); - if(tiddler) { - return processVariable({ - value: tiddler.getFieldString("text"), - params: $tw.utils.parseParameterDefinition(tiddler.getFieldString("_parameters"),{requireParenthesis: true}), - isMacroDefinition: tiddler.getFieldString("_is_macro") === "yes", - isWidgetDefinition: tiddler.getFieldString("_is_widget") === "yes", - isProcedureDefinition: tiddler.getFieldString("_is_procedure") === "yes", - isFunctionDefinition: tiddler.getFieldString("_is_function") === "yes" - }); - } - } if(text === undefined) { text = options.defaultValue; } diff --git a/core/ui/MoreSideBar/Globals.tid b/core/ui/MoreSideBar/Globals.tid deleted file mode 100644 index b621e7e04..000000000 --- a/core/ui/MoreSideBar/Globals.tid +++ /dev/null @@ -1,16 +0,0 @@ -title: $:/core/ui/MoreSideBar/Globals -tags: $:/tags/MoreSideBar -caption: {{$:/language/SideBar/Globals/Caption}} - -<$list filter="[all[tiddlers+shadows]prefix[$:/global/]sort[]]"> -
-<$link> -<$let - name={{{ [removeprefix[$:/global/]] }}} - type={{{ [{!!_is_macro}match[yes]then[macro]] :else[{!!_is_function}match[yes]then[function]] :else[{!!_is_procedure}match[yes]then[procedure]] :else[{!!_is_widget}match[yes]then[widget]] :else[[variable]] }}} -> -{{$:/language/Globals/ListItem}} - - -
- diff --git a/core/ui/ViewTemplate/body/global.tid b/core/ui/ViewTemplate/body/global.tid deleted file mode 100644 index bd9d0a001..000000000 --- a/core/ui/ViewTemplate/body/global.tid +++ /dev/null @@ -1,26 +0,0 @@ -title: $:/core/ui/ViewTemplate/body/global - -\whitespace trim - -\procedure display-global() -
-
-

- <$let - name={{{ [removeprefix[$:/global/]] }}} - type={{{ [{!!_is_macro}match[yes]then[macro]] :else[{!!_is_function}match[yes]then[function]] :else[{!!_is_procedure}match[yes]then[procedure]] :else[{!!_is_widget}match[yes]then[widget]] :else[[variable]] }}} - > - {{$:/language/Globals/Caption}} - -

- <$list filter="[has[_parameters]]" variable="ignore"> - {{$:/language/Globals/Parameters/Caption}} -
<$text text={{!!_parameters}}/>
- -
- {{$:/language/Globals/Text/Caption}} - <$transclude tiddler="$:/core/ui/ViewTemplate/body/code"/> -
-\end - -<$transclude $variable="display-global" $mode="inline"/> diff --git a/core/ui/ViewTemplate/title/global.tid b/core/ui/ViewTemplate/title/global.tid deleted file mode 100644 index d1efaf89b..000000000 --- a/core/ui/ViewTemplate/title/global.tid +++ /dev/null @@ -1,6 +0,0 @@ -title: $:/core/ui/ViewTemplate/title/global - -\whitespace trim -

-$:/global/<$text text={{{ [removeprefix[$:/global/]] }}}/> -

\ No newline at end of file diff --git a/core/wiki/config/ViewTemplateBodyFilters.multids b/core/wiki/config/ViewTemplateBodyFilters.multids index 83d0cd3da..6348cc036 100644 --- a/core/wiki/config/ViewTemplateBodyFilters.multids +++ b/core/wiki/config/ViewTemplateBodyFilters.multids @@ -1,7 +1,6 @@ title: $:/config/ViewTemplateBodyFilters/ tags: $:/tags/ViewTemplateBodyFilter -global: [prefix[$:/global/]then[$:/core/ui/ViewTemplate/body/global]] stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]] system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/core/ui/]split[/]count[]compare:number:eq[4]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/info/]] [prefix[$:/temp/]] +[!is[image]limit[1]then[$:/core/ui/ViewTemplate/body/code]] code-body: [field:code-body[yes]then[$:/core/ui/ViewTemplate/body/code]] diff --git a/core/wiki/config/ViewTemplateTitleFilters.multids b/core/wiki/config/ViewTemplateTitleFilters.multids index 50f64f5a5..938211311 100644 --- a/core/wiki/config/ViewTemplateTitleFilters.multids +++ b/core/wiki/config/ViewTemplateTitleFilters.multids @@ -1,6 +1,5 @@ title: $:/config/ViewTemplateTitleFilters/ tags: $:/tags/ViewTemplateTitleFilter -global: [prefix[$:/global/]then[$:/core/ui/ViewTemplate/title/global]] system: [prefix[$:/]then[$:/core/ui/ViewTemplate/title/system]] default: [[$:/core/ui/ViewTemplate/title/default]] diff --git a/core/wiki/macros/tabs.tid b/core/wiki/macros/tabs.tid index 7181a4bb2..bc8a0255f 100644 --- a/core/wiki/macros/tabs.tid +++ b/core/wiki/macros/tabs.tid @@ -1,9 +1,8 @@ -title: $:/global/tabs +title: $:/core/macros/tabs +tags: $:/tags/Macro code-body: yes -_parameters: (tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState) -_is_macro: yes -\?define tabs-button() +\define tabs-button() \whitespace trim <$button set=<> setTo=<> default=<<__default__>> selectedClass="tc-tab-selected" tooltip={{!!tooltip}} role="switch"> <$tiddler tiddler=<>> @@ -19,7 +18,7 @@ _is_macro: yes \end -\?define tabs-tab() +\define tabs-tab() \whitespace trim <$set name="save-currentTiddler" value=<>> <$tiddler tiddler=<>> @@ -28,14 +27,14 @@ _is_macro: yes \end -\?define tabs-tab-list() +\define tabs-tab-list() \whitespace trim <$list filter=<<__tabsList__>> variable="currentTab" storyview="pop"> <> \end -\?define tabs-tab-body() +\define tabs-tab-body() \whitespace trim <$list filter=<<__tabsList__>> variable="currentTab"> <$reveal type="match" state=<> text=<> default=<<__default__>> retain=<<__retain__>> tag="div"> @@ -46,6 +45,7 @@ _is_macro: yes \end +\define tabs(tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState) \whitespace trim <$qualify title=<<__state__>> name="qualifiedState"> <$let tabsState={{{ [<__explicitState__>minlength[1]] ~[] }}}> @@ -60,3 +60,4 @@ _is_macro: yes +\end \ No newline at end of file diff --git a/core/wiki/tags/MoreSideBar.tid b/core/wiki/tags/MoreSideBar.tid index 215a7f37f..f3371ef4b 100644 --- a/core/wiki/tags/MoreSideBar.tid +++ b/core/wiki/tags/MoreSideBar.tid @@ -1,3 +1,3 @@ title: $:/tags/MoreSideBar -list: [[$:/core/ui/MoreSideBar/All]] [[$:/core/ui/MoreSideBar/Recent]] [[$:/core/ui/MoreSideBar/Tags]] [[$:/core/ui/MoreSideBar/Missing]] [[$:/core/ui/MoreSideBar/Drafts]] [[$:/core/ui/MoreSideBar/Orphans]] [[$:/core/ui/MoreSideBar/Types]] [[$:/core/ui/MoreSideBar/System]] [[$:/core/ui/MoreSideBar/Shadows]] [[$:/core/ui/MoreSideBar/Explorer]] [[$:/core/ui/MoreSideBar/Globals]] [[$:/core/ui/MoreSideBar/Plugins]] +list: [[$:/core/ui/MoreSideBar/All]] [[$:/core/ui/MoreSideBar/Recent]] [[$:/core/ui/MoreSideBar/Tags]] [[$:/core/ui/MoreSideBar/Missing]] [[$:/core/ui/MoreSideBar/Drafts]] [[$:/core/ui/MoreSideBar/Orphans]] [[$:/core/ui/MoreSideBar/Types]] [[$:/core/ui/MoreSideBar/System]] [[$:/core/ui/MoreSideBar/Shadows]] [[$:/core/ui/MoreSideBar/Explorer]] [[$:/core/ui/MoreSideBar/Plugins]] diff --git a/core/wiki/tags/ViewTemplateBodyFilter.tid b/core/wiki/tags/ViewTemplateBodyFilter.tid index 3211e15ee..ab7ff262a 100644 --- a/core/wiki/tags/ViewTemplateBodyFilter.tid +++ b/core/wiki/tags/ViewTemplateBodyFilter.tid @@ -1,3 +1,3 @@ title: $:/tags/ViewTemplateBodyFilter -list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/global $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default +list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default diff --git a/core/wiki/tags/ViewTemplateTitleFilter.tid b/core/wiki/tags/ViewTemplateTitleFilter.tid index b27b3aed0..24f3fb580 100644 --- a/core/wiki/tags/ViewTemplateTitleFilter.tid +++ b/core/wiki/tags/ViewTemplateTitleFilter.tid @@ -1,3 +1,3 @@ title: $:/tags/ViewTemplateTitleFilter -list: $:/config/ViewTemplateTitleFilters/global $:/config/ViewTemplateTitleFilters/system $:/config/ViewTemplateTitleFilters/default +list: $:/config/ViewTemplateTitleFilters/system $:/config/ViewTemplateTitleFilters/default diff --git a/editions/test/tiddlers/tests/data/globals/CustomWidget.tid b/editions/test/tiddlers/tests/data/globals/CustomWidget.tid deleted file mode 100644 index 98ee4e5d7..000000000 --- a/editions/test/tiddlers/tests/data/globals/CustomWidget.tid +++ /dev/null @@ -1,22 +0,0 @@ -title: Globals/CustomWidget -description: Global shadow variable defining a custom widget -type: text/vnd.tiddlywiki-multiple -tags: [[$:/tags/wiki-test-spec]] - -title: Output - -\whitespace trim - -<$$mywidget foo="Mahogany"> -Sycamore! - -+ -title: $:/global/$$mywidget -_is_widget: yes -_parameters: (foo:"bar") - -Koala! <$text text=<>/>, <$slot $name="ts-raw"/> -+ -title: ExpectedResult - -

Koala! Mahogany, Sycamore!

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/globals/CustomWidgetAlt.tid b/editions/test/tiddlers/tests/data/globals/CustomWidgetAlt.tid deleted file mode 100644 index dbd3e75ae..000000000 --- a/editions/test/tiddlers/tests/data/globals/CustomWidgetAlt.tid +++ /dev/null @@ -1,23 +0,0 @@ -title: Globals/CustomWidgetAlt -description: Global shadow variable defining a custom widget, without using a _parameters field -type: text/vnd.tiddlywiki-multiple -tags: [[$:/tags/wiki-test-spec]] - -title: Output - -\whitespace trim - -<$$mywidget foo="Mahogany"> -Sycamore! - -+ -title: $:/global/$$mywidget -_is_widget: yes - -\parameters (foo:"bar") - -Koala! <$text text=<>/>, <$slot $name="ts-raw"/> -+ -title: ExpectedResult - -

Koala! Mahogany, Sycamore!

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/globals/Functions.tid b/editions/test/tiddlers/tests/data/globals/Functions.tid deleted file mode 100644 index 331e8cc6e..000000000 --- a/editions/test/tiddlers/tests/data/globals/Functions.tid +++ /dev/null @@ -1,22 +0,0 @@ -title: Globals/Functions -description: Global functions in shadow variables -type: text/vnd.tiddlywiki-multiple -tags: [[$:/tags/wiki-test-spec]] - -title: Output - -\whitespace trim - -<$text text=<>/> -| -<$text text=<>/> -+ -title: $:/global/this-is-one -_is_function: yes -_parameters: (foo:"2") - -[multiply[2.5]] -+ -title: ExpectedResult - -

5|17.5

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/globals/Procedures.tid b/editions/test/tiddlers/tests/data/globals/Procedures.tid deleted file mode 100644 index b20ad396b..000000000 --- a/editions/test/tiddlers/tests/data/globals/Procedures.tid +++ /dev/null @@ -1,27 +0,0 @@ -title: Globals/Procedures -description: Global procedures in shadow variables -type: text/vnd.tiddlywiki-multiple -tags: [[$:/tags/wiki-test-spec]] - -title: Output - -\whitespace trim - -<> -| -<> -+ -title: $:/global/this-is-one - -\whitespace trim - -\procedure example() -ONE -\end - -\parameters (foo:"nothing") -<>-<$text text=<>/> -+ -title: ExpectedResult - -

ONE-nothing

|ONE-blah

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/globals/ProceduresWithConditionalDefinitions.tid b/editions/test/tiddlers/tests/data/globals/ProceduresWithConditionalDefinitions.tid deleted file mode 100644 index 8e6da42c6..000000000 --- a/editions/test/tiddlers/tests/data/globals/ProceduresWithConditionalDefinitions.tid +++ /dev/null @@ -1,26 +0,0 @@ -title: Globals/ProceduresWithConditionalDefinitions -description: Global procedures with conditional definitions to allow overriding -type: text/vnd.tiddlywiki-multiple -tags: [[$:/tags/wiki-test-spec]] - -title: Output - -\whitespace trim - -<>|<>~ -<$let example="TWO"><>|<> -+ -title: $:/global/this-is-one - -\whitespace trim - -\?procedure example() -ONE -\end - -\parameters (foo:"nothing") -<>-<$text text=<>/> -+ -title: ExpectedResult - -

ONE-nothing|ONE-blah~TWO-nothing|TWO-blah

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/globals/Refresh.tid b/editions/test/tiddlers/tests/data/globals/Refresh.tid deleted file mode 100644 index 8f9e90b01..000000000 --- a/editions/test/tiddlers/tests/data/globals/Refresh.tid +++ /dev/null @@ -1,31 +0,0 @@ -title: Globals/Refresh -description: Refreshing global procedures in shadow variables -type: text/vnd.tiddlywiki-multiple -tags: [[$:/tags/wiki-test-spec]] - -title: Output - -\whitespace trim - -<> -| -<> -+ -title: $:/global/this-is-one - -\whitespace trim - -\procedure example() -ONE -\end - -\parameters (foo:"nothing") -<>-<$text text=<>/> -+ -title: Actions - -<$action-setfield $tiddler="$:/global/this-is-one" $value="Jackdaw"/> -+ -title: ExpectedResult - -

Jackdaw

|Jackdaw

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/variables/Global Definitions.tid b/editions/tw5.com/tiddlers/variables/Global Definitions.tid deleted file mode 100644 index 32e028e79..000000000 --- a/editions/tw5.com/tiddlers/variables/Global Definitions.tid +++ /dev/null @@ -1,65 +0,0 @@ -title: Global Definitions -created: 20220909111836951 -modified: 20220909111836951 -tags: Concepts Reference Variables - -!! Introduction - -<<.from-version "5.3.0">> Globals are [[variables|Variables]] that are available everywhere, without needing a [[<$set>|SetWidget]], [[<$vars>|SetWidget]] or [[<$let>|SetWidget]] widget. - -!! Defining Globals - -Previously, definitions of procedures, widgets, functions and macros were made available globally by tagging them with `$:/tags/Macro`. While this mechanism is still supported, it suffers from several disadvantages and so is not recommended for new applications. The new way to define global procedures, widgets, functions and macros is to place them in tiddlers titled with the name of the global prefixed with `$:/global/`. - -For example, the global variable `foo` would be defined in a tiddler called `$:/global/foo`. Accessing the variable `<>` then acts as a shortcut for accessing the underlying global variable tiddler. - -!! Special Fields - -The following special fields are used to define the behaviour of the global: - -* `_parameters` defines the parameters expected by procedures, widgets and functions -* `_is_procedure`, `_is_widget`, `_is_function`, `_is_macro`: any one of these fields may be set to `yes` to indicate the type of the definition - -<<.note """The `_parameters` field is only strictly necessary for functions and macros. Procedures and widgets can instead choose to use the <<.wlink ParametersWidget>> widget (or a pragma) within the body of the definition""">> - -!! Viewing Globals - -The current global definitions are listed in the sidebar in the "More" -> "Globals" tab. - -By default, global definition tiddlers are displayed with a custom template that makes it easier to see the full definition. - -!! Local Variables within Globals - -Note that global definitions can include local variables that are defined before the body of the global. These local variables will not be visible externally. - -For example: - -``` -title: $:/globals/foo -_is_procedure: yes -_parameters: (param1:"value",param2:"value") - -\procedure renderTitle(title) -
<$text text=<>/></div> -\end - -\function myfn(a) -[[a]getvariable[]addprefix[!]] -\end - -<$list filter=<<param1>>> - -<<renderTitle "first">>: <$text text=<<param2>>/> - -<<renderTitle "second">>: <$text text=<<myfn param2>>/> - -</$list> -``` - -It is possible to allow the caller to override these local definitions by using the new syntax for conditional definitions. For example, here we only define the function `myfn` if the variable `myfn` is not already defined: - -``` -\?function myfn(a) -[[a]getvariable[]addprefix[!]] -\end -``` diff --git a/editions/tw5.com/tiddlers/variables/Variables.tid b/editions/tw5.com/tiddlers/variables/Variables.tid index 6fccb46b0..06fd78a80 100644 --- a/editions/tw5.com/tiddlers/variables/Variables.tid +++ b/editions/tw5.com/tiddlers/variables/Variables.tid @@ -10,8 +10,6 @@ A new variable is defined using a <<.wlink SetWidget>> widget, and is then avail The <<.wlink ListWidget>> widget also sets a particular variable (<<.var currentTiddler>> by default) to each listed title in turn. -Variables can also be defined as [[Global Definitions]]. - For an overview of how to use variables, see [[Variables in WikiText]]. Despite the term <<.word variable>>, each snippet is a constant string. The apparent variability is actually the result of the presence of multiple variables with the same name in different parts of the widget tree. diff --git a/editions/tw5.com/tiddlers/widgets/ParametersWidget.tid b/editions/tw5.com/tiddlers/widgets/ParametersWidget.tid index a178f04bb..54a1d138d 100644 --- a/editions/tw5.com/tiddlers/widgets/ParametersWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ParametersWidget.tid @@ -12,7 +12,6 @@ There are shortcuts for common scenarios that can often make it unnecessary to u * the [[Pragma: \parameters]] * the [[Pragma: \procedure]] for declaring procedure * the [[Pragma: \widget]] for declaring custom widgets -* the `_parameters` field of tiddlers containing [[Global Definitions]] The <<.wlink ParametersWidget>> widget must be used directly in the following situations: diff --git a/editions/tw5.com/tiddlers/wikitext/Macro Definitions.tid b/editions/tw5.com/tiddlers/wikitext/Macro Definitions.tid index 31bc006a8..095d08e7a 100644 --- a/editions/tw5.com/tiddlers/wikitext/Macro Definitions.tid +++ b/editions/tw5.com/tiddlers/wikitext/Macro Definitions.tid @@ -35,13 +35,9 @@ Macros are implemented as a special type of [[variable|Variables]] and so intern The [[Pragma: \import]] or <<.wlink ImportVariablesWidget>> widget can be used to copy macro definitions from another tiddler. -!! Global Macro Definitions - -Macros can be made available globally by placing them in a tiddler titled with the name of the global prefixed with `$:/global/`. See [[Global Definitions]] for details. - !! `$:/tags/Macro` Tag -For backwards compatibility, global macros can also be defined using the [[SystemTag: $:/tags/Macro]]. The new [[Global Definitions]] mechanism is [[preferred|Macro Pitfalls]] for new applications. +Global macros can be defined using the [[SystemTag: $:/tags/Macro]]. The tag [[SystemTag: $:/tags/Macro/View]] is used to define macros that should only be available within the main view template and the preview panel.