Wikify use case and trickery for tab-indented text

34 views
Skip to first unread message

Charlie Veniot

unread,
Jan 3, 2022, 11:32:07 AM1/3/22
to TiddlyWiki
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 !

Screenshot 2022-01-03 11.45.33 AM.png
Screenshot 2022-01-03 11.48.12 AM.png
Screenshot 2022-01-03 11.48.40 AM.png

Jeremy Ruston

unread,
Jan 3, 2022, 11:45:43 AM1/3/22
to tiddl...@googlegroups.com
Hi Charlie


On 3 Jan 2022, at 16:32, Charlie Veniot <cj.v...@gmail.com> wrote:

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

You can control how HTML displays whitespace with CSS:


Applying `white-space: pre;` should stop sequences of whitespace from being coalesced. It doesn’t help make tabs display better though.

Best wishes

Jeremy

Charlie Veniot

unread,
Jan 3, 2022, 12:04:01 PM1/3/22
to TiddlyWiki
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.

Reply all
Reply to author
Forward
0 new messages