kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Remove tooltip, classes and styles from transclusion syntax
Now that transclusion doesn't generate any intrinsic elements we don't have an element to attach the tooltip, classes and styles to.print-window-tiddler
rodzic
a4783a2c19
commit
04e2f18ff1
|
@ -7,10 +7,7 @@ Wiki text rule for block-level transclusion. For example:
|
|||
|
||||
```
|
||||
{{MyTiddler}}
|
||||
{{MyTiddler|tooltip}}
|
||||
{{MyTiddler||TemplateTitle}}
|
||||
{{MyTiddler|tooltip||TemplateTitle}}
|
||||
{{MyTiddler}width:40;height:50;}.class.class
|
||||
```
|
||||
|
||||
\*/
|
||||
|
@ -26,7 +23,7 @@ exports.types = {block: true};
|
|||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|([^\|\{\}]+))?(?:\|\|([^\|\{\}]+))?\}([^\}]*)\}(?:\.(\S+))?(?:\r?\n|$)/mg;
|
||||
this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|\|([^\|\{\}]+))?\}\}(?:\r?\n|$)/mg;
|
||||
};
|
||||
|
||||
exports.parse = function() {
|
||||
|
@ -38,10 +35,7 @@ exports.parse = function() {
|
|||
targetTitle = tr.title,
|
||||
targetField = tr.field,
|
||||
targetIndex = tr.index,
|
||||
tooltip = this.match[2],
|
||||
template = $tw.utils.trim(this.match[3]),
|
||||
style = this.match[4],
|
||||
classes = this.match[5];
|
||||
template = $tw.utils.trim(this.match[2]);
|
||||
// Prepare the transclude widget
|
||||
var transcludeNode = {
|
||||
type: "element",
|
||||
|
@ -66,15 +60,6 @@ exports.parse = function() {
|
|||
if(targetIndex) {
|
||||
transcludeNode.attributes.index = {type: "string", value: targetIndex};
|
||||
}
|
||||
if(tooltip) {
|
||||
transcludeNode.attributes.tooltip = {type: "string", value: tooltip};
|
||||
}
|
||||
if(style) {
|
||||
transcludeNode.attributes.style = {type: "string", value: style};
|
||||
}
|
||||
if(classes) {
|
||||
transcludeNode.attributes["class"] = {type: "string", value: classes.split(".").join(" ")};
|
||||
}
|
||||
return [tiddlerNode];
|
||||
};
|
||||
|
||||
|
|
|
@ -7,10 +7,7 @@ Wiki text rule for inline-level transclusion. For example:
|
|||
|
||||
```
|
||||
{{MyTiddler}}
|
||||
{{MyTiddler|tooltip}}
|
||||
{{MyTiddler||TemplateTitle}}
|
||||
{{MyTiddler|tooltip||TemplateTitle}}
|
||||
{{MyTiddler}width:40;height:50;}.class.class
|
||||
```
|
||||
|
||||
\*/
|
||||
|
@ -26,7 +23,7 @@ exports.types = {inline: true};
|
|||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|([^\|\{\}]+))?(?:\|\|([^\|\{\}]+))?\}([^\}]*)\}(?:\.(\S+))?/mg;
|
||||
this.matchRegExp = /\{\{([^\{\}\|]+)(?:\|\|([^\|\{\}]+))?\}\}/mg;
|
||||
};
|
||||
|
||||
exports.parse = function() {
|
||||
|
@ -38,10 +35,7 @@ exports.parse = function() {
|
|||
targetTitle = tr.title,
|
||||
targetField = tr.field,
|
||||
targetIndex = tr.index,
|
||||
tooltip = this.match[2],
|
||||
template = $tw.utils.trim(this.match[3]),
|
||||
style = this.match[4],
|
||||
classes = this.match[5];
|
||||
template = $tw.utils.trim(this.match[2]);
|
||||
// Prepare the transclude widget
|
||||
var transcludeNode = {
|
||||
type: "element",
|
||||
|
@ -64,15 +58,6 @@ exports.parse = function() {
|
|||
if(targetIndex) {
|
||||
transcludeNode.attributes.index = {type: "string", value: targetIndex};
|
||||
}
|
||||
if(tooltip) {
|
||||
transcludeNode.attributes.tooltip = {type: "string", value: tooltip};
|
||||
}
|
||||
if(style) {
|
||||
transcludeNode.attributes.style = {type: "string", value: style};
|
||||
}
|
||||
if(classes) {
|
||||
transcludeNode.attributes["class"] = {type: "string", value: classes.split(".").join(" ")};
|
||||
}
|
||||
return [tiddlerNode];
|
||||
};
|
||||
|
||||
|
|
|
@ -86,19 +86,13 @@ This will be monospaced
|
|||
You can incorporate the content of one tiddler within another using the transclusion notation:
|
||||
|
||||
* `{{MyTiddler}}` transcludes a single tiddler
|
||||
* `{{MyTiddler|tooltip}}` adds a tooltip
|
||||
* `{{MyTiddler||TemplateTitle}}` displays the tiddler through a specified [[TiddlerTemplate|TiddlerTemplates]]
|
||||
* `{{MyTiddler|tooltip||TemplateTitle}}` specifies both a tooltip and a template for the transcluded content
|
||||
* `{{MyTiddler}width:40;height:50;}.firstClass.secondClass` transcludes a single tiddler, adding the specified styles and classes to the transcluded content
|
||||
|
||||
A similar syntax can be used to transclude a list of tiddlers matching a specified [[TiddlerFilter|TiddlerFilters]]:
|
||||
|
||||
```
|
||||
{{{ [tag[mechanism]] }}}
|
||||
{{{ [tag[mechanism]] |tooltip}}}
|
||||
{{{ [tag[mechanism]] ||TemplateTitle}}}
|
||||
{{{ [tag[mechanism]] |tooltip||TemplateTitle}}}
|
||||
{{{ [tag[mechanism]] }}width:40;height:50;}.class.class
|
||||
```
|
||||
|
||||
! Images
|
||||
|
@ -244,8 +238,6 @@ Here an attribute is specified as a macro invocation:
|
|||
<a href=<<MyMacro "Brian">>>link</a>
|
||||
```
|
||||
|
||||
* As a macro invocation
|
||||
|
||||
! Widgets
|
||||
|
||||
Widgets provide rich functionality within WikiText. For example, the `<$video>` widget can be used to embed videos from YouTube, Vimeo or the Internet Archive:
|
||||
|
|
Ładowanie…
Reference in New Issue