Formatting is handled by the wikifier object, see: https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Wikifier.js
During wikification the subwikify function is called - this loops through the tiddler text using a regular expression to find text that matches the formatter match text - when a match is found the corresponding handler function is called. The loop uses a few variables to keep track of where it is in the text, matchStart, nextMatch etc - these variables are updated every time a match is found. Martin On 6 September 2011 15:19, Yakov <[email protected]> wrote: > Let's consider a simple formatter: the LineBreakPlugin v0.1 (by axs, > more recent version is in [1]): > > config.formatters.splice(config.formatters.findByField("name","lineBreak"), > 0,{ > name: 'doubleLineBreak', > match: '\\n{2,}', > handler:function(w){ > > createTiddlyElement(w.output,'div',null,'multipleLinebreak').innerHTML=" "; > } > }); > setStylesheet(store.getTiddlerText('LineBreakPlugin##Style'),'MultipleLineBreak'); > > Ok, basically we have a name, a match and a handler for each > formatter. What looks unclear for me is that how the handler is > applied. For each tiddler we have tiddler.text. Now, are the > formatters applied sequentially? If so, what is the intermediate > result (after the first formatter is applied)? I guess it couldn't be > just test since we have that createTiddlyElement which should create > some DOM element (right?). At the same time, it couldn't be already > DOM (can it?) since we still have text to be formatted. > > And in which .js part of the tw core [2] those formatters are applied? > > [1] http://axs.tiddlyspot.com/#LineBreakPlugin > [2] https://github.com/TiddlyWiki/tiddlywiki/tree/master/js > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWikiDev" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/tiddlywikidev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
