TiddlyWiki5 icon indicating copy to clipboard operation
TiddlyWiki5 copied to clipboard

Docs: Remove ".if" macro

Open Jermolene opened this issue 1 year ago • 4 comments

There is a simple JavaScript macro that has been used in the documentation since 2015:

https://github.com/Jermolene/TiddlyWiki5/blob/master/editions/tw5.com/tiddlers/system/if-macro.js

It should now be possible to replace it with a wikitext construction.

Jermolene avatar Jul 30 '22 11:07 Jermolene

Yea, ... On the other hand from time to time users request an If-then-else construction similar to the condition plugin

It would be a convenience function instead of the need to use the list-widget.

pmario avatar Jul 30 '22 18:07 pmario

Yea, ... On the other hand from time to time users request an If-then-else construction similar to the condition plugin

Indeed, but such a thing belongs in the core, or its own plugin, and wouldn't be appropriate for this docs plugin.

Jermolene avatar Jul 31 '22 13:07 Jermolene

Indeed, but such a thing belongs in the core, or its own plugin, and wouldn't be appropriate for this docs plugin.

So should we create a PR using the condition plugin code?


As far as I can remember, the widgets have to follow a specific syntax pattern to work as intended. eg: JS syntax used to describe the problem

// the following syntax is OK

if (var === true) {
// do something
} else {
// do something else 
}

// The following syntax in _wrong_

if (var === ture) {
// do something
} 
var x = y;
else {
// do something else 
}

In JS it's clear, that we get a syntax error.

But the same problem happens if we use "faulty syntax" in wikitext, which would be a new behaviour.

<!-- this does work -->
<$list filter="false">
<!-- do something -->
</list>
<br>
<$else> <!-- do something --> </$else>

This is a difference in behaviour of widgets, since the else-widget needs to "find" it's related sibling. ... I'm only 90% sure that I got the problem right. ... The plugins where created in 2017 ...

pmario avatar Jul 31 '22 13:07 pmario

Indeed, but such a thing belongs in the core, or its own plugin, and wouldn't be appropriate for this docs plugin.

So should we create a PR using the condition plugin code?

Let's discuss a potential if/then/else solution in a new issue. All we need to worry about here is that we can refactor out the current usages of the .if macro.

Jermolene avatar Jul 31 '22 14:07 Jermolene