Non existing macros and closing tags inadvertently

1 view
Skip to first unread message

bengillies

unread,
Aug 9, 2009, 9:01:05 AM8/9/09
to WikklyText
Hi

Disclaimer: I've only just started using WikklyText, so apologies
beforehand if I've misunderstood something here.

I'm using WikklyText with TiddlyWeb to turn content (that was
previously in a TiddlyWiki) into static non-TiddlyWiki pages serverd
up by TiddlyWeb.

The problem I'm running into concerns the way WikklyText parses
TiddlyWiki macros. Understandably, the macros that exist in the
TiddlyWiki form of my content, do not exist in Python, so when
rendering, they are stripped by WikklyText and not included in the
final output. This all seems well and good, but it appears that when I
enclose the wikified text in <p> tags, the <p> tag is closed eary, at
the point where the non existent macro is stripped. For example:

<p>This is some text that should be <<macro>> wikified</p>

is being rendered as following:

<p>This is some text that should be </p> wikified</p>

Note - this problem does not happen when I use <div> tags instead of
<p> tags.


Thanks

Ben

Frank McIngvale

unread,
Aug 9, 2009, 6:31:28 PM8/9/09
to wikkl...@googlegroups.com
On Sun, Aug 9, 2009 at 8:01 AM, bengillies <bengi...@gmail.com> wrote:

The problem I'm running into concerns the way WikklyText parses
TiddlyWiki macros. Understandably, the macros that exist in the
TiddlyWiki form of my content, do not exist in Python, so when
rendering, they are stripped by WikklyText and not included in the
final output. This all seems well and good, but it appears that when I
enclose the wikified text in <p> tags, the <p> tag is closed eary, at
the point where the non existent macro is stripped. For example:

<p>This is some text that should be <<macro>> wikified</p>

is being rendered as following:

<p>This is some text that should be </p> wikified</p>

Hmmm ... that's odd and is definitely incorrect behavior, but off the top of my head I can't think of an obvious reason why that is happening. I've added it to my buglist though so I will dig into it more in the next few days.

thanks for reporting that ...
Frank
 

bengillies

unread,
Aug 10, 2009, 5:51:01 AM8/10/09
to WikklyText
Thanks, much appreciated.

On Aug 9, 11:31 pm, Frank McIngvale <fmcingv...@gmail.com> wrote:

Frank McIngvale

unread,
Aug 10, 2009, 8:18:05 PM8/10/09
to wikkl...@googlegroups.com
On Sun, Aug 9, 2009 at 8:01 AM, bengillies <bengi...@gmail.com> wrote:

The problem I'm running into concerns the way WikklyText parses
TiddlyWiki macros. Understandably, the macros that exist in the
TiddlyWiki form of my content, do not exist in Python, so when
rendering, they are stripped by WikklyText and not included in the
final output. This all seems well and good, but it appears that when I
enclose the wikified text in <p> tags, the <p> tag is closed eary, at
the point where the non existent macro is stripped. For example:

<p>This is some text that should be <<macro>> wikified</p>

is being rendered as following:

<p>This is some text that should be </p> wikified</p>

Hm ... I thought I understood, but now that I look into it I'm confused. Maybe someone else here can help enlighten me? First of all, it looks like that since TiddlyWiki 2.5, you can write HTML directly inline without using <html>. I wasn't aware of that, so WikklyText doesn't (yet at least) support it. [I need to research this a little, since I don't understand the rationale for this change in TW.]

Now, when I type your example text into WikklyText, it renders the '<p>' as literal chars, not as the HTML elements. So the second part of my confusion is how you are getting WT to render the <p> as HTML elements at all? Maybe I just need a more complete example to make it clear?

thanks,
Frank

Thanks

Ben


FND

unread,
Aug 11, 2009, 4:59:44 AM8/11/09
to wikkl...@googlegroups.com
> since TiddlyWiki 2.5, you can write HTML directly inline
> without using <html>

Wow, good catch!
That was an inadvertent change, and happens to be fixed in the latest
beta (more or less by accident):
http://trac.tiddlywiki.org/ticket/1084#comment:3


-- F.

Frank McIngvale

unread,
Aug 11, 2009, 7:49:06 AM8/11/09
to wikkl...@googlegroups.com
Whew! Glad to hear that :-)

thanks,
Frank


-- F.



bengillies

unread,
Aug 11, 2009, 10:12:47 AM8/11/09
to WikklyText
Ok, a slight misunderstanding maybe:

What I'm doing is running the text of my tiddler through WikklyText,
and enclosing that in <p> tags in my HTML template. So for example:

<p class="content">{{wikified_text}}</p>

where {{wikified_text}} is the result of passing tiddler.text into
wikklytext.


The result (in the HTML (ie non TiddlyWiki) page), is then that where
the non existing macro is mentioned in tiddler.text, in the browser,
there is a </p> tag that closes my original (ie - <p class"content">
tag) instead of just nothing (ie - instead of the macro just being
stripped)


Hope this makes sense


On Aug 11, 1:18 am, Frank McIngvale <fmcingv...@gmail.com> wrote:

Frank McIngvale

unread,
Aug 11, 2009, 7:29:19 PM8/11/09
to wikkl...@googlegroups.com
On Tue, Aug 11, 2009 at 9:12 AM, bengillies <bengi...@gmail.com> wrote:

Ok, a slight misunderstanding maybe:

What I'm doing is running the text of my tiddler through WikklyText,
and enclosing that in <p> tags in my HTML template. So for example:

<p class="content">{{wikified_text}}</p>

where {{wikified_text}} is the result of passing tiddler.text into
wikklytext.

I think I see what you are saying, but now I'm more confused. If you are adding the <p> tags and only passing the wikified_text to WT, I don't see how it could possibly matter whether you add <p> or <div> on the outside, since WT never sees it.

I must still be missing something, so here is a minimal example -- show me what text to plug in as 's':

----------------------------
from wikklytext import WikklyText_to_InnerHTML

s = "hello <<unknown>> world"

html,ctx = WikklyText_to_InnerHTML(s, 'utf-8', False)
print "GOT HTML:",html
--------------------------

When I use the above example, I don't see any mismatched <p> tags or any other weird tags. Just an error message in a <div> about the missing macro plus "hello  world" as plaintext.

frank

Reply all
Reply to author
Forward
0 new messages