Processing the text field a line at a time

74 views
Skip to first unread message

TonyM

unread,
Jul 5, 2018, 12:14:40 AM7/5/18
to TiddlyWiki
Folks,

In part inspired by the Tiddler internal TOC question I was wondering if there is a method to;

Process the text field a line at a time?

I realise this is in someways possible with datatiddlers, but I am interested in a filter or other method that would return each line of a text tiddler, delimited by new line or <br> as appears in the edit tiddler view.

A list filter to do this on a tiddlers text (or other) field would 
  • Without intervention, display the whole tiddler as it would be seen in edit mode.
  • Wikifying each line would not always make sense as many WikiText items use more than one line
  • Using the limit[5] would show the first 5 lines of a tiddler (un wikified)
  • Each line can be subsequently filtered according to its content such as heading, comments and other string tests
    • Is this string testing actually possible? perhaps with search operator on the resulting text, or listops?
    • For example lines beginning with "!" could be filtered out and then wikifyed to provide a visual list of headings in this tiddler
    • Any other text could be used to generate custom views eg 
      • <$list </$list <$set </$set <$vars </$vars etc... to show the code structure.
      • A convention ".q" ".a" could be used to list questions and answers lines and get a css class to boot.
  • Such a feature will allow for a rudimentary parsing and more sophisticated treatment of the text field content.
  • Perhaps this could be used to support append/pre-pend to the text field allowing log and other tiddlers.
it must be happening in the CodeMirror plugin

If no solution exists I will raise a GitHub Issue.

Thank in advance
Tony


BurningTreeC

unread,
Jul 5, 2018, 7:51:39 AM7/5/18
to TiddlyWiki
Hi @TonyM,

I've extended the "get" filter recently - see here

I haven't tested it that much yet, but it returns line by line using the syntax:

get:lines[text]


BTC

TonyM

unread,
Jul 5, 2018, 8:48:05 AM7/5/18
to TiddlyWiki
Thanks BTC

I will review in 12+ Hours (Tomorrow Morning)

This is personally yet another game changer, if I can use it as planned

More detailed examination of the content of the Text field will allow much richer access to that content, and its manipulation.

Rehards
Tony

Mark S.

unread,
Jul 5, 2018, 11:02:51 AM7/5/18
to TiddlyWiki

Could probably also be done using the regexpression string extractor (PR #2963).

--- Mark
Reply all
Reply to author
Forward
0 new messages