Open twMat opened 1 year ago
That's interesting. IMO we'll need to do some experiments. I do not know, where it comes from atm. But it seems to be a bug
For a solution, my spontaneous thought is to require that the triple braces are directly next to one another without any characters in between.
I think the following image shows that when the filtered transclusion is a block (example 2) then first }
just to the right of xxx
is treated as content inside the filtered transclusion. But in the third case below, when inline, the filtered trans works as expected and the very last }
is treated as outside.
In my testing, it seems a space at the end of the first line after the transclusion "invites" all the problems that follow
Note the space end of first line.
Output:
Remove the space...
Output:
@CodaCodr this also causes fautly output tho, IMO:
{{{ [[any filter]] }}
xxx
}
I think there is something wrong with the parser regexp. I'll have a closer look when I have time.
According to the core js code "Filtered Transclusions" should work like this:
Wiki text rule for block-level filtered transclusion. For example:
{{{ [tag[docs]] }}}
{{{ [tag[docs]] |tooltip}}}
{{{ [tag[docs]] ||TemplateTitle}}}
{{{ [tag[docs]] |tooltip||TemplateTitle}}}
{{{ [tag[docs]] }}width:40;height:50;}.class.class
The title: $:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js regexp is as follows:
There are 2 test for filtered transclusions that only cover the first possibility.
and it seems to have a problem in "caption group 1" already, because match[1] is [[any filter]] }
-- See the trailing }
which should not be there.
more tests will follow
PR is on the way.
PR is on the way.
I have been to enthusiastic. :/
@Jermolene ... The problem is caused by the trailing whitespace character after the closing braces }}}
in the OP. Any other "trailing" character has the same effect. eg: {{{ [[any filter]] }}}a
The reason is, that with a trailing character the last 2 braces }}
and the following text match group 4 -- The first closing brace }
will be added to match group 1
}
in the text that follows.From a pragmatic point of view a trailing character makes the whole text block an inline filtered transclusion. .. BUT since the block-rule creates some valid matches it does not switch to the inline parser.
I do have some ideas, but all of them are only partial solutions.
@Jermolene -- This one is ready for review now.
related to: [Bug] Pipe characters ruin triple brace evaluation #4462
Describe the bug
Typing in the following on tiddlywiki.com or any other TW
...outputs this:
If the last brace is removed, the output seems correct.
To my surprise I get the faulty behavious regardless of TW version. (How has this possibly passed????)
I discovered it in a more subtle context, with a totally natural and syntactically correct succeeding brace:
output
TiddlyWiki Configuration
Tested on both Chrome and FF
and on TW latest and several older versions