From 9aaab87b87638baf381486ecec171cd0b9539541 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 23 Jan 2026 22:23:48 +0000 Subject: [PATCH] Initial Commit --- core/modules/widgets/element.js | 5 +++++ .../tests/data/element-mapping/Basic.tid | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 editions/test/tiddlers/tests/data/element-mapping/Basic.tid diff --git a/core/modules/widgets/element.js b/core/modules/widgets/element.js index 8b0a88e86..635ef9d3e 100755 --- a/core/modules/widgets/element.js +++ b/core/modules/widgets/element.js @@ -42,6 +42,11 @@ ElementWidget.prototype.render = function(parent,nextSibling) { headingLevel = Math.min(Math.max(headingLevel + 1 + baseLevel,1),6); this.tag = "h" + headingLevel; } + // Check for element mapping + var mappedTag = this.getVariable("tv-map-" + this.tag); + if(mappedTag) { + this.tag = mappedTag.trim(); + } // Select the namespace for the tag var XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml", tagNamespaces = { diff --git a/editions/test/tiddlers/tests/data/element-mapping/Basic.tid b/editions/test/tiddlers/tests/data/element-mapping/Basic.tid new file mode 100644 index 000000000..8d0088745 --- /dev/null +++ b/editions/test/tiddlers/tests/data/element-mapping/Basic.tid @@ -0,0 +1,18 @@ +title: ElementMapping/Basic +description: Mapping one element to another +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\whitespace trim + + +\define tv-map-p() div + +This is a paragraph + ++ +title: ExpectedResult + +
This is a paragraph
\ No newline at end of file