1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-04-21 14:21:30 +00:00

Merge branch 'master' into direct-style-attributes

This commit is contained in:
jeremy@jermolene.com
2022-01-11 17:57:49 +00:00
17 changed files with 109 additions and 48 deletions

View File

@@ -3,6 +3,7 @@ title: $:/language/Docs/Fields/
_canonical_uri: The full URI of an external image tiddler
bag: The name of the bag from which a tiddler came
caption: The text to be displayed on a tab or button
code-body: The view template will display the tiddler as code if set to ''yes''
color: The CSS color value associated with a tiddler
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
current-tiddler: Used to cache the top tiddler in a [[history list|HistoryMechanism]]
@@ -13,9 +14,9 @@ description: The descriptive text for a plugin, or a modal dialogue
draft.of: For draft tiddlers, contains the title of the tiddler of which this is a draft
draft.title: For draft tiddlers, contains the proposed new title of the tiddler
footer: The footer text for a wizard
hide-body: The view template will hide bodies of tiddlers if set to: ''yes''
hide-body: The view template will hide bodies of tiddlers if set to ''yes''
icon: The title of the tiddler containing the icon associated with a tiddler
library: Indicates that a tiddler should be saved as a JavaScript library if set to: ''yes''
library: Indicates that a tiddler should be saved as a JavaScript library if set to ''yes''
list: An ordered list of tiddler titles associated with a tiddler
list-before: If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty
@@ -32,7 +33,7 @@ tags: A list of tags associated with a tiddler
text: The body text of a tiddler
throttle.refresh: If present, throttles refreshes of this tiddler
title: The unique name of a tiddler
toc-link: Suppresses the tiddler's link in a Table of Contents tree if set to: ''no''
toc-link: Suppresses the tiddler's link in a Table of Contents tree if set to ''no''
type: The content type of a tiddler
version: Version information for a plugin
_is_skinny: If present, indicates that the tiddler text field must be loaded from the server

View File

@@ -13,15 +13,17 @@ Text editor operation to wrap the selected lines with a prefix and suffix
"use strict";
exports["wrap-lines"] = function(event,operation) {
var prefix = operation.paramObject.prefix || "",
suffix = operation.paramObject.suffix || "";
// Cut just past the preceding line break, or the start of the text
operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);
// Cut to just past the following line break, or to the end of the text
operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);
// Add the prefix and suffix
operation.replacement = event.paramObject.prefix + "\n" +
operation.replacement = prefix + "\n" +
operation.text.substring(operation.cutStart,operation.cutEnd) + "\n" +
event.paramObject.suffix + "\n";
operation.newSelStart = operation.cutStart + event.paramObject.prefix.length + 1;
suffix + "\n";
operation.newSelStart = operation.cutStart + prefix.length + 1;
operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart);
};

View File

@@ -24,13 +24,13 @@ exports.isDraft = function() {
return this.hasField("draft.of");
};
exports.getFieldString = function(field) {
exports.getFieldString = function(field,defaultValue) {
var value = this.fields[field];
// Check for a missing field
if(value === undefined || value === null) {
return "";
return defaultValue || "";
}
// Parse the field with the associated module (if any)
// Stringify the field with the associated tiddler field module (if any)
var fieldModule = $tw.Tiddler.fieldModules[field];
if(fieldModule && fieldModule.stringify) {
return fieldModule.stringify.call(this,value);

View File

@@ -64,9 +64,9 @@ RadioWidget.prototype.getValue = function() {
tiddler = this.wiki.getTiddler(this.radioTitle);
if(tiddler) {
if(this.radioIndex) {
value = this.wiki.extractTiddlerDataItem(this.radioTitle,this.radioIndex);
value = this.wiki.extractTiddlerDataItem(this.radioTitle,this.radioIndex,this.radioDefault);
} else {
value = tiddler.getFieldString(this.radioField);
value = tiddler.getFieldString(this.radioField,this.radioDefault);
}
} else {
value = this.radioDefault;

View File

@@ -6,7 +6,7 @@ title: $:/core/templates/tiddlywiki5.html
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!--~~ Raw markup for the top of the head section ~~-->
`{{{ [<saveTiddlerAndShadowsFilter>tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}}`
`{{{ [enlist<saveTiddlerAndShadowsFilter>tag[$:/tags/RawMarkupWikified/TopHead]] ||$:/core/templates/raw-static-tiddler}}}`
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta name="application-name" content="TiddlyWiki" />
<meta name="generator" content="TiddlyWiki" />

View File

@@ -17,11 +17,13 @@ type: text/vnd.tiddlywiki
! Bug Fixes
*
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/60187dc59e6546d9ca8e6a35418f782a9627cda0">> importing/upgrading encrypted single file wikis
! Usability Improvements
*
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/853a899c77766e47eade1dfa5822640ef9915637">> wrapping and wikification of field names in field viewer
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/0186c6490fbd1d8fd4de7c3fa99ccf4d129fbd80">> missing whitespace between description and MIME type in edit template dropdown for the ''type'' field
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/c7e8c87f85b54f60302ff8e396a7569d996e3f67">> incorrect usage of code view for certain system tiddlers
! Widget Improvements
@@ -33,7 +35,9 @@ type: text/vnd.tiddlywiki
! Hackability Improvements
*
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/commit/54cfda76ee353190f1cf0210b9071894fb1a5690">> support for ''code-body'' field set to ''yes'' to trigger display of a tiddler in the code view
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/commit/66ae1d6930796a9eb062fdb64a755adab8f39294">> classes to the ImageWidget to indicate whether it is loading, loaded or has encountered an error
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/6381">> sourceURL tags to $:/boot/boot.js and $:/boot/bootprefix.js, enabling them to be accessed in the browser debugger more easily
! Developer Improvements
@@ -45,7 +49,7 @@ type: text/vnd.tiddlywiki
! Translation improvements
*
* Polish
! Acknowledgements

View File

@@ -1,5 +1,5 @@
created: 20130825213300000
modified: 20191206152031468
modified: 20220109101407050
tags: Concepts
title: TiddlerFields
type: text/vnd.tiddlywiki
@@ -25,6 +25,7 @@ Other fields used by the core are:
|!Field Name |!Description |
|`class` |<<lingo class>> |
|`code-body` |<<.from-version "5.2.1">> <<lingo code-body>> |
|`color` |<<lingo color>> |
|`description` |<<lingo description>> |
|`draft.of` |<<lingo draft.of>> |

View File

@@ -1,5 +1,5 @@
created: 20140410103123179
modified: 20210830010231559
modified: 20211217141224284
tags: Filters
title: Filter Operators
type: text/vnd.tiddlywiki
@@ -10,18 +10,21 @@ type: text/vnd.tiddlywiki
<td>{{!!op-purpose}}</td>
<td align="center"><$list filter="[all[current]tag[Common Operators]]">✓</$list></td>
<td align="center"><$list filter="[all[current]tag[Negatable Operators]]">`!`</$list></td>
<td align="center"><$list filter="[all[current]tag[Selection Constructors]!tag[Selection Constructors: Conditional]]">`C`</$list><$list filter="[all[current]tag[Selection Constructors]tag[Selection Constructors: Conditional]]">`C?`</$list></td>
</tr></$list>
\end
\define .group-heading(_)
<tr class="doc-table-subheading"><th colspan="4" align="center">$_$</th></tr>
<tr class="doc-table-subheading"><th colspan="5" align="center">$_$</th></tr>
\end
A <<.def "filter operator">> is a predefined keyword attached to an individual [[step|Filter Step]] of a [[filter|Filters]]. It defines the particular action of that step.
''Important:'' Each first [[step|Filter Step]] of a [[filter run|Filter Run]] not given any input titles receives the output of <$link to="all Operator">[all[tiddlers]]</$link> as its input.
The following table lists all core operators, the most common ones marked ✓. The last column indicates whether an operator allows ''negation'' using the <$link to="Filter Step"><code>!</code> prefix</$link>. For specifics as to each operator's negated output please refer to its documentation.
The following table lists all core operators, the most common ones marked ✓. The `!` column indicates whether an operator allows ''negation'' using the <$link to="Filter Step"><code>!</code> prefix</$link>. For specifics as to each operator's negated output please refer to its documentation.
Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few [[construct an entirely new selection|Selection Constructors]] instead, as indicated by the last column. A `C?` indicates it might construct a new selection, depending on usage. For specifics as to each operator's selection creation please refer to its documentation.
<table>
<tr>
@@ -29,6 +32,7 @@ The following table lists all core operators, the most common ones marked ✓. T
<th align="left">Purpose</th>
<th align="center">✓</th>
<th align="center">`!`</th>
<th align="center">`C`</th>
</tr>
<<.operator-rows "[tag[Filter Operators]!tag[Order Operators]!tag[Mathematics Operators]!tag[String Operators]!tag[Tag Operators]!tag[Special Operators]sort[]]">>
<<.group-heading "Order Operators">>
@@ -45,6 +49,6 @@ The following table lists all core operators, the most common ones marked ✓. T
<<.operator-rows "[tag[Filter Operators]!tag[Order Operators]!tag[Mathematics Operators]!tag[String Operators]!tag[Tag Operators]tag[Special Operators]sort[]]">>
</table>
A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]].
A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]].
Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few [[construct an entirely new selection|Selection Constructors]] instead. For the exact rules, see [[Filter Syntax]].
For the exact rules, see [[Filter Syntax]].

View File

@@ -1,11 +1,11 @@
caption: all
created: 20140410103123179
modified: 20161128185445034
modified: 20211217135719266
op-input: ignored, unless the parameter is empty
op-output: the titles that belong to all the specified categories
op-parameter: zero or more categories
op-purpose: find all titles of a fundamental category
tags: [[Filter Operators]] [[Common Operators]] [[Selection Constructors]]
tags: [[Filter Operators]] [[Common Operators]] [[Selection Constructors]] [[Selection Constructors: Conditional]]
title: all Operator
type: text/vnd.tiddlywiki

View File

@@ -1,6 +1,6 @@
caption: subfilter
created: 20181031175129475
modified: 20211030223407188
modified: 20211217135706478
op-input: a [[selection of titles|Title Selection]] passed as input to the subfilter
op-neg-input: a [[selection of titles|Title Selection]] passed as input to the subfilter
op-neg-output: those input titles that are <<.em not>> returned from the subfilter <<.place S>>
@@ -8,7 +8,7 @@ op-output: the [[selection of titles|Title Selection]] returned from the subfilt
op-parameter: a [[filter expression|Filter Expression]]
op-parameter-name: S
op-purpose: select titles from the operand interpreted as a [[filter expression|Filter Expression]]
tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]]
tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]] [[Selection Constructors: Conditional]]
title: subfilter Operator
type: text/vnd.tiddlywiki

View File

@@ -1,5 +1,5 @@
created: 20160424150551727
modified: 20190115162340362
modified: 20211230153027382
tags: Learning
title: Concatenating text and variables using macro substitution
type: text/vnd.tiddlywiki
@@ -9,9 +9,7 @@ It's a frequent use case in ~TiddlyWiki that you will want to put the results of
You might, for instance want to set up a template for your customer database, where links will automatically refer to additional contact information about your customer. Inside your tiddler, you might try something like this:
|warning|k
|@@font-size:1.5em;&#9888;@@ Warning:<br/> Don't do it this way!| `[[Additional Info|<<currentTiddler>>-Contact]]` |
<<.bad-example "`[[Additional Info|<<currentTiddler>>-Contact]]`">>
But that won't work. If you try this, the link will be interpreted very literally, and will attempt to take you to:
@@ -29,9 +27,7 @@ Create a macro at the top of the tiddler like this:
You might be tempted to invoke the new macro like this:
|warning|k
|@@font-size:1.5em;&#9888;@@ Warning:<br/> Don't do it this way!| `<<linkup <<currentTiddler>> >>` |
<<.bad-example "`<<linkup <<currentTiddler>> >>`">>
But if you do, you will find that `<<currentTiddler>>` doesn't get rendered, but instead gets passed literally.
@@ -53,10 +49,4 @@ Notice that in this case we don't pass an argument. Instead, we reference the va
```
<<linkup>>
```
<style>
.warning code {background-color:#ffff80}
table.warning {background-color:#ffff80;}
</style>
```

View File

@@ -1,5 +1,5 @@
created: 20150117152607000
modified: 201804111739
modified: 20211230150413997
tags: $:/tags/Macro
title: $:/editions/tw5.com/doc-macros
type: text/vnd.tiddlywiki
@@ -113,6 +113,20 @@ This is an example tiddler. See [[Table-of-Contents Macros (Examples)]].
</$list>
\end
\define .bad-example(eg)
<table class="doc-bad-example">
<tbody>
<tr class="evenRow">
<td><span class="tc-inline-style" style="font-size:1.5em;">&#9888;</span> Warning:<br> Don't do it this way!</td>
<td>
$eg$
</td>
</tr>
</tbody>
</table>
\end
\define .link-badge(text,link,colour)
<a href=<<__link__>> class="doc-link-badge" style="background-color:$colour$;" target="_blank" rel="noopener noreferrer"><$text text=<<__text__>>/></a>
\end

View File

@@ -1,5 +1,5 @@
created: 20150117152612000
modified: 20211124164948726
modified: 20211230150725145
tags: $:/tags/Stylesheet
title: $:/editions/tw5.com/doc-styles
type: text/vnd.tiddlywiki
@@ -133,6 +133,10 @@ td svg {
padding-left: 20px;
}
.doc-bad-example code, .doc-bad-example pre, table.doc-bad-example {
background-color:#ffff80;
}
.doc-table th, .doc-table tr {
vertical-align: top;
}

View File

@@ -1,6 +1,6 @@
caption: Linking
created: 20131205155230596
modified: 20160607095245257
modified: 20211230145939554
tags: WikiText
title: Linking in WikiText
type: text/vnd.tiddlywiki
@@ -80,3 +80,40 @@ You can also use the extended syntax to force an external link:
See the LinkWidget for details of the underlying widget used to implement tiddler links, including macros that can be used to customise its behaviour.
! Generating dynamic links
[[Linking in WikiText]] does not lend itself well to creating dynamic links. The reason is because this WikiText link:
```
[[link to myself|Linking in WikiText]]
```
is shorthand for using the LinkWidget and TextWidget like this:
```
<$link to="Linking in WikiText">
<$text text="link to myself"/>
</$link>
```
Since both the link title ("link to myself") and the link target ("Linking in ~WikiText") are used as widget attributes, no WikiText expansion takes place.
For example, an attempt to use a [[reference|TextReference]] and a [[variable|Variables]] to dynamically generate a link like this:
<<.bad-example "`[[{{!!caption}}|<<currentTiddler>>]]`">>
is the same as trying to use the LinkWidget and TextWidget like this:
<<.bad-example """```
<$link to="<<currentTiddler>>">
<$text text="{{!!caption}}"/>
</$link>
```""">>
This will not work as desired. Content inside of quoted widget attributes is [[treated as a literal value|HTML in WikiText]] and protected from WikiText expansion, so it will render like this:
<<.bad-example "[[{{!!caption}}|<<currentTiddler>>]]">>
In order to get the desired result, the LinkWidget can be used directly like this:
<<wikitext-example-without-html src:"<$link to=<<currentTiddler>>>{{!!caption}}</$link>">>
See also another example of [[constructing dynamic links|Concatenating text and variables using macro substitution]].

View File

@@ -3,6 +3,7 @@ title: $:/language/Docs/Fields/
_canonical_uri: 外部图像条目的完整的 URI
bag: 条目的来源集的名称
caption: 显示于页签或按钮上的标题文字
code-body: 若设置为 ''yes'',视图模板将以程式码形式显示条目
color: 条目的 CSS 颜色值
component: 负责[[警示条目|AlertMechanism]]的组件名称
created: 条目的创建日期
@@ -13,8 +14,9 @@ description: 插件的说明、描述
draft.of: 草稿条目,包含条目的标题、标签、栏位 ...
draft.title: 草稿条目的标题
footer: wizard 的注脚
hide-body: 若设置为 ''yes'',视图模板将隐藏条目的主体
icon: 条目的标题含有与条目关联的图标
library: 若设为 "yes",表示条目应该被保存为一个 JavaScript 程序库
library: 若设''yes'',表示条目应该被保存为一个 JavaScript 程序库
list: 条目的列表,指定一些条目的标题清单
list-before:当前条目名称将被添加到条目排序清单中的设置条目名称之前,或若此栏位存在但是空的,则被添加于清单的前端
list-after: 当前条目名称将被添加到条目排序清单的设置条目名称之后,或若此栏位存在但是空的,则被添加于清单的尾端
@@ -31,7 +33,7 @@ tags: 条目的标签清单
text: 条目的内文
throttle.refresh: 如果存在,则限制此条目的刷新
title: 条目的唯一名称
toc-link: 若设为: "no",则抑制目录树中的条目链接。
toc-link: 若设置为 ''no'',则抑制目录树中的条目链接。
type: 条目的内容类型
version: 插件的版本信息
_is_skinny: 如果存在,则表示必须从服务器加载条目的文本字段

View File

@@ -3,6 +3,7 @@ title: $:/language/Docs/Fields/
_canonical_uri: 外部圖片條目的完整的 URI
bag: 條目的來源集的名稱
caption: 顯示於頁籤或按鈕上的標題文字
code-body: 若設定為 ''yes'',檢視範本將以程式碼形式顯示條目
color: 條目的 CSS 顏色值
component: 負責[[警示條目|AlertMechanism]]的元件名稱
created: 條目的建立日期
@@ -13,8 +14,9 @@ description: 插件的說明、描述
draft.of: 草稿條目,包含條目的標題、標籤、欄位 ...
draft.title: 草稿條目的標題
footer: wizard 的註腳
hide-body: 若設定為 ''yes'',檢視範本將隱藏條目的主體
icon: 條目的標題含有與條目關聯的圖示
library: 若設為 "yes",表示條目應該被儲存為一個 JavaScript 程式庫
library: 若設''yes'',表示條目應該被儲存為一個 JavaScript 程式庫
list: 條目的列表,指定一些條目的標題清單
list-before: 當前條目名稱將被新增到條目排序清單中的設定條目名稱之前,或若此欄位存在但是空的,則被新增於清單的前端
list-after: 當前條目名稱將被新增到條目排序清單中的設定條目名稱之後,或若此欄位存在但是空的,則被新增於清單的尾端
@@ -31,7 +33,7 @@ tags: 條目的標籤清單
text: 條目的內文
throttle.refresh: 如果存在,則限制此條目的刷新
title: 條目的唯一名稱
toc-link: 若設爲: "no",則抑制目錄樹中的條目鏈接。
toc-link: 若設定爲 ''no'',則抑制目錄樹中的條目鏈接。
type: 條目的內容類型
version: 插件的版本資訊
_is_skinny: 如果存在,則表示必須從伺服器載入條目的文字欄位

View File

@@ -368,7 +368,7 @@ Mark Kerrigan, @markkerrigan, 2019/08/24
Stefan Schuster-Teupke, @StefanSTFG, 2019/08/26
Nils-Hero Lindemann, @heronils, 2019/08/26
Nils Lindemann, @nilslindemann, 2022/01/10
Marica Odagaki, @ento, 2019/08/30