1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-02-14 14:09:51 +00:00

Compare commits

...

14 Commits

Author SHA1 Message Date
Jeremy Ruston
8281cb3868 Further styling tweaks 2024-06-26 10:23:09 +01:00
Jeremy Ruston
2f506d8bf9 Add testcase toolbar with export and import options 2024-06-25 13:52:17 +01:00
Jeremy Ruston
016335ba0b Lighted testcase background 2024-06-25 13:51:56 +01:00
Jeremy Ruston
1d92120229 Include the ExpectedResults in the displayed tabs 2024-06-25 13:51:34 +01:00
Jeremy Ruston
f15b6a26da Testcase widget: Improve docs 2024-06-24 17:47:32 +01:00
Jeremy Ruston
0031a95dfe Merge branch 'tiddlywiki-com' 2024-06-22 16:56:39 +01:00
Jeremy Ruston
eecd40723e Avoid accented characters in filenames 2024-06-22 16:56:22 +01:00
Mario Pietsch
5b9f4751ea Remove "debugger" statement from code - Make confetti examples more impressive (#8284)
* make confetti examples more impressive

* comment debugger statement
2024-06-21 14:15:31 +01:00
Mario Pietsch
b6cf098c5f Make the tour confetti more impressive (#8286) 2024-06-21 14:14:46 +01:00
Jeremy Ruston
5c63262feb Merge branch 'tiddlywiki-com' 2024-06-21 09:09:55 +01:00
Jeremy Ruston
3b88f0e741 Tweak wording 2024-06-21 09:09:44 +01:00
Mohammad Rahmani
b49ecf886b Correction to Minlength Operator (#8281) 2024-06-21 09:08:38 +01:00
Mario Pietsch
02ccec7ea8 Improve docs for TranscludeWidget and Transclusion tiddler (#8282) 2024-06-21 09:07:41 +01:00
Mario Pietsch
14c5628d35 Fix: Edge-Browser - Opening HelloThere with debugger "Pause on caught exceptions" causes a break (#8283) 2024-06-21 09:06:33 +01:00
20 changed files with 148 additions and 62 deletions

View File

@@ -104,6 +104,8 @@ ShowSideBar/Caption: show sidebar
ShowSideBar/Hint: Show sidebar
TagManager/Caption: tag manager
TagManager/Hint: Open tag manager
TestCaseImport/Caption: import tiddlers
TestCaseImport/Hint: Import tiddlers
Timestamp/Caption: timestamps
Timestamp/Hint: Choose whether modifications update timestamps
Timestamp/On/Caption: timestamps are on

View File

@@ -95,6 +95,7 @@ function SaverHandler(options) {
if($tw.browser) {
$tw.rootWidget.addEventListener("tm-save-wiki",function(event) {
self.saveWiki({
wiki: event.widget.wiki,
template: event.param,
downloadType: "text/plain",
variables: event.paramObject
@@ -102,6 +103,7 @@ function SaverHandler(options) {
});
$tw.rootWidget.addEventListener("tm-download-file",function(event) {
self.saveWiki({
wiki: event.widget.wiki,
method: "download",
template: event.param,
downloadType: "text/plain",
@@ -147,20 +149,22 @@ Save the wiki contents. Options are:
method: "save", "autosave" or "download"
template: the tiddler containing the template to save
downloadType: the content type for the saved file
wiki: optional wiki, overriding the default wiki specified in the constructor
*/
SaverHandler.prototype.saveWiki = function(options) {
options = options || {};
var self = this,
wiki = options.wiki || this.wiki,
method = options.method || "save";
// Ignore autosave if disabled
if(method === "autosave" && ($tw.config.disableAutoSave || this.wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
if(method === "autosave" && ($tw.config.disableAutoSave || wiki.getTiddlerText(this.titleAutoSave,"yes") !== "yes")) {
return false;
}
var variables = options.variables || {},
template = (options.template ||
this.wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
wiki.getTiddlerText("$:/config/SaveWikiButton/Template","$:/core/save/all")).trim(),
downloadType = options.downloadType || "text/plain",
text = this.wiki.renderTiddler(downloadType,template,options),
text = wiki.renderTiddler(downloadType,template,options),
callback = function(err) {
if(err) {
alert($tw.language.getString("Error/WhileSaving") + ":\n\n" + err);

View File

@@ -99,7 +99,7 @@ table-footer-background: #a8a8a8
table-header-background: #f0f0f0
tag-background: #ec6
tag-foreground: #ffffff
testcase-accent-level-1: #84C5E6
testcase-accent-level-1: #c1eaff
testcase-accent-level-2: #E3B740
testcase-accent-level-3: #5FD564
tiddler-background: <<colour background>>

View File

@@ -27,6 +27,31 @@ title: $:/core/ui/testcases/DefaultTemplate
<%endif%>
<$view tiddler="Description" mode="inline"/>
</$genesis>
<span class="tc-test-case-toolbar">
<$button popup=`$(state)$-more`
tooltip={{$:/language/Buttons/More/Hint}}
aria-label={{$:/language/Buttons/More/Caption}}
class="tc-btn-invisible"
selectedClass="tc-selected"
>
{{$:/core/images/down-arrow}}
</$button>
<$let
tv-config-toolbar-icons="yes"
tv-config-toolbar-text="yes"
tv-config-toolbar-class="tc-btn-invisible"
>
<$reveal state=`$(state)$-more` type="popup" position="belowleft" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TestCase/Actions]!has[draft.of]]"
variable="listItem"
>
<$transclude tiddler=<<listItem>> mode="inline"/>
</$list>
</div>
</$reveal>
</$let>
</span>
</h2>
</div>
<%if [[Narrative]is[tiddler]] %>
@@ -46,7 +71,7 @@ title: $:/core/ui/testcases/DefaultTemplate
<%endif%>
<div class="tc-test-case-panes">
<div class="tc-test-case-source">
<$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -Description -Narrative -ExpectedResult -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/>
<$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix<state>] -Description -Narrative -Output Output +[putfirst[]] -[has[plugin-type]]" state=<<state>> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/>
</div>
<div class="tc-test-case-divider">
</div>

View File

@@ -19,6 +19,9 @@ title: $:/core/ui/testcases/DefaultTemplate/SourceTabs
</table>
</$list>
<$edit class="tc-edit-texteditor" tiddler=<<currentTab>>/>
<div class="tc-test-case-footer-toolbar">
<$macrocall $name="copy-to-clipboard" src={{{ [<currentTab>get[text]] }}}/>
</div>
\end
<$transclude $variable="body" $mode="inline"/>

View File

@@ -0,0 +1,4 @@
title: $:/core/ui/testcases/actions/Export
tags: $:/tags/TestCase/Actions
<$macrocall $name="exportButton" exportFilter="[all[tiddlers]sort[]] -[prefix[$:/state/]] -Description -Narrative -ExpectedResult -Output Output +[putfirst[]] -[has[plugin-type]]" lingoBase="$:/language/Buttons/ExportTiddlers/"/>

View File

@@ -0,0 +1,11 @@
title: $:/core/ui/testcases/actions/Import
tags: $:/tags/TestCase/Actions
\whitespace trim
<$button tooltip={{$:/language/Buttons/TestCaseImport/Hint}} aria-label={{$:/language/Buttons/TestCaseImport/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-import-tiddlers" $param=<<payloadTiddlers>>/>
{{$:/core/images/permalink-button}}
<span class="tc-btn-text">
<$text text={{$:/language/Buttons/TestCaseImport/Caption}}/>
</span>
</$button>

View File

@@ -0,0 +1,2 @@
title: $:/tags/TestCase/Actions
list:

View File

@@ -1,9 +1,15 @@
created: 20141129194651420
modified: 20141130195444237
tags: Concepts
modified: 20240621074019077
tags: Concepts Definitions
title: Transclusion
[[Transclusion|https://en.wikipedia.org/wiki/Transclusion]] is the process of referencing one tiddler "A" from another tiddler "B" such that the content of "A" appears to be a part of "B".
! Definition
<<< Wikipedia: [[Transclusion|https://en.wikipedia.org/wiki/Transclusion]]
In computer science, transclusion is the inclusion of part or all of an electronic document into one or more other documents by reference via hypertext.
<<<
In ~TiddlyWiki: ''Transclusion'' is the process of referencing one tiddler "A" from another tiddler "B" such that the content of "A" appears to be a part of "B".
Copying and pasting content creates multiple copies of the same content in several different places. With transclusion, there can be a single copy and a special instruction in "B" which indicates the point at which content should be inserted from tiddler "A".

View File

@@ -1,12 +1,12 @@
caption: minlength
created: 20161011074235805
modified: 20161011074235805
from-version: 5.1.14
modified: 20240621073052597
op-input: a list of items
op-output: those items at least as long as the specified minimum length
op-parameter: the minimum length for items
op-parameter-name: minlength
op-purpose: filter items shorter than the specified minimum length
from-version: 5.1.14
op-purpose: filter items whose length is greater than the specified minimum length
tags: [[Filter Operators]]
title: minlength Operator
type: text/vnd.tiddlywiki

View File

@@ -1,4 +1,6 @@
title: Open Collective Logo
created: 20240621075644739
modified: 20240621075647009
tags: picture
title: Open Collective Logo
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 28 28"><path d="M25.509 6.026A13.934 13.934 0 0 1 28 14c0 2.963-.92 5.71-2.491 7.974l-3.626-3.627A8.96 8.96 0 0 0 23 14a8.964 8.964 0 0 0-1.117-4.347l3.626-3.627Z"/><path d="m21.974 2.49-3.627 3.628a9 9 0 1 0 0 15.765l3.627 3.626A13.934 13.934 0 0 1 14 27.999C6.268 28 0 21.733 0 14 0 6.269 6.268 0 14 0c2.963 0 5.711.922 7.974 2.492Z"/></svg>
<svg style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 28 28"><path d="M25.509 6.026A13.934 13.934 0 0 1 28 14c0 2.963-.92 5.71-2.491 7.974l-3.626-3.627A8.96 8.96 0 0 0 23 14a8.964 8.964 0 0 0-1.117-4.347l3.626-3.627Z"/><path d="m21.974 2.49-3.627 3.628a9 9 0 1 0 0 15.765l3.627 3.626A13.934 13.934 0 0 1 14 27.999C6.268 28 0 21.733 0 14 0 6.269 6.268 0 14 0c2.963 0 5.711.922 7.974 2.492Z"/></svg>

View File

@@ -5,7 +5,7 @@ description: An example of a failing test
title: Narrative
This test case intentionally fails (in order to show how failures are displayed)
This test case intentionally fails (in order to show how failures are displayed). The expected result is set to <code><$text text={{ExpectedResult}}/></code>, but the result computes to <code><$wikify name="html" text={{Output}} mode="block" output="html"><$text text=<<html>>/></$wikify></code>
+
title: Output

View File

@@ -72,6 +72,7 @@ The test case wiki will inherit variables that are visible to the <<.wid testcas
|!Variable |!Description |
|<<.var linkTarget>> |Causes the test case description to be rendered as a link to the current tiddler |
|<<.var displayFormat>> |Defaults to "wikitext", can also be "plaintext" to force plain text display |
|<<.var testcaseTiddler>> |Title of the tiddler to be used as a link target for the testcase description |
A custom template can be specified for special purposes. For example, the provided template $:/core/ui/testcases/RawJSONTemplate just displays the payload tiddlers in JSON, which can be used for debugging purposes.

View File

@@ -1,21 +1,48 @@
caption: transclude
created: 20130824142500000
modified: 20230511022612458
modified: 20240621073236430
tags: Widgets
title: TranscludeWidget
type: text/vnd.tiddlywiki
! Introduction
The <<.wlink TranscludeWidget>> widget dynamically includes the content from another tiddler or variable, rendering it as if the transclude widget were replaced by the target content.
Transclusion is the underlying mechanism for many higher level wikitext features, such as ''procedures'', ''functions'', ''custom widgets'' and ''macros''.
The <<.wlink TranscludeWidget>> widget can be used to render content of any type: wikitext, images, videos, etc.
The <<.wid transclude>> widget dynamically includes the content from another ''tiddler'' or ''variable'', rendering it as if the transclude widget were replaced by the target content.
Transclusion is the underlying mechanism for many higher level wikitext features, such as procedures, custom widgets and macros.
The <<.wid transclude>> widget can be used to render content of any type: wikitext, images, videos, etc.
! Attributes
| !Attribute |<| !Description |
| !(modern) | !(legacy) |~|
|$variable |- |Name of the variable to transclude. Eg: Name of <<.dlink procedures Procedures>>, <<.dlink functions Functions>>, <<.dlink "custom widgets" Widgets>> and <<.dlink macros Macros>> |
|$tiddler |tiddler |The title of the tiddler to transclude (defaults to the current tiddler) |
|$field |field |The field name of the current tiddler (defaults to "text"; if present takes precedence over the index attribute) |
|$index |index |The index of a property in a [[DataTiddler|DataTiddlers]] |
|$subtiddler |subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
|$mode |mode |Override the default parsing mode for the transcluded text to "block" or "inline" |
|$type | |Optional ContentType used when transcluding variables, indexes or fields other than the ''text'' field|
|$output |- |ContentType for the output rendering (defaults to `text/html`, can also be `text/plain` or `text/raw`) |
|$recursionMarker |recursionMarker |Set to ''no'' to prevent creation of [[Legacy Transclusion Recursion Marker]] (defaults to ''yes'') |
|$fillignore |- |Set to ''yes'' to make this transclusion invisible to the <<.attr $depth>> attribute of the <<.wlink SlotWidget>> widget (defaults to ''no'') |
|//{attributes not starting with $}// | |Any other attributes that do not start with a dollar are used as parameters to the transclusion |
|//{other attributes starting with $}// | |Other attributes starting with a single dollar sign are ''reserved'' for future use |
|//{attributes starting with $$}// | |Attributes starting with two dollar signs are used as parameters to the transclusion, but with the name changed to use a single dollar sign |
! Legacy vs. Modern Mode
The <<.wid transclude>> widget can be used in two modes:
* <<.from-version "5.3.0">> ''Modern mode'' offers the full capabilities of the <<.wid transclude>> widget, and incorporates the functionality of the <<.wlink MacroCallWidget>> widget. It is indicated by the presence of at least one attribute starting with a dollar sign `$`
* ''Legacy mode'' offers a more limited set of capabilities. It is indicated by the absence of any attributes starting with a dollar sign `$`
Modern mode is recommended for use in new applications.
! Example
Here is a complete example showing the important features of the <<.wlink TranscludeWidget>> widget:
Here is a complete example showing the important features of the <<.wid transclude>> widget:
```
\procedure myproc(name,age)
@@ -29,36 +56,9 @@ My name is <<name>> and my age is <<age>>.
* The content of the procedure refers to the parameters as variables
* The <<.wlink TranscludeWidget>> widget specifies the variable to transclude, and values for the parameters.
! Legacy vs. Modern Mode
The <<.wlink TranscludeWidget>> widget can be used in two modes:
* <<.from-version "5.3.0">> ''Modern mode'' offers the full capabilities of the <<.wlink TranscludeWidget>> widget, and incorporates the functionality of the <<.wlink MacroCallWidget>> widget. It is indicated by the presence of at least one attribute starting with a dollar sign `$`
* ''Legacy mode'' offers a more limited set of capabilities. It is indicated by the absence of any attributes starting with a dollar sign `$`
Modern mode is recommended for use in new applications.
! Attributes
| !Attribute |<| !Description |
| !(modern) | !(legacy) |~|
|$variable |- |Name of the variable to transclude |
|$tiddler |tiddler |The title of the tiddler to transclude (defaults to the current tiddler) |
|$field |field |The field name of the current tiddler (defaults to "text"; if present takes precedence over the index attribute) |
|$index |index |The index of a property in a [[DataTiddler|DataTiddlers]] |
|$subtiddler |subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
|$mode |mode |Override the default parsing mode for the transcluded text to "block" or "inline" |
|$type | |Optional ContentType used when transcluding variables, indexes or fields other than the ''text'' field|
|$output |- |ContentType for the output rendering (defaults to `text/html`, can also be `text/plain` or `text/raw`) |
|$recursionMarker |recursionMarker |Set to ''no'' to prevent creation of [[Legacy Transclusion Recursion Marker]] (defaults to ''yes'') |
|$fillignore |- |Set to ''yes'' to make this transclusion invisible to the <<.attr $depth>> attribute of the <<.wlink SlotWidget>> widget (defaults to ''no'') |
|//{attributes not starting with $}// | |Any other attributes that do not start with a dollar are used as parameters to the transclusion |
|//{other attributes starting with $}// | |Other attributes starting with a single dollar sign are reserved for future use |
|//{attributes starting with $$}// | |Attributes starting with two dollar signs are used as parameters to the transclusion, but with the name changed to use a single dollar sign |
! Basic Operation
The basic operation of the <<.wlink TranscludeWidget>> widget is as follows:
The basic operation of the <<.wid transclude>> widget is as follows:
|`<$transclude/>` |Transcludes the text field of the current tiddler |
|`<$transclude $variable="alpha"/>` |Transcludes the variable "alpha" (note that procedures, custom widgets and macros are all special types of variable) |
@@ -69,7 +69,7 @@ The basic operation of the <<.wlink TranscludeWidget>> widget is as follows:
! Transclusion Parameters
Named string parameters can be passed to the <<.wlink TranscludeWidget>> widget. They are made available as variables within the transcluded text. Parameters are only supported in modern mode.
Named string parameters can be passed to the <<.wid transclude>> widget. They are made available as variables within the transcluded text. Parameters are only supported in modern mode.
When invoking a transclusion, parameters are specified as additional attributes that do not start with a dollar sign `$`:
@@ -108,7 +108,7 @@ Parameters are available here as the variables <<firstParameter>> and <<secondPa
! Transclusion Slots
Transcluded content can define special named locations called slots. At the point of transclusion, blocks of wikitext can be passed to the <<.wlink TranscludeWidget>> widget to fill those slots.
Transcluded content can define special named locations called slots. At the point of transclusion, blocks of wikitext can be passed to the <<.wid transclude>> widget to fill those slots.
Slots work very similarly to parameters except that they can contain structured wikitext, and not just plain text. The primary advantage of slots over parameters is that the contents do not need to be wrapped in quotation symbols, making it much simpler to pass complex structures.

View File

@@ -33,7 +33,7 @@ ConfettiManager.prototype.launch = function (delay,options) {
self.outstandingTimers.splice(p,1);
} else {
console.log("Confetti Manager Error: Cannot find previously stored timer ID");
debugger;
// debugger;
}
confetti(options);
},delay);

View File

@@ -3,7 +3,8 @@ tags: $:/tags/ConfettiExample
<$button>
<$action-sendmessage $message="tm-confetti-launch"/>
<$action-sendmessage $message="tm-confetti-launch" originY=0.6 spread=70 delay=300/>
<$action-sendmessage $message="tm-confetti-launch" originY=0.55 spread=30 delay=600/>
Launch three staggered rounds of confetti
<$action-sendmessage $message="tm-confetti-launch" delay=300 originY=0.6 spread=100 scalar=1.5/>
<$action-sendmessage $message="tm-confetti-launch" delay=400 originY=0.55 spread=130/>
<$action-sendmessage $message="tm-confetti-launch" delay=500 originY=0.55 spread=170 scalar=2/>
Launch four staggered rounds of confetti
</$button>

View File

@@ -6,5 +6,5 @@ Type the word "launch": <$edit-text tiddler="$:/temp/confetti/launchstatus" tag=
<$list filter="[{$:/temp/confetti/launchstatus}match:caseinsensitive[launch]]" variable="ignore">
Launched!
<$confetti particleCount=100/>
<$confetti particleCount=100 delay=300/>
<$confetti particleCount=100 spread=170 delay=300/>
</$list>

View File

@@ -20,11 +20,9 @@ tags: $:/tags/PageTemplate
<%endif%>
<%if [function[tour-is-last-step]] %>
<$confetti/>
<$confetti delay=100/>
<$confetti delay=200/>
<$confetti delay=300/>
<$confetti delay=400/>
<$confetti delay=500/>
<$confetti delay=300 originY=0.6 spread=100 scalar=1.5/>
<$confetti delay=400 originY=0.55 spread=130/>
<$confetti delay=500 originY=0.55 spread=170 scalar=2/>
<%endif%>
</div>
\end

View File

@@ -3297,7 +3297,7 @@ span.tc-translink > a:first-child {
display: inline-block;
line-height: 0;
border-radius: 1em;
vertical-align: bottom;
vertical-align: text-bottom;
margin-right: 0.25em;
}
@@ -3314,6 +3314,12 @@ span.tc-translink > a:first-child {
height: 0.5em;
}
.tc-test-case-header > h2 {
background: <<colour background>>;
border-radius: 4px;
padding: 0.25em;
}
.tc-test-case-header > h2,
.tc-test-case-source > pre {
margin: 0;
@@ -3323,6 +3329,18 @@ span.tc-translink > a:first-child {
font-style: normal;
}
.tc-test-case-toolbar {
float: right;
}
.tc-test-case-toolbar svg {
fill: <<colour tiddler-controls-foreground>>;
}
.tc-test-case-toolbar .tc-drop-down {
font-size: 0.8em;
}
.tc-test-case-result-fail {
border: 1px solid <<colour foreground>>;
background-color: <<colour background>>;
@@ -3366,10 +3384,14 @@ span.tc-translink > a:first-child {
}
.tc-test-case-source .tc-tab-content {
background: <<colour background>>;
background: inherit;
margin: 0;
}
.tc-test-case-source .tc-tab-content .tc-field-table {
background: <<colour background>>;
}
.tc-test-case-source .tc-field-table {
width: 100%;
}
@@ -3390,11 +3412,16 @@ span.tc-translink > a:first-child {
padding-top: 0;
}
.tc-test-case-footer-toolbar {
display: flex;
justify-content: flex-end;
}
.tc-test-case-output {
box-shadow: inset 2px 2px 10px 0px <<colour muted-foreground>>;
background: <<colour background>>;
border-radius: 4px;
border: 1px solid <<colour foreground>>;
border: 1px solid <<colour muted-foreground>>;
flex: 1 0 49%;
min-width: 250px;
padding: 0.25em 1em;