On Sat, 2 Jul 2011, joearms wrote:

I hope I'm posting to the right group.

Yes, and I'm hoping someone besides me will respond, since my
experiences are from a fairly specific angle and more input would be
useful.

Looking in the js directory there are 58 files, so I'm not sure where
to start.

It's difficult because though the code is separated out into
individual files there are invisible interdependencies between them
and some globals that only play out when the collection is assembled
into a whole. The files give the illusion that they are modules of
some sort, but it just isn't true.

I would like to make a set of *minimal* examples to help me with this:

Suppose I *only* want to convert some simple wiki text to HTML and
render the result in a div - how many of these files do I have to include?

This is the task that I set out to accomplish when creating twikifier:

    https://github.com/cdent/twikifier

If you look in the README there and the early commit messages you'll
see the process I went through to figure out which files I ended up
needing to render wikitext to html. First without macros, then with
macros but without transclusion, and then with transclusions as well.
Since macros and transclusion are supported the resulting amount of
core code is more than would be needed without, but not _that_ much
more because there are plenty of dependencies in place that wouldn't
need to be if the code was designed in a modular way.

One of the main challenges was that I needed to construct some globals
and mock some data structures to get things rolling.

The result is some code that bookends a few of the tiddlywiki core JS
files in a function that generates a method that can be used to turn
text into wikitext. What I created is not at all elegant but I had two
constraints: I was in a big hurry and I wanted to use TiddlyWiki code
straight, without modifying it. The resulting code, operating as
nodejs server, is what creates the server-side html representations on
TiddlySpace.

Something that surprised me in the process is that the wikifier
doesn't take text and return html. It takes text and a dom element,
and fills that dom with HTML.

   function new_tiddler(){
     // define my own tiddler
     // do I just need the text and title?
     x = {text:" some tiddler content ",
          title:"My Tiddler"};
     $("#out").html(render(x));
   }

This is somewhat possible. I do something sort of like this here:

   http://twikifier-test.tiddlyspace.com/index.html

That loads tiddler.text and then passes it to a wikify function and
displays the HTML.

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

--
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To post to this group, send email to tiddlywikidev@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywikidev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.

Reply via email to