1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-01 22:09:57 +00:00

Macros -- Make "New in 5.3.0" Info More Prominent (#7750)

* Macros -- Make "New in 5.3.0" Info More Prominent

* Add links to new text substitution possibilities
This commit is contained in:
Mario Pietsch 2023-10-30 15:51:06 +01:00 committed by GitHub
parent e593f80278
commit 1001590326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -1,9 +1,15 @@
created: 20140211171341271 created: 20140211171341271
modified: 20230419103154328 modified: 20230922094937115
tags: Concepts Reference tags: Concepts Reference
title: Macros title: Macros
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
!! Important
<<.from-version "5.3.0">> Macros have been [[superseded|Macro Pitfalls]] by [[Procedures]], [[Functions]] and [[Custom Widgets]] which together provide more robust and flexible ways to encapsulate and re-use code.
For text substitutions it is now recommended to use: [[Substituted Attribute Values]], [[substitute Operator]] and [[Transclusion and Substitution]]
!! Introduction !! Introduction
A <<.def macro>> is a named snippet of text. They are typically defined with the [[Pragma: \define]]: A <<.def macro>> is a named snippet of text. They are typically defined with the [[Pragma: \define]]:
@ -26,8 +32,6 @@ The parameters that are specified in the macro call are substituted for special
* `$parameter-name$` is replaced with the value of the named parameter * `$parameter-name$` is replaced with the value of the named parameter
* `$(variable-name)$` is replaced with the value of the named [[variable|Variables]]). * `$(variable-name)$` is replaced with the value of the named [[variable|Variables]]).
<<.from-version "5.3.0">> Macros have been [[superseded|Macro Pitfalls]] by [[Procedures]], [[Custom Widgets]] and [[Functions]] which together provide more robust and flexible ways to encapsulate and re-use code. It is now recommended to only use macros when textual substitution is specifically required.
!! How Macros Work !! How Macros Work
Macros are implemented as a special kind of [[variable|Variables]]. The only thing that distinguishes them from ordinary variables is the way that the parameters are handled. Macros are implemented as a special kind of [[variable|Variables]]. The only thing that distinguishes them from ordinary variables is the way that the parameters are handled.

View File

@ -5,4 +5,4 @@ type: text/vnd.tiddlywiki
The following [[macros|Macros]] are built into ~TiddlyWiki's core: The following [[macros|Macros]] are built into ~TiddlyWiki's core:
<<list-links "[tag[Core Macros]]">> <<list-links "[tag[Core Macros]]" class:"multi-columns">>

View File

@ -1,5 +1,5 @@
created: 20141018090608643 created: 20141018090608643
modified: 20230419103154329 modified: 20231030124224424
tags: WikiText tags: WikiText
title: Transclusion and Substitution title: Transclusion and Substitution
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -55,6 +55,6 @@ As described in [[Introduction to filter notation]], you can also transclude a v
! Textual Substitution ! Textual Substitution
Textual substitution occurs when the value of a macro/variable is used. It is described in [[Macros]]. Textual substitution occurs when the value of a macro/variable is used. It is described in [[Substituted Attribute Values]] and [[substitute Operator]]
The key difference between substitution and transclusion is that substitution occurs before WikiText parsing. This means that you can use substitution to build WikiText constructions. Transclusions are processed independently, and cannot be combined with adjacent text to define WikiText constructions. The key difference between substitution and transclusion is that substitution occurs before WikiText parsing. This means that you can use substitution to build ~WikiText constructions. Transclusions are processed independently, and cannot be combined with adjacent text to define ~WikiText constructions.