1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-16 10:55:36 +00:00

wikiparser - some more adjustments for wikdgets that create DOM elements: button, radio, checkbox, link -- In HTML they are inline, but for backwards compatibility they need to be covered in P tags :/

This commit is contained in:
pmario 2024-03-15 22:22:49 +01:00
parent d794063cee
commit 8c9812ec9c
2 changed files with 33 additions and 5 deletions

View File

@ -244,15 +244,34 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
// return [{type: "element", tag: "p", children: children, start: start, end: end }];
var isP = false;
// $tw.utils.each(children, function(child) {
// if(child.type === "text" ||
// (($tw.config.htmlBlockElements.indexOf(child.tag) === -1) &&
// child.tag && child.tag.charAt(0) !== "$") ) {
// isP = true;
// }
// });
$tw.utils.each(children, function(child) {
if (child.type === "text" ||
if(child.type === "text" ||
(($tw.config.htmlBlockElements.indexOf(child.tag) === -1) &&
child.tag && child.tag.charAt(0) !== "$")) {
child.tag && child.tag.charAt(0) !== "$") ||
(child.type === "button") ||
(child.type === "radio") ||
(child.type === "link") ||
(child.type === "checkbox") ) {
isP = true;
}
});
if (isP) {
// $tw.utils.each(children, function(child) {
// if(child.type === "text" ||
// (($tw.config.htmlBlockElements.indexOf(child.tag) === -1) ) ) {
// isP = true;
// }
// });
if(isP) {
return [{type: "element", tag: "p", children: children, start: start, end: end }];
}
else {

View File

@ -1,5 +1,5 @@
created: 20221123151255885
modified: 20221123151420696
modified: 20240315205833043
tags:
title: power Operator-todo
type: text/vnd.tiddlywiki
@ -8,4 +8,13 @@ type: text/vnd.tiddlywiki
text and links .. all text is widget created ... Investigate in more detail. vertical spacing
''have a closer look at the DOM structure''
''have a closer look at the DOM structure''
`.operator-examples` is implemented like this:
```
\procedure .operator-examples(op,text:"Examples") <$link to=`$(op)$ Operator (Examples)`><<text>></$link>
```
So it is implemented as an `<a>` element which is "inline". So if `<<.operator-examples "power">> ` is followed by a space it will add a paragraph -- hmmm