I'm actually revisiting this now- as I ran into some odd truncation
problems with very large tiddlers.

Starting with Martin's exampleFormatter, there was a "paragraph" made
by finding all multiple repeat \n's and then:
createTiddlyElement(w.output,'p');
I think there's something different about tiddlywiki since this
example was created, because it looked ok visually, but not
semantically.

Semantically, every time there was a large block of empty space, a new
paragraph was created-- nested within the paragraph before.  I
discovered when stress testing with 10k paragraphs of lorem ipsum
text, that the tiddler only displayed the first 193 paragraphs.  Any
tiddler made of paragraphs would stop at 193.  I think this is the
depth limitation on nesting tags on my version of firefox or
something. Firebug's html output was just this HUGE stack of
<P><P><P>.....</P></P></P>.

My solution is to instead replace multiple consecutive \n's with:
createTiddlyElement(w.output,"span").innerHTML = "<p></p>";

This makes a kludgy looking <span><p></p></span> in between proper
"paragraphs" but it delivers very consistent spacing.  My custom
parser is based on txt2tags, which truncates multiple hard returns
into a new paragraph, block, etc.  I tried to adapt do using <br>'s,
but making that look remotely consistent just wasn't working-
especially when you have a paragraph starting after some tag that has
its own idea of "spacing" like <h1>.

On Fri, Oct 8, 2010 at 11:51 AM, Jeremy Ruston <[email protected]> wrote:
>> ====================
>> @core devs.
>> Is there a detailed description, how tw syntax parsing is done,
>> somewhere out there??
>> ====================
>
> Just the code, I'm afraid.
>
> When I first wrote TiddlyWiki the wikifier was very simple, it just
> handled wiki links. Here's the prerelease version (view source and
> search for the definition of the wikify function):
>
> http://www.osmosoft.com/talkytalky/twiddlywiki.html
>
> And here's the first version to be released, which also handled
> external HTML links:
>
> http://tiddlywiki.com/firstversion.html
>
> Sometime before the second version was released at the end of 2004, a
> chap called Isao Sonobe who was using TiddlyWiki at the Kyoto
> University Theoretical Physics Group very kindly contributed changes
> he had made to enrich TiddlyWiki with fuller formatting: bold,
> italics, tables, etc.
>
> At the time, TiddlyWiki still couldn't save changes, and so I still
> regarded it as a bit of a demo, and not important in it's own right.
> So, I folded Isao's code in pretty much untouched because it seemed to
> make the demo a little more useful.
>
> And then in April 2005 or so, we figured out how to make TiddlyWiki
> handle saving itself, and GTDTiddlyWiki was released, incorporating
> Isao's wikifier:
>
> http://nathanbowers.com/gtdtw/
>
> (Again, view source and search for the wikify() function)
>
> At this point I slowly realised that I had a bit of a problem: Isao's
> code needed refactoring to make it easier to extend and change, but
> worse than that, I'd accidentally selected a wiki format that I was
> stuck with. If I had known that TiddlyWiki was serious I'd have
> started out with the wiki syntax that I prefer personally (for example
> *bold* and /italic/).
>
> Anyhow, over the next few months I undertook a complete rewrite of the
> wikifier and formatters, to make them more extensible, and the code
> more maintainable. The results are pretty much what you see today in
> TiddlyWiki. I and other people like Martin Budden, have experimented
> with retrofitting <P> support but have concluded that it cannot be
> done in a backwards compatible manner. (But if anyone thinks otherwise
> I'd love to know about it).
>
> It's all very frustrating. I'm pretty proud of the wikifier code, but
> the syntax is sometimes unfortunate.
>
> Cheers
>
> Jeremy
>
> --
> Jeremy Ruston
> mailto:[email protected]
> http://www.tiddlywiki.com
>
> --
> 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.
>
>



-- 
David Young

-- 
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.

Reply via email to