Open tobibeer opened 9 years ago
I'm open to making improvements to the functionality of the TWC upgrade button. The tricky bit, as you've spotted, is figuring out a safe, useful set of rules for the upgrade.
figuring out a safe, useful set of rules for the upgrade
indeed ...I guess, it really asks for a bit of a pseudo-tw2-parser of some sorts, urgh :)
maybe, there are some (more) catchy quick wins after all...
I guess, it really asks for a bit of a pseudo-tw2-parser of some sorts, urgh :)
Yes, and of course we've already got a real tw2parser plugin.
I still think that a simple heuristic based on doubling up every line break is a reasonable starting point for the "upgrade" button.
I still think that a simple heuristic based on doubling up every line break is a reasonable starting point for the "upgrade" button.
I think not, because there are too many exceptions to that rule. However, once a workable matching pattern is figured out, better do...
"""
hard
line
breaks
"""
...which will also teach users that that actually exists.
Background: Viewing a tiddler of type "text/x-tiddlywiki" (ie TiddlyWiki Classic format) offers a button labelled "upgrade" that if clicked just changes the type of the tiddler to "text/vnd.tiddlywiki" (ie TiddlyWiki5 format).
This was about to start as a request for the upgrade button to account for the new linebreak handling, which is very different from TWc where literal linebreaks are treated as such. Turns out this can't quite be separated from the overall upgrade process.
Anyhow, to account for old linebreaks, perhaps
<br>
need to be introduced for every hard linebreak\n
that is not preceded by any of...<br>
<br/>
<br />
...and followed by a non-block-producing set of characters.
Starting a newline, block producing characters in TWc are...
!
*
#
;
:
|*?|\n
>
{{{\n
<<<\n
----
Plenty cases are definitely non-trivial and need to be skipped or processed differently...
<<macro definitions>>
, e.g. as were used for tabs<html> ... </html>
blocks — unwrapped?<script> ... </script>
tags — removed?\n{{{\n .... \n}}}\n
multiline code blocks need to be left untouched and converted/% hidden comment %/
— tw5?Background
I just discovered that button as I tried to imported Mario's hangout notes into a TW5... the result of which is a lot of non-existend linebreaks. #1110 1110