> The plugin modifies the core TiddlyWiki.prototype.getTiddlerText()
> function and can be found at:http://htmltiddlersectionsplugin.tiddlyspot.com/
> The plugin works great, but there is a problem that I have been
> racking my brain over and can't seem to solve. If the <<tiddler
> HtmlTiddler##SectionTitle>> macro is called from inside a wiki-style
> tiddler it works fine, but if I want to call the macro from within a
> html-synatax tiddler (i.e. by using Eric's HTMLFormattingPlugin [2])
> then I get odd text appearing at the bottom of the tiddler. I think
> this has something to do with the way the HTMLFormattingPlugin works,
> but I can't figure out how to get around it.
I don't know what is going on there, but HTMLFormattingPlugin works by
recursively looking for TEXT nodes after the HTML is processed. Your
content is:
<html>
{{{<<tiddler ...>>}}}
<<tiddler ...>>
</html>
First, when the TWCore parser sees <html>...</html>, it creates a SPAN
container and then the entire block is passed to the browser for HTML
rendering. Then, the plugin recursively scans the resulting SPAN for
TEXT nodes and replaces them with SPAN nodes into which is applies the
TWCore wikify() function on the text fragment so that any wiki syntax
it contains is rendered. If a text node contains a macro syntax, that
macro gets parsed and rendered. The <<tiddler>> macro also creates a
SPAN container for its rendered output.
Thus, the fragment,
<html>{{{<<tiddler ...>>}}}</html>
is first rendered (via the TWCore and browser) as:
<span><code><<tiddler ...>></code></span>
and then HTMLFormattingPlugin finds the "<<tiddler ...>>" TEXT node
(inside the CODE block) and processes that content, which creates a
SPAN into which the retrieved tiddler text is rendered by the TWCore,
producing.
<span><code><span>...content from tiddler section...</span></code></
span>
However, in your particular use-case, the retrieved text is also HTML-
formatted (surrounded by <html>...</html>). Thus, the retrieved
tiddler content is put inside another SPAN and processed by the
browser and then HTMLFormattingPlugin, resulting in:
<span><code><span><span>...content from tiddler section...</span></
span></code></span>
I don't know why you are getting strange results, but it will take
some time to figure it out. I'll let you know if I find anything
definitive.
Note: there is another issue with your plugin tht is unrelated to the
HTML formatting problems:
Your plugin does not "modify" the core function, it *REPLACES* it...
which will BREAK any other plugin that has already modified the
function. The proper way to add code to a core function is to
*hijack* that function. First, save a copy of the old function:
store.coreGetTiddlerText = store.getTiddlerText;
Then, declare the replacement:
store.getTiddlerText = function(tid) { ...
and, inside that replacement, *invoke the old function first*, to get
the text as returned by the core (with any other plugin
modifications):
var t=store.coreGetTiddlerText.apply(this,arguments);
(note: both "this" and "arguments" are automatically defined by the
javascript run-time.)
Then, once you have the text, apply you own code to modify it (i.e.,
scan for <Hn> HTML heading syntax) and return your desired result.
enjoy,
-e
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" 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/tiddlywiki?hl=en.