On Sun, Jul 3, 2011 at 1:02 PM, <[email protected]> wrote: > 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.
Oh dear - are there any efforts underway to fix this? Abstraction seepage through globals is a nightmare in javascript. It would be really nice if the basic wikiText -> HTML (etc) were structured as a jQuery plugin. > >> 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. Are you saying that macro expansion is interleaved with wiki text expansion and not as a pre-processor step? > 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. Oh - I had been looking for such a function. I had imagined a function render(wikistring) that returned an html string. I had also imagined that adding macros was orthogonal to this. ie to expand a wikitext with macros one just scanned the text looking for a macro then replaced the macro with the expansion text then called render. > >> 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. Thanks - I viewed the source - most of the magic is in twikifier.js. I shall have to hack a bit ... /Joe > > -- > 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 [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.
