Hi David

Apologies for the late reply, I missed this yesterday.


> Well the problem tonight is getting the wiki table commands to render ..
>
> var parser;
> var text;
> var templateParseTree;
>
> text = "|test1|test2|\n";
> text += "|test3|test4|\n";
> text += "|test5|test6|\n";
>
> parser =
> this.renderer.renderTree.wiki.parseText("text/vnd.tiddlywiki",text,{parseAsInline:
> !this.renderer.parseTreeNode.isBlock});
> templateParseTree = parser.tree;
> this.children =
> this.renderer.renderTree.createRenderers(this.renderer,templateParseTree);
>
> Thr above code produces a table .. as long as more text is added to the
> tiddler after the <$djtest/> tag
>

Parsing in TW5 works in two modes: block mode (where tables, headings etc
are recognised) and inline mode (where the markup that's legal in a heading
or table cell is recognised).

Ordinarily, if a widget or HTML element is at the start of a paragraph
block, and the opening tag is immediately followed by a newline, then you
get block mode parsing of its content. Otherwise, the content is parsed
inline.

Here, you'd be best off changing the options parameter to parseText to
parseAsInline: false, to force it to always parse in block mode.

Generally, though, as I mentioned above, the strategy of stitching together
a big block of wikitext and parsing it is not the recommended approach.
Better to generate the parse tree nodes corresponding to the table that you
want directly.


>
> However add anything to the beginning or end of the text variable ...e.g.
>
> text   = "Hello\n";
> text += "|test1|test2|\n";
> text += "|test3|test4|\n";
> text += "|test5|test6|\n";
>
> and it suddenly fails ... What am I not getting about the way this is
> rendering? ... should I be preparing multiple "nodes" of rendering to get
> this to work, one with the preceding "Hello" and the next one with the
> table in? ... and if so how do I pass them to the createRenderers()
>

The reason that this example fails to recognise the table is that there is
only a single newline after the line "Hello". TW5 requires a minimum of two
newlines to trigger a new paragraph, and so it's treating the table as a
continuation of the same paragraph.

Best wishes

Jeremy


>
> Thanks
>
> David
>
>  --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to