mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-02-20 17:09:52 +00:00
Compare commits
7 Commits
yet-more-m
...
further-re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfaa8f30bd | ||
|
|
48626ceded | ||
|
|
6f31d3e7d6 | ||
|
|
9d53e9b875 | ||
|
|
5e37367aa4 | ||
|
|
2db71cd14f | ||
|
|
037ad2d0da |
@@ -1,5 +1,5 @@
|
||||
title: $:/changenotes/5.4.0/#8258
|
||||
description: Add ability to serialize WikiText AST nodes back to wikitext strings
|
||||
description: Core plugin to serialize syntax trees back to strings
|
||||
tags: $:/tags/ChangeNote
|
||||
release: 5.4.0
|
||||
change-type: feature
|
||||
@@ -7,32 +7,8 @@ change-category: developer
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/8258
|
||||
github-contributors: linonetwo
|
||||
|
||||
This PR introduces a new utility `$tw.utils.serializeWikitextParseTree()` that can convert WikiText Abstract Syntax Tree (AST) nodes back into wikitext strings.
|
||||
This is an internal change that will only be of direct interest to plugin developers but will form the basis of future user-facing features. For example:
|
||||
|
||||
There is also a utility `serializeAttribute` for a single attribute node, like an attribute of a widget.
|
||||
|
||||
!! Use Cases
|
||||
|
||||
* Programmatically manipulating wikitext content by modifying the AST, and use this to write it back
|
||||
* Programmatically manipulating wikitext content by modifying the syntax tree and deserializing it back to wikitext
|
||||
* Building WYSIWYG editors
|
||||
* Creating wikitext formatters and linters
|
||||
|
||||
!! Implementation
|
||||
|
||||
* New core plugin `tiddlywiki/wikitext-serialize` containing most of the logic
|
||||
* Separate serialize handlers for each WikiText rule as `module-type: wikiruleserializer`
|
||||
* Test suite with tag `$:/tags/wikitext-serialize-test-spec`
|
||||
* It uses each parser's name as rule (`nextMatch.rule.name`), each AST node that needs serialization has a `type` property matching the rule name
|
||||
** HTML tags and widgets are handled by the `html` serializer
|
||||
|
||||
!! Example Usage
|
||||
|
||||
```javascript
|
||||
// Parse a tiddler's wikitext to AST
|
||||
var parseTree = $tw.wiki.parseTiddler("MyTiddler").tree;
|
||||
|
||||
// Serialize AST back to wikitext string
|
||||
var wikitextString = $tw.utils.serializeWikitextParseTree(parseTree).trimEnd();
|
||||
```
|
||||
|
||||
This feature offers new tools for JS plugin developers. It is not a user-facing change.
|
||||
* Creating WikiText formatters and linters
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
title: $:/changenotes/5.4.0/#8702/impacts/darkmode-info-tiddler
|
||||
changenote: $:/changenotes/5.4.0/#8702
|
||||
created: 20250901000000000
|
||||
modified: 20250901000000000
|
||||
tags: $:/tags/ImpactNote
|
||||
description: `$:/info/darkmode` has been superseded by `$:/info/browser/darkmode`
|
||||
impact-type: deprecation
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
title: $:/changenotes/5.4.0/#8702/impacts/palette-pluginisation
|
||||
changenote: $:/changenotes/5.4.0/#8702
|
||||
created: 20250901000000000
|
||||
modified: 20250901000000000
|
||||
tags: $:/tags/ImpactNote
|
||||
description: Existing colour palettes have been moved to a new "palettes-legacy" plugin
|
||||
impact-type: pluginisation
|
||||
|
||||
Add the plugin to your wiki in order to continue using the legacy palettes.
|
||||
@@ -1,27 +0,0 @@
|
||||
title: $:/changenotes/5.4.0/#8702
|
||||
description: Colour handling improvements
|
||||
release: 5.4.0-disabled because this PR is not yet merged
|
||||
tags: $:/tags/ChangeNote
|
||||
change-type: enhancement
|
||||
change-category: hackability
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/8702
|
||||
github-contributors: Jermolene
|
||||
|
||||
This PR brings several new features for end users:
|
||||
|
||||
* Automatically switching between a dark and light palette as the operating system setting changes (and to do so without making the wiki dirty)
|
||||
* Customisation options for palettes. For example, users might choose a base hue, with the colours of the palette automatically adapting to it
|
||||
* A generalisation of the dark vs. light mechanism to allow an arbitrary number of distinct schemes that are dynamically selected. For example, a palette that has a different scheme for night, morning, day and evening that automatically change with the time of day
|
||||
|
||||
There are also new capabilities for palette authors:
|
||||
|
||||
* Inheritance for palettes, making it easy to create chains of variants of a base palette
|
||||
* Self contained palettes that can contain both dark and light variants (or variants for any other custom scheme)
|
||||
|
||||
To make all of these new features possible, this PR also includes some useful new general purpose mechanisms and features:
|
||||
|
||||
* Background actions that are triggered whenever there is a change to the results of a specified filter
|
||||
* Several new filter operators for manipulating colour values. The underlying functionality comes from the [[color.js|https://colorjs.io/]] library
|
||||
* New media query tracking mechanism that can track the results of any CSS media query (not just dark mode), storing the results in a shadow `$:/info/...` tiddler
|
||||
* New `changecount` filter operator
|
||||
* New `:apply` filter run prefix (to be replaced by the `:let` filter run prefix in [[#8972|https://github.com/TiddlyWiki/TiddlyWiki5/pull/8972]]))
|
||||
@@ -7,36 +7,19 @@ change-category: hackability
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9055
|
||||
github-contributors: Jermolene
|
||||
|
||||
This PR extends the handling of macro/procedure/function made via the `<<..>>` syntax to allow parameters to be specified dynamically instead of just as static strings. To indicate the new syntax the colon that usually separates a parameter name from its value is replaced by an equals sign.
|
||||
|
||||
For example, by it is now possible to do things like this:
|
||||
This PR extends the handling of macro/procedure/function invocationsmade via the `<<..>>` shortcut syntax to allow dynamic parameters instead of just static strings. To indicate the new syntax the colon that usually separates a parameter name from its value is replaced by an equals sign. For example:
|
||||
|
||||
```
|
||||
<<mymacro param={{Something}}>>
|
||||
```
|
||||
|
||||
Or even this:
|
||||
|
||||
```
|
||||
<div class=<<mymacro param={{Something}}>>>
|
||||
```
|
||||
|
||||
Or this:
|
||||
|
||||
```
|
||||
<div class=<<mymacro param={{{ [<myvar>addprefix[https:] }}}>>>
|
||||
```
|
||||
|
||||
Parameters can also be specified for the inner call:
|
||||
|
||||
```
|
||||
<div class=<<mymacro param={{{ [<innermacro p={{Something}}>addprefix[https:] }}}>>>
|
||||
```
|
||||
|
||||
The extended syntax can be used in three different settings:
|
||||
The extended syntax allows parameter values to be passed as transclusions, filter expressions or nested invocations in three settings:
|
||||
|
||||
* As a standalone construction
|
||||
* As a widget attribute value
|
||||
* As a filter operand value
|
||||
|
||||
In all cases, it is now possible to use an equals sign instead of a colon to allow parameter values to be passed as a transclusion, filter expression or nested call.
|
||||
See [[Calls]] for more details and examples.
|
||||
|
||||
@@ -3,7 +3,7 @@ description: Set modal's mask-closable attribute to yes by default
|
||||
release: 5.4.0
|
||||
tags: $:/tags/ChangeNote
|
||||
change-type: enhancement
|
||||
change-category: usability
|
||||
change-category: hackability
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9313
|
||||
github-contributors: Leilei332
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
change-category: usability
|
||||
change-category: widget
|
||||
change-type: bugfix
|
||||
created: 20260125195754439
|
||||
description: Refresh widget if "default" parameter input value is changed
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
title: $:/tw5.com/releases/info/
|
||||
|
||||
category-order: translation usability hackability performance widget filters plugin theme nodejs developer internal
|
||||
|
||||
summary-section-order: highlights big-bug-fixes clearing-the-decks
|
||||
category-order: translation usability hackability widget filters plugin theme nodejs developer internal
|
||||
change-type-order: feature enhancement performance bugfix deprecation security
|
||||
impact-type-order: compatibility-break deprecation pluginisation
|
||||
tab-order: [[Summary]] [[Change Types]] [[Change Categories]] [[Impacts]]
|
||||
tab-order: [[Summary]] [[By Type]] [[By Category]] [[Impacts]]
|
||||
categories/developer/singular: Developer
|
||||
categories/developer/plural: Developer
|
||||
categories/filters/singular: Filters
|
||||
@@ -16,8 +14,6 @@ categories/internal/singular: Internal
|
||||
categories/internal/plural: Internal
|
||||
categories/nodejs/singular: Node.js
|
||||
categories/nodejs/plural: Node.js
|
||||
categories/performance/singular: Performance
|
||||
categories/performance/plural: Performance
|
||||
categories/plugin/singular: Plugin
|
||||
categories/plugin/plural: Plugins
|
||||
categories/theme/singular: Theme
|
||||
@@ -58,10 +54,6 @@ impact-types/pluginisation/singular: Pluginisation
|
||||
impact-types/pluginisation/colour/background: #ddddff
|
||||
impact-types/pluginisation/colour/foreground: #222288
|
||||
impact-types/pluginisation/plural: Pluginisations
|
||||
summary-sections/big-bug-fixes/plural: Big Bug Fixes
|
||||
summary-sections/clearing-the-decks/plural: Clearing the Decks
|
||||
summary-sections/highlights/plural: Highlights
|
||||
summary-sections/highlights/default-state: open
|
||||
categories/translation/colour: #7ec8e3
|
||||
categories/usability/colour: #f4a261
|
||||
categories/hackability/colour: #9b8ec4
|
||||
|
||||
@@ -161,44 +161,23 @@ tags: $:/tags/Global
|
||||
</$list>
|
||||
\end change-note-list
|
||||
|
||||
\procedure summary-section()
|
||||
\whitespace trim
|
||||
<$let
|
||||
summaryState={{{ [<release>addprefix[$:/state/release/summary/]addsuffix[/]addsuffix<summary-key>] }}}
|
||||
summaryDefault={{{ [[$:/tw5.com/releases/info/summary-sections/]addsuffix<summary-key>addsuffix[/default-state]get[text]] }}}
|
||||
summaryListTiddler="$:/tw5.com/releases/info/summary-lists"
|
||||
summaryListField={{{ [<summary-key>addsuffix[/]addsuffix<release>] }}}
|
||||
>
|
||||
<$let summaryFilter="[<summaryListTiddler>get<summaryListField>enlist-input[]]">
|
||||
<div class="doc-release-section">
|
||||
<$button class="tc-btn-invisible doc-release-section-summary">
|
||||
<$macrocall $name="release-section-toggle" state=<<summaryState>> default=<<summaryDefault>>/>
|
||||
<span class="doc-release-section-summary-text">
|
||||
<$text text={{{ [[$:/tw5.com/releases/info/summary-sections/]addsuffix<summary-key>addsuffix[/plural]get[text]] }}} />
|
||||
<$text text=" "/><span class="doc-release-section-count">(<$text text={{{ [<summaryListTiddler>get<summaryListField>enlist-input[]] +[count[]] }}}/>)</span>
|
||||
</span>
|
||||
</$button>
|
||||
<$reveal type="match" state=<<summaryState>> text="open" default=<<summaryDefault>> tag="div" class="doc-release-section-body">
|
||||
<$macrocall $name="change-note-list" filter=<<summaryFilter>>/>
|
||||
</$reveal>
|
||||
</div>
|
||||
</$let>
|
||||
</$let>
|
||||
\end summary-section
|
||||
|
||||
\procedure summary-tab()
|
||||
\whitespace trim
|
||||
<$let show-type-badge="yes" show-category-badge="yes" show-change-impacts="yes" show-tiddler-link="yes">
|
||||
<div class="doc-release-summary">
|
||||
<$list filter="[enlist{$:/tw5.com/releases/info/summary-section-order}]" variable="summary-key">
|
||||
<div class="doc-release-summary-section">
|
||||
<$macrocall $name="summary-section"/>
|
||||
</div>
|
||||
</$list>
|
||||
</div>
|
||||
These are significant improvements that will benefit a broad range of users, and are recommended for everyone to explore.
|
||||
<$let show-type-badge="yes" show-category-badge="yes" show-change-impacts="yes" show-tiddler-link="yes"
|
||||
summaryListField={{{ [<release>addprefix[highlights/]] }}}
|
||||
>
|
||||
<$macrocall $name="change-note-list" filter="[[$:/tw5.com/releases/info/summary-lists]get<summaryListField>enlist-input[]]"/>
|
||||
</$let>
|
||||
\end summary-tab
|
||||
|
||||
\procedure release-tab-search(stateTiddler)
|
||||
\whitespace trim
|
||||
<div class="doc-release-tab-search">
|
||||
<$edit-text tiddler=<<stateTiddler>> tag="input" placeholder="Search..." default=""/>
|
||||
</div>
|
||||
\end release-tab-search
|
||||
|
||||
\procedure change-type-section()
|
||||
\whitespace trim
|
||||
<$let changeTypeState={{{ [<release>addprefix[$:/state/release/change-type/]addsuffix[/]addsuffix<change-type>] }}}>
|
||||
@@ -223,10 +202,24 @@ tags: $:/tags/Global
|
||||
|
||||
\procedure change-types-tab()
|
||||
\whitespace trim
|
||||
<$let show-type-badge="no" show-category-badge="yes" show-change-impacts="yes" show-tiddler-link="yes">
|
||||
<$list filter="[enlist{$:/tw5.com/releases/info/change-type-order}]" variable="change-type">
|
||||
<<change-type-section>>
|
||||
</$list>
|
||||
<$let show-type-badge="no" show-category-badge="yes" show-change-impacts="yes" show-tiddler-link="yes"
|
||||
searchState={{{ [<release>addprefix[$:/state/release/search/change-types/]] }}}
|
||||
>
|
||||
<$macrocall $name="release-tab-search" stateTiddler=<<searchState>>/>
|
||||
<$let searchText={{{ [<searchState>get[text]] }}}>
|
||||
<%if [<searchText>!match[]] %>
|
||||
<div class="doc-release-search-count">
|
||||
<$let count={{{ [tag[$:/tags/ChangeNote]] :filter[{!!release}match<release>] +[search:title,description,text,github-contributors,github-links<searchText>] +[count[]] }}}>
|
||||
<$text text={{{ [<count>addsuffix[ ]] }}}/>result<$text text={{{ [<count>!match[1]then[s]] }}}/>
|
||||
</$let>
|
||||
</div>
|
||||
<$macrocall $name="change-note-list" filter="[tag[$:/tags/ChangeNote]] :filter[{!!release}match<release>] +[search:title,description,text,github-contributors,github-links<searchText>] +[sort[description]]"/>
|
||||
<%else%>
|
||||
<$list filter="[enlist{$:/tw5.com/releases/info/change-type-order}]" variable="change-type">
|
||||
<<change-type-section>>
|
||||
</$list>
|
||||
<%endif%>
|
||||
</$let>
|
||||
</$let>
|
||||
\end change-types-tab
|
||||
|
||||
@@ -254,10 +247,24 @@ tags: $:/tags/Global
|
||||
|
||||
\procedure change-categories-tab()
|
||||
\whitespace trim
|
||||
<$let show-type-badge="yes" show-category-badge="no" show-change-impacts="yes" show-tiddler-link="yes">
|
||||
<$list filter="[enlist{$:/tw5.com/releases/info/category-order}]" variable="category">
|
||||
<<change-category-section>>
|
||||
</$list>
|
||||
<$let show-type-badge="yes" show-category-badge="no" show-change-impacts="yes" show-tiddler-link="yes"
|
||||
searchState={{{ [<release>addprefix[$:/state/release/search/change-categories/]] }}}
|
||||
>
|
||||
<$macrocall $name="release-tab-search" stateTiddler=<<searchState>>/>
|
||||
<$let searchText={{{ [<searchState>get[text]] }}}>
|
||||
<%if [<searchText>!match[]] %>
|
||||
<div class="doc-release-search-count">
|
||||
<$let count={{{ [tag[$:/tags/ChangeNote]] :filter[{!!release}match<release>] +[search:title,description,text,github-contributors,github-links<searchText>] +[count[]] }}}>
|
||||
<$text text={{{ [<count>addsuffix[ ]] }}}/>result<$text text={{{ [<count>!match[1]then[s]] }}}/>
|
||||
</$let>
|
||||
</div>
|
||||
<$macrocall $name="change-note-list" filter="[tag[$:/tags/ChangeNote]] :filter[{!!release}match<release>] +[search:title,description,text,github-contributors,github-links<searchText>] +[sort[description]]"/>
|
||||
<%else%>
|
||||
<$list filter="[enlist{$:/tw5.com/releases/info/category-order}]" variable="category">
|
||||
<<change-category-section>>
|
||||
</$list>
|
||||
<%endif%>
|
||||
</$let>
|
||||
</$let>
|
||||
\end change-categories-tab
|
||||
|
||||
@@ -312,10 +319,26 @@ tags: $:/tags/Global
|
||||
|
||||
\procedure impacts-tab()
|
||||
\whitespace trim
|
||||
<$let show-tiddler-link="yes">
|
||||
<$list filter="[enlist{$:/tw5.com/releases/info/impact-type-order}]" variable="impact-type">
|
||||
<<impact-type-section>>
|
||||
</$list>
|
||||
<$let show-tiddler-link="yes"
|
||||
searchState={{{ [<release>addprefix[$:/state/release/search/impacts/]] }}}
|
||||
>
|
||||
<$macrocall $name="release-tab-search" stateTiddler=<<searchState>>/>
|
||||
<$let searchText={{{ [<searchState>get[text]] }}}>
|
||||
<%if [<searchText>!match[]] %>
|
||||
<div class="doc-release-search-count">
|
||||
<$let count={{{ [tag[$:/tags/ImpactNote]] :filter[{!!changenote}get[release]match<release>] +[search:title,description,text<searchText>] +[count[]] }}}>
|
||||
<$text text={{{ [<count>addsuffix[ ]] }}}/>result<$text text={{{ [<count>!match[1]then[s]] }}}/>
|
||||
</$let>
|
||||
</div>
|
||||
<$list filter="[tag[$:/tags/ImpactNote]] :filter[{!!changenote}get[release]match<release>] +[search:title,description,text<searchText>] +[sort[description]]" variable="impact">
|
||||
<<impact-note-item>>
|
||||
</$list>
|
||||
<%else%>
|
||||
<$list filter="[enlist{$:/tw5.com/releases/info/impact-type-order}]" variable="impact-type">
|
||||
<<impact-type-section>>
|
||||
</$list>
|
||||
<%endif%>
|
||||
</$let>
|
||||
</$let>
|
||||
\end impacts-tab
|
||||
|
||||
|
||||
@@ -9,10 +9,25 @@ type: text/vnd.tiddlywiki
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.doc-release-summary-section {
|
||||
.doc-release-tab-search {
|
||||
margin-bottom: 0.75em;
|
||||
}
|
||||
|
||||
.doc-release-tab-search input {
|
||||
width: 100%;
|
||||
padding: 0.5em;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 0.25em;
|
||||
font-size: inherit;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.doc-release-search-count {
|
||||
font-size: 0.85em;
|
||||
color: #888;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.doc-release-section {
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 0.5em;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
title: $:/tw5.com/releases/info/summary-lists
|
||||
type: text/vnd.tiddlywiki
|
||||
highlights/5.4.0: [[$:/changenotes/5.4.0/#9055]] [[$:/changenotes/5.4.0/#9641]] [[$:/changenotes/5.4.0/#8972]]
|
||||
big-bug-fixes/5.4.0: [[$:/changenotes/5.4.0/#9259]]
|
||||
clearing-the-decks/5.4.0:
|
||||
highlights/5.4.0: [[$:/changenotes/5.4.0/#9055]] [[$:/changenotes/5.4.0/#8972]] [[$:/changenotes/5.4.0/#9641]] [[$:/changenotes/5.4.0/#8258]]
|
||||
|
||||
@@ -3,12 +3,10 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
<%if [<currentTab>match[Summary]] %>
|
||||
<<summary-tab>>
|
||||
<%elseif [<currentTab>match[Change Types]] %>
|
||||
<%elseif [<currentTab>match[By Type]] %>
|
||||
<<change-types-tab>>
|
||||
<%elseif [<currentTab>match[Change Categories]] %>
|
||||
<%elseif [<currentTab>match[By Category]] %>
|
||||
<<change-categories-tab>>
|
||||
<%elseif [<currentTab>match[Impacts]] %>
|
||||
<<impacts-tab>>
|
||||
<%elseif [<currentTab>match[Credits]] %>
|
||||
<<credits-tab>>
|
||||
<%endif%>
|
||||
|
||||
Reference in New Issue
Block a user