-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Dynamic parameters for macro/procedure/function calls #9055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jermolene
wants to merge
21
commits into
master
Choose a base branch
from
dynamic-macro-calls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+713
−80
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2d6b6b5
Initial commit
Jermolene f5d5a23
Test for standalone macro calls with dynamic parameters
Jermolene 48e6863
Parse attribute macros with the new parser
Jermolene 1ded43f
Test for attribute macros
Jermolene 744f6e7
Add some examples
Jermolene 5136e33
Tweak examples
Jermolene ad4c1ca
Merge branch 'master' into dynamic-macro-calls
Jermolene 205e8cf
Fix test
Jermolene b314430
Temporarily disable a broken serializer test
Jermolene 4305a0b
Fix/dynamic macro calls test (#9459)
linonetwo 30e6092
Fix unneeded diff
Jermolene 5d72fb0
Minor docs update
Jermolene 54ebf60
Merge branch 'master' into dynamic-macro-calls
Jermolene a2f38ef
Merge branch 'master' into dynamic-macro-calls
Jermolene cadddc1
Genuflecting to the linter
Jermolene 7ec985f
Remove debug logging
Jermolene 4729e15
Add change note
Jermolene ff352d6
Allow single closing square brackets within double square brackets qu…
Jermolene a29ae90
Only allow new style parameter values if the separator is an equals sign
Jermolene 8ebf052
On reflection, new style values should not be allowed for anonymous p…
Jermolene b6a9152
Docs updates
Jermolene File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
editions/test/tiddlers/tests/data/macros/dynamic-macros/Attribute.tid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| title: Macros/Dynamic/Attribute | ||
| description: Attribute macrocall with dynamic paramters | ||
| type: text/vnd.tiddlywiki-multiple | ||
| tags: [[$:/tags/wiki-test-spec]] | ||
|
|
||
| title: Output | ||
|
|
||
| \define mamacromamacro(param:"red") | ||
| It is $param$ | ||
| \end | ||
|
|
||
| <$text text=<<mamacromamacro>>/> | ||
| - | ||
| <$text text=<<mamacromamacro param={{{ [[a]addprefix[b]] }}}>>/> | ||
| - | ||
| <$text text=<<mamacromamacro param>>/> | ||
|
|
||
| + | ||
| title: ExpectedResult | ||
|
|
||
| <p>It is red | ||
| - | ||
| It is ba | ||
| - | ||
| It is param | ||
| </p> |
23 changes: 23 additions & 0 deletions
23
editions/test/tiddlers/tests/data/macros/dynamic-macros/Standalone.tid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| title: Macros/Dynamic/Standalone | ||
| description: Standalone macrocall with dynamic paramters | ||
| type: text/vnd.tiddlywiki-multiple | ||
| tags: [[$:/tags/wiki-test-spec]] | ||
|
|
||
| title: Output | ||
|
|
||
| \whitespace trim | ||
|
|
||
| \define mamacro(one:"red",two:"green") | ||
| It is $one$ and $two$ or <<__one__>> and <<__two__>>. | ||
| \end | ||
|
|
||
| <<mamacro>> | ||
|
|
||
| <<mamacro one={{{ [[b]addprefix[a]] }}}>> | ||
|
|
||
|
|
||
| <<mamacro one>> | ||
| + | ||
| title: ExpectedResult | ||
|
|
||
| <p>It is red and green or red and green.</p><p>It is ab and green or ab and green.</p><p>It is one and green or one and green.</p> |
9 changes: 9 additions & 0 deletions
9
editions/test/tiddlers/tests/data/serialize/DynamicMacroMixed.tid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| tags: $:/tags/wikitext-serialize-test-spec | ||
| title: Serialize/DynamicMacroMixed | ||
| type: text/vnd.tiddlywiki | ||
|
|
||
| <<mymacro static:"value" dynamic={{reference}} filter={{{ [tag[test]] }}}>> | ||
|
|
||
| <$macrocall $name="mymacro" static="value" dynamic=<<inner>>/> | ||
|
|
||
| <<mymacro `substituted $(var)$`>> |
9 changes: 9 additions & 0 deletions
9
editions/test/tiddlers/tests/data/serialize/DynamicMacroParams.tid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| tags: $:/tags/wikitext-serialize-test-spec | ||
| title: Serialize/DynamicMacroParams | ||
| type: text/vnd.tiddlywiki | ||
|
|
||
| <<mymacro param={{Something}}>> | ||
|
|
||
| <<mymacro param={{{ [<myvar>addprefix[https:]] }}}>> | ||
|
|
||
| <$macrocall $name="outermacro" inner=<<innermacro arg="value">>/> |
7 changes: 7 additions & 0 deletions
7
editions/test/tiddlers/tests/data/serialize/DynamicWidgetAttribute.tid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| tags: $:/tags/wikitext-serialize-test-spec | ||
| title: Serialize/DynamicWidgetAttribute | ||
| type: text/vnd.tiddlywiki | ||
|
|
||
| <div class=<<mymacro param={{Something}}>>>content</div> | ||
|
|
||
| <$button actions=<<myactions target={{!!title}}>>/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.