Formatter that doesn't eat away characters

17 views
Skip to first unread message

Tobias Beer

unread,
Mar 16, 2012, 2:21:50 PM3/16/12
to TiddlyWikiDev
Hey everyone,

I am trying to construct a formatter that neither eats the match nor
that of the terminating regex. Any suggestions on what to do?

Also, I find myself quite unable to understand where in the process
the wikifier is triggered matching the text against any formatters. I
keep running circles from displayTiddler, over refreshTiddler, some
awkward getRecursiveTiddlerText chucking stuff into some innerHTML and
back to square 1 ...but I can't figure out how this whole procees
works.

Would there be any activity style diagrams that help in that respect?
It's quite hard to believe anyone actually understands all this
without any form of illustration.

tb

chris...@gmail.com

unread,
Mar 19, 2012, 9:21:29 AM3/19/12
to TiddlyWikiDev
On Fri, 16 Mar 2012, Tobias Beer wrote:

> Also, I find myself quite unable to understand where in the process
> the wikifier is triggered matching the text against any formatters. I
> keep running circles from displayTiddler, over refreshTiddler, some
> awkward getRecursiveTiddlerText chucking stuff into some innerHTML and
> back to square 1 ...but I can't figure out how this whole procees
> works.

Yeah, I had a similar reaction when creating twikifier[1] and
eventually gave up trying to understand the thing and just built up
everything around it that it demanded. The result is a bunch of messy
spaghetti that I don't understand...

From my experiments with tw5ikifier[2] I can say that the TiddlyWiki5
code is somewhat more graspable.

Sorry you're not getting a more helpful answer...

[1] http://github.com/cdent/twikifier
[2] https://github.com/cdent/tw5ikifier

--
Chris Dent http://burningchrome.com/
[...]

Ben Gillies

unread,
Mar 19, 2012, 9:34:17 AM3/19/12
to tiddly...@googlegroups.com
> Also, I find myself quite unable to understand where in the process
> the wikifier is triggered matching the text against any formatters. I
> keep running circles from displayTiddler, over refreshTiddler, some
> awkward getRecursiveTiddlerText chucking stuff into some innerHTML and
> back to square 1 ...but I can't figure out how this whole procees
> works.

I believe (though I could be wrong), that the wikifier is triggered in
the view macro[1]. I believe the formatters are triggered in the
SubWikifyTerm function[2].


Basically, the wikifier is called, sometimes recursively, and at each
step the formatters directly add stuff to the DOM element passed in
while any matching regexp consumes some text (if that text needs
wikifying, then it is passed into SubWikify (the recursive bit), which
starts the process over again on the small subset of text). When there
is no more text left to wikify, it's done.


Ben

[1] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Macros.js#L449
[2] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Wikifier.js#L145

Tobias Beer

unread,
Mar 20, 2012, 6:53:24 PM3/20/12
to TiddlyWikiDev
Thank you both for your input...

I have done some initial coding and wrote down some thoughts here...
http://hashtags.tiddlyspace.com

Perhaps you can take a look at the formatter at the bottom of...
http://hashtags.tiddlyspace.com/#HashTagsPlugin

...and ponder for a moment on how to make it behave such as to not
remove what is supposed to merely be highlighted.

I just noticed... perhaps, if someone could explain how to reduce
TiddlySpaceLinkPlugin and [[Link text|Tiddler Title]]@space so that I
am merely able to match #hashtag ...that would be of quite some help
as it basically can't basically be all that different from what I am
trying to achieve.

Thanks, Tobias.

Tobias Beer

unread,
Mar 20, 2012, 6:55:22 PM3/20/12
to TiddlyWikiDev
Could someone explain what the spacenameLink formatter does in detail?

Thanks.
Message has been deleted

Tobias Beer

unread,
Mar 22, 2012, 5:23:13 PM3/22/12
to TiddlyWikiDev
Well, I built said formatter on the basis of what...

TiddlySpaceLinkPlugin implements for spacenameLink @system-plugins

...and it seems to be working right.


Looks like I can move on with the plugin :-D

http://hashtags.tiddlyspace.com


tb
Reply all
Reply to author
Forward
0 new messages