Hi Steve

Great stuff, very pleased you are have been making progress.

> And now the roadblock. Wikitext is not just the contents but also a set
of assembly instructions. A good example, and the heart of my problem, is
transclusion. When one tiddler is transcluded into another for the display,
its contents are merged into the tiddler being displayed without any
indication of its origin. In the displayed html, it is simply more text.
When the program derenders that the result is the wikitext for the original
tiddler and the transcluded one without any hint of the transclusion and so
the transclude command is lost. This sort of thing happens with several of
the twiddlywiki features like automatic lists, etc. This effect is
unacceptable as it does massive damage to the core concept of Tiddlywiki.

Intentionally, transclusion (and other widgets) do not have to emit DOM
nodes. This is necessary because in many situations HTML is very specific
about element nesting. For example, the <select> element requires that its
<option> elements are immediate children. If transclusion always produced,
say, a <div> element describing the transclusion, then it would be
impossible to transclude the <option> elements.

> My best idea on how to fix the problem requires Tiddlywiki to handle
transclusions slightly differently and as a result requires modifications
deeper and more fundamental to the code than I’m comfortable making.
Specifically, my idea is to make the html that results from the
transclusion look something like this:

Unfortunately, this would represent a major backwards compatibility break.

However, I do think that there is a workable approach.

The key is to understand how TiddlyWiki internally processes wikitext into
the DOM. There are three steps.

First, the wikitext is parsed into a tree that represents it's structure.
You can see a parse tree in the developer console like this:

$tw.wiki.parseTiddler("HelloThere").tree

Depending on your browser, it may be clearer to look at the formatted JSON
representation:

JSON.stringify($tw.wiki.parseTiddler("HelloThere").tree,null,4)

Secondly, the parse tree is rendered into the widget tree. The widget tree
is built up from the root widget object which you can see with:

$tw.rootWidget

Thirdly, each widget renders and updates DOM nodes as required.

I believe that the best approach for a WYSIWYG editor is to display a
formatted version of the parse tree within a contenteditable DIV. The parse
tree includes widgets like <$transclude>, which you may want to render in a
special way, with click handlers to allow popup editing. You'd also render
most HTML elements normally (eg, ul/li, bold etc).

I've got some code that does some of what is required: an unfinished
parse-tree widget that's intended to render a "pretty" version of the parse
tree corresponding to a specified tiddler. If I push the branch to GitHub
would you be able to use Node.js to build yourself an HTML file from it?

Best wishes

Jeremy.




On Thu, May 14, 2015 at 5:07 PM, 'Stephen Kimmel' via TiddlyWikiDev <
[email protected]> wrote:

> >This effect is unacceptable as it does massive damage to the core concept
>> of Tiddlywiki.
>>
>> What do you actually mean with "core concept" here?
>>
>
> A fundamental concept of TiddlyWiki is that it works with small pieces of
> information, ie Tiddlers, which can be easily rearranged and regrouped as
> desired either in the Tiddlers shown on the screen at any given moment or
> transcluded into what looks like a Tiddler. A routine that eliminates the
> temporary nature of transclusion and makes it permanent is almost the exact
> opposite of that understanding. That's what I meant.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywikidev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/7059d3fc-bc59-43df-adec-17e34a21dcd3%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywikidev/7059d3fc-bc59-43df-adec-17e34a21dcd3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAPKKYJb6K5zaaQq81YPRg3b_986jO75%2BsDYqQrikM4qQ3SGp_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to