[tw5] Wikify use case and trickery for tab-indented text

Latest version of BASIC Anywhere Machine.

There is some good stuff here, I think, for TiddlyWiki code studying. More seasoned TiddlyWiki folk: please, if you have suggestions for simplifying the code, let me know.

The TiddlyWiki CodeMirror plugin handles indentation with either spaces or tabs like a champ.

However, spaces and tabs are problematic for the “Wikify Viewer” tool because HTML ignores whitespace (spaces and tabs), i.e. whitespace is not rendered.

  • BTW, the “Wikify Viewer” tool is to take the current BASIC program and show it with rendered transclusions.

Although both space and tab rendering can be resolved with text-replacement trickery, I’ve decided to setup the “Wikify Viewer” to only recognize tabs for the purpose of indentation.

(Since distinguishing spaces meant as indentation from spaces meant for other things is a pain. Tabs can’t be used for anything else in wwwBasic, so that makes things easier.)

One of the attached screenshots shows how the Wikify Viewer handles the display of transcluded code, including the handling of tab indents in that transcluded code.

The other attached screenshots show that I’ve gone through a few hoops to get this working.

Cheers and Happy 2022 !

Hi Charlie

G’day Jeremy,

That I did not know. Thank-you much!

I’m thinking overall safer to stick with tabs for indentation.

Well, that’s the knee-jerk instinct. To be chewed on via subconscious paralysis by analysis.