mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-11-04 09:33:00 +00:00 
			
		
		
		
	Add fillignore attribute to transclude widget to fix visible transclusion (#7451)
* slotignore attribute for transclude widget to fix visible transclusion Fixes #7449 * Remove unneeded depth attribute No longer needed * Replace "slotignore" by "fillignore"
This commit is contained in:
		@@ -48,7 +48,7 @@ SlotWidget.prototype.execute = function() {
 | 
				
			|||||||
	var pointer = this.parentWidget,
 | 
						var pointer = this.parentWidget,
 | 
				
			||||||
		depth = this.slotDepth;
 | 
							depth = this.slotDepth;
 | 
				
			||||||
	while(pointer) {
 | 
						while(pointer) {
 | 
				
			||||||
		if(pointer instanceof TranscludeWidget) {
 | 
							if(pointer instanceof TranscludeWidget && pointer.hasVisibleSlots()) {
 | 
				
			||||||
			depth--;
 | 
								depth--;
 | 
				
			||||||
			if(depth <= 0) {
 | 
								if(depth <= 0) {
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -384,6 +384,13 @@ TranscludeWidget.prototype.getTransclusionSlotFill = function(name,defaultParseT
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					Return whether this transclusion should be visible to the slot widget
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					TranscludeWidget.prototype.hasVisibleSlots = function() {
 | 
				
			||||||
 | 
						return this.getAttribute("$fillignore","no") === "no";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
 | 
					Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,15 +30,15 @@ Block transclusions are shown in red, and inline transclusions are shown in gree
 | 
				
			|||||||
				<!-- Look for a parameter starting with $ to determine if we are in legacy mode -->
 | 
									<!-- Look for a parameter starting with $ to determine if we are in legacy mode -->
 | 
				
			||||||
				<$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage="""
 | 
									<$list filter="[<@params>jsonindexes[]] :filter[<currentTiddler>prefix[$]] +[limit[1]]" variable="ignore" emptyMessage="""
 | 
				
			||||||
					<!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode -->
 | 
										<!-- Legacy mode: we render the transclusion without a dollar sign for recursionMarker and mode -->
 | 
				
			||||||
					<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>>>
 | 
										<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" recursionMarker="no" mode=<<mode>> $$fillignore="yes">
 | 
				
			||||||
						<!-- Reach back up to the grandparent transclusion to get the correct slot value -->
 | 
											<!-- Reach back up to the grandparent transclusion to get the correct slot value -->
 | 
				
			||||||
						<$slot $name="ts-raw" $depth="2"/>
 | 
											<$slot $name="ts-raw"/>
 | 
				
			||||||
					</$genesis>
 | 
										</$genesis>
 | 
				
			||||||
				""">
 | 
									""">
 | 
				
			||||||
					<!-- Non-legacy mode: we use dollar signs for the recursionMarker and mode -->
 | 
										<!-- Non-legacy mode: we use dollar signs for the recursionMarker and mode -->
 | 
				
			||||||
					<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>>>
 | 
										<$genesis $type="$transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget<currentTiddler>]" $$recursionMarker="no" $$mode=<<mode>> $$fillignore="yes">
 | 
				
			||||||
						<!-- Reach back up to the grandparent transclusion to get the correct slot fill value -->
 | 
											<!-- Reach back up to the grandparent transclusion to get the correct slot fill value -->
 | 
				
			||||||
						<$slot $name="ts-raw" $depth="2"/>
 | 
											<$slot $name="ts-raw"/>
 | 
				
			||||||
					</$genesis>
 | 
										</$genesis>
 | 
				
			||||||
				</$list>
 | 
									</$list>
 | 
				
			||||||
			</$genesis>
 | 
								</$genesis>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ The content of the <<.wlink SlotWidget>> widget is used as a fallback for the sl
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
|!Attribute |!Description |
 | 
					|!Attribute |!Description |
 | 
				
			||||||
|$name |The name of the slot being defined |
 | 
					|$name |The name of the slot being defined |
 | 
				
			||||||
|$depth |Optional number indicating how deep the <<.wlink SlotWidget>> widget is compared to the matching <<.wlink FillWidget>> widget as measured by the number of nested transclude widgets (defaults to 1) |
 | 
					|$depth |Optional number indicating how deep the <<.wlink SlotWidget>> widget is compared to the matching <<.wlink FillWidget>> widget as measured by the number of nested transclude widgets (defaults to 1). Transclude widgets whose <<.attr $fillignore>> attribute is set to ''yes'' are ignored, and do not affect the depth count |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
! Examples
 | 
					! Examples
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,6 +51,7 @@ Modern mode is recommended for use in new applications.
 | 
				
			|||||||
|$type |– |Optional ContentType used when transcluding variables, indexes or fields other than the ''text'' field|
 | 
					|$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`) |
 | 
					|$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'') |
 | 
					|$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 |
 | 
					|//{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 |
 | 
					|//{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 |
 | 
					|//{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 |
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user