TiddlyWiki5
TiddlyWiki5 copied to clipboard
[BUG] Links generate by --render do not match the filenames.
Describe the bug
I think this is a bug, because I can't see what I'm doing wrong. I notice that with --rendertiddlers
, the links wind up double-encoded. For example, https://tiddlywiki.com/static/Philosophy%2520of%2520Tiddlers.html points to a file generated with the name Philosophy%20of%20Tiddlers.html
, which then in the href
becomes Philosophy%2520of%2520Tiddlers.html
. This double encoding is odd, but it's consistent, so the links work.
However, with --render
the links are always double-encoded as above with an .html
suffix, regardless of the filename filter, including the default, so that the tiddlers don't properly link to one another.
For example, I created a Test tiddler
with content This is [[Test tiddler]].
and ran,
tiddlywiki tids/ --render '[[Test tiddler]]' '' text/plain '$:/core/templates/static.tiddler.html'
It creates a file output/Test tiddler.html
, but the source includes this HTML:
<a class="tc-tiddlylink tc-tiddlylink-resolves" href="Test%2520tiddler.html">Test tiddler</a>
This is a broken link, because it should be href="Test%20tiddler.html"
.
Thus, generating a static website with this command does not work.
My own use case involves changing the filename filter for --render
. This correctly changes the filenames, but the links are still the same.
Expected behavior
I would expect the <a href="">
links to match the derived filename, as specified in the filename filter of --render
(or the default).
To Reproduce
One example is above. But here is one with a specified filename filter:
- Create a tiddler
Test
with the contentThis is [[Test]].
. - Run
tiddlywiki tids/ --render '[[Test]]' '[is[tiddler]addsuffix[.htm]]' text/plain '$:/core/templates/static.tiddler.html'
(note.htm
instead of.html
). - Look at the source of
output/Test.htm
. - It has
<a class="tc-tiddlylink tc-tiddlylink-resolves" href="Test.html">
, which is not correct.
The only thing I can do is,
tiddlywiki tids/ --render '[[Test tiddler]]' '[search-replace:g:[ ],[%20]addsuffix[.html]]' 'text/plain' '$:/core/templates/static.tiddler.html'
to force the filenames to match what the links will be.
Screenshots
No response
TiddlyWiki Configuration
- Version 5.2.2
Not using the browser.
Additional context
No response
hear is a perhaps related/relevent explanation of one ocurence of "double encoding" in tw
https://github.com/Jermolene/TiddlyWiki5/issues/4594#issuecomment-619514635