mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-05 23:10:28 +00:00
Merge branch 'master' into multi-wiki-support
This commit is contained in:
commit
ed71adac7e
@ -49,11 +49,11 @@ exports.parse = function() {
|
||||
if(this.match[3]) {
|
||||
params = $tw.utils.parseParameterDefinition(this.match[4]);
|
||||
}
|
||||
// Is this a multiline definition?
|
||||
// Is the remainder of the line blank after the parameter close paren?
|
||||
var reEnd;
|
||||
if(this.match[5]) {
|
||||
// If so, the end of the body is marked with \end
|
||||
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
||||
reEnd = new RegExp("((:?^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[2]) + ")?(?:$|\\r?\\n))","mg");
|
||||
} else {
|
||||
// Otherwise, the end of the definition is marked by the end of the line
|
||||
reEnd = /($|\r?\n)/mg;
|
||||
|
@ -54,11 +54,11 @@ exports.parse = function() {
|
||||
paramMatch = reParam.exec(paramString);
|
||||
}
|
||||
}
|
||||
// Is this a multiline definition?
|
||||
// Is the remainder of the \define line blank after the parameter close paren?
|
||||
var reEnd;
|
||||
if(this.match[3]) {
|
||||
// If so, the end of the body is marked with \end
|
||||
reEnd = new RegExp("(\\r?\\n[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
||||
// If so, it is a multiline definition and the end of the body is marked with \end
|
||||
reEnd = new RegExp("((?:^|\\r?\\n)[^\\S\\n\\r]*\\\\end[^\\S\\n\\r]*(?:" + $tw.utils.escapeRegExp(this.match[1]) + ")?(?:$|\\r?\\n))","mg");
|
||||
} else {
|
||||
// Otherwise, the end of the definition is marked by the end of the line
|
||||
reEnd = /($|\r?\n)/mg;
|
||||
|
@ -90,7 +90,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (this.getEditorType() !== this.editorType)) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -153,7 +153,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
||||
} else if(variable.isFunctionDefinition) {
|
||||
// Function evaluations
|
||||
params = self.resolveVariableParameters(variable.params,actualParams);
|
||||
var variables = Object.create(null);
|
||||
var variables = options.variables || Object.create(null);
|
||||
// Apply default parameter values
|
||||
$tw.utils.each(variable.params,function(param,index) {
|
||||
if(param["default"]) {
|
||||
|
@ -0,0 +1,24 @@
|
||||
title: Functions/FunctionFilterrunVariables
|
||||
description: Functions in filter runs that set variables
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Idiosyncrasy
|
||||
caption: Idiosyncrasy Caption Field
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\procedure demo-subfilter() [<currentTiddler>]
|
||||
\function .demo-function() [<currentTiddler>]
|
||||
|
||||
<$let currentTiddler="Idiosyncrasy">
|
||||
<$text text={{{ [<currentTiddler>get[caption]!is[blank]else<currentTiddler>] :map[subfilter<demo-subfilter>] }}}/>,
|
||||
<$text text={{{ [<currentTiddler>get[caption]!is[blank]else<currentTiddler>] :map[.demo-function[]] }}}/>
|
||||
</$let>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Idiosyncrasy Caption Field,Idiosyncrasy Caption Field</p>
|
@ -0,0 +1,20 @@
|
||||
title: Functions/FunctionFilterrunVariables2
|
||||
description: Functions in filter runs that set variables
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Apple
|
||||
cost: 5
|
||||
|
||||
+
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\function .doublecost() [<currentTiddler>get[cost]multiply[2]]
|
||||
|
||||
<$text text={{{ [[Apple]] :map[.doublecost[]] }}}/>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
10
|
16
editions/test/tiddlers/tests/data/macros/EndInBody.tid
Normal file
16
editions/test/tiddlers/tests/data/macros/EndInBody.tid
Normal file
@ -0,0 +1,16 @@
|
||||
title: Macros/EndInBody
|
||||
description: \end line starting with non-whitespace is part of macro body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
16
editions/test/tiddlers/tests/data/macros/IndentedEnd.tid
Normal file
16
editions/test/tiddlers/tests/data/macros/IndentedEnd.tid
Normal file
@ -0,0 +1,16 @@
|
||||
title: Macros/IndentedEnd
|
||||
description: \end line starting with whitespace ends a macro body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
@ -0,0 +1,16 @@
|
||||
title: Macros/MismatchedNamedEnd
|
||||
description: Mismatched named end is part of the body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define hello()
|
||||
\end goodbye
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: \end goodbye</p>
|
@ -0,0 +1,18 @@
|
||||
title: Macros/WhitespaceOnlyWithEnd
|
||||
description: The /end should be detected when macro definition contains only whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define max()
|
||||
\end
|
||||
Nothing
|
||||
\end
|
||||
|
||||
Out: <<max>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Nothing
|
||||
\end</p><p>Out: </p>
|
@ -0,0 +1,15 @@
|
||||
title: Macros/WhitespaceOnlyWithEnd2
|
||||
description: Line with \end can start with whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\define empty()
|
||||
\end
|
||||
|
||||
Out: <<empty>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: </p>
|
16
editions/test/tiddlers/tests/data/procedures/EndInBody.tid
Normal file
16
editions/test/tiddlers/tests/data/procedures/EndInBody.tid
Normal file
@ -0,0 +1,16 @@
|
||||
title: Procedures/EndInBody
|
||||
description: \end line starting with non-whitespace is part of procedure body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
16
editions/test/tiddlers/tests/data/procedures/IndentedEnd.tid
Normal file
16
editions/test/tiddlers/tests/data/procedures/IndentedEnd.tid
Normal file
@ -0,0 +1,16 @@
|
||||
title: Procedures/IndentedEnd
|
||||
description: \end line starting with whitespace ends a procedure body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure hello()
|
||||
hello \end
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: hello \end</p>
|
@ -0,0 +1,16 @@
|
||||
title: Procedures/MismatchedNamedEnd
|
||||
description: Mismatched named end is part of the body
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure hello()
|
||||
\end goodbye
|
||||
\end
|
||||
|
||||
Out: <<hello>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: \end goodbye</p>
|
@ -0,0 +1,18 @@
|
||||
title: Procedures/WhitespaceOnlyWithEnd
|
||||
description: The /end should be detected when procedure definition contains only whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure max()
|
||||
\end
|
||||
Nothing
|
||||
\end
|
||||
|
||||
Out: <<max>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Nothing
|
||||
\end</p><p>Out: </p>
|
@ -0,0 +1,15 @@
|
||||
title: Procedures/WhitespaceOnlyWithEnd2
|
||||
description: Line with \end can start with whitespace
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\procedure empty()
|
||||
\end
|
||||
|
||||
Out: <<empty>>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Out: </p>
|
@ -5,6 +5,7 @@ author: 一个插件作者的姓名
|
||||
bag: 条目的来源集的名称
|
||||
caption: 显示于页签或按钮上的标题文字
|
||||
code-body: 若设置为 ''yes'',视图模板将以程式码形式显示条目
|
||||
class: 渲染条目时,套用到条目的 CSS 类别 - 请参阅[[依自订类别的自订样式|Custom styles by user-class]]。也适用于[[互动窗口|Modals]]
|
||||
color: 条目的 CSS 颜色值
|
||||
component: 负责[[提醒条目|AlertMechanism]]的组件名称
|
||||
core-version: 对于一个插件,表示与其兼容的 TiddlyWiki 版本
|
||||
|
@ -4,6 +4,7 @@ _canonical_uri: 外部圖片條目的完整的 URI
|
||||
author: 一個插件作者的姓名
|
||||
bag: 條目的來源集的名稱
|
||||
caption: 顯示於頁籤或按鈕上的標題文字
|
||||
class: 渲染條目時,套用到條目的 CSS 類別 - 請參閱[[依自訂類別的自訂樣式|Custom styles by user-class]]。也適用於[[互動視窗|Modals]]
|
||||
code-body: 若設定為 ''yes'',檢視範本將以程式碼形式顯示條目
|
||||
color: 條目的 CSS 顏色值
|
||||
component: 負責[[警示條目|AlertMechanism]]的元件名稱
|
||||
|
@ -1589,7 +1589,7 @@ html body.tc-body.tc-single-tiddler-window {
|
||||
grid-template-areas:
|
||||
"toolbar toolbar"
|
||||
"editor preview";
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: repeat(2, minmax(0px, 1fr));
|
||||
grid-template-rows: auto 1fr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user