1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Fixed issue where $genesis didn't pass isBlock (#7230)

* Fixed issue where $genesis didn't pass isBlock

* Added $mode attribute for genesis

* Added documentation for $mode attribute
This commit is contained in:
Cameron Fischer 2023-02-10 05:17:32 -05:00 committed by GitHub
parent 81f5141166
commit 028dfe39b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 0 deletions

View File

@ -46,6 +46,7 @@ GenesisWidget.prototype.execute = function() {
this.genesisRemappable = this.getAttribute("$remappable","yes") === "yes";
this.genesisNames = this.getAttribute("$names","");
this.genesisValues = this.getAttribute("$values","");
this.genesisIsBlock = this.getAttribute("$mode",this.parseTreeNode.isBlock && "block") === "block";
// Do not create a child widget if the $type attribute is missing or blank
if(!this.genesisType) {
this.makeChildWidgets(this.parseTreeNode.children);
@ -60,6 +61,7 @@ GenesisWidget.prototype.execute = function() {
tag: nodeTag,
attributes: {},
orderedAttributes: [],
isBlock: this.genesisIsBlock,
children: this.parseTreeNode.children || [],
isNotRemappable: !this.genesisRemappable
}];

View File

@ -0,0 +1,30 @@
title: Genesis/Block
description: genesis widget distinguishes between block and inline
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$genesis $type="$reveal" type=nomatch>
Block
</$genesis>
<$genesis $type="$reveal" type=nomatch $mode=block>
Block forced block
</$genesis>
<$genesis $type="$reveal" type=nomatch $mode=inline>
Block forced inline
</$genesis>
<$genesis $type=$reveal type=nomatch>Inline</$genesis>
<$genesis $type=$reveal type=nomatch $mode=block>Inline forced block</$genesis>
<$genesis $type=$reveal type=nomatch $mode=inline>Inline forced inline</$genesis>
+
title: ExpectedResult
<div class=" tc-reveal"><p>Block</p></div><div class=" tc-reveal"><p>Block forced block</p></div><span class=" tc-reveal"><p>Block forced inline</p></span><p><span class=" tc-reveal">Inline</span><div class=" tc-reveal">Inline forced block</div><span class=" tc-reveal">Inline forced inline</span></p>

View File

@ -17,6 +17,7 @@ The content of the <<.wid genesis>> widget is used as the content of the dynamic
|$type |The type of widget or element to create (an initial `$` indicates a widget, otherwise an HTML element will be created) |
|$names |An optional filter evaluating to the names of a list of attributes to be applied to the widget |
|$values |An optional filter evaluating to the values corresponding to the list of names specified in <<.attr $names>> |
|$mode |An optional override of the parsing mode. May be "inline" or "block" |
|//{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 applied as attributes to the output widget, but with the attribute name changed to use a single dollar sign |
|//{attributes not starting with $}// |Any other attributes that do not start with a dollar are applied as attributes to the output widget |