From: Kjell M. F. <kj...@gm...> - 2008-08-26 08:20:15
|
Dear Python-markdown developers, I have taken a closer look at ticket #12 regarding the bug in codehilite that inserts the formatted code at the start of the document. The problem seems to be that the code is inserted in the parent node's text attribute. According to the ElementTree documentation [1] the text attribute is text *before* the first subelement. That is why the code is inserted at the start of the document. I have posted a partial solution to the problem as a comment to the ticket: http://www.freewisdom.org/projects/python-markdown/Tickets/000012 Regards, Kjell Magne Fauske [1] http://effbot.org/zone/pythondoc-elementtree-ElementTree.htm#elementtree.ElementTree._ElementInterface.text-attribute ( Why can't I find this information in Python's documentation of ElementTree? ) |
From: Waylan L. <wa...@gm...> - 2008-08-26 13:58:30
|
Thanks Kjell. I suspected it was something like that. I just haven't had the time to work on it. I was thinking perhaps I would have the highlighter return the highlighted source without a div wrapping it, then we could place that within a ET generated div. IIRC, there is a way to get pygments to do that, but I couldn't tell you off the top of my head what it is. If you want to give that a shot - feel free. Otherwise I'll get to it when I have the time. On Tue, Aug 26, 2008 at 4:20 AM, Kjell Magne Fauske <kj...@gm...> wrote: > Dear Python-markdown developers, > > I have taken a closer look at ticket #12 regarding the bug in > codehilite that inserts the formatted code at the start of the > document. The problem seems to be that the code is inserted in the > parent node's text attribute. According to the ElementTree > documentation [1] the text attribute is text *before* the first > subelement. That is why the code is inserted at the start of the > document. > > I have posted a partial solution to the problem as a comment to the ticket: > http://www.freewisdom.org/projects/python-markdown/Tickets/000012 > > Regards, > Kjell Magne Fauske > > [1] http://effbot.org/zone/pythondoc-elementtree-ElementTree.htm#elementtree.ElementTree._ElementInterface.text-attribute > > ( Why can't I find this information in Python's documentation of ElementTree? ) > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > -- ---- Waylan Limberg wa...@gm... |
From: Kjell M. F. <kj...@gm...> - 2008-08-26 15:40:38
Attachments:
codehilite.py.diff
codehilite.py
|
On Tue, Aug 26, 2008 at 9:58 AM, Waylan Limberg <wa...@gm...> wrote: > Thanks Kjell. I suspected it was something like that. I just haven't > had the time to work on it. I was thinking perhaps I would have the > highlighter return the highlighted source without a div wrapping it, > then we could place that within a ET generated div. IIRC, there is a > way to get pygments to do that, but I couldn't tell you off the top of > my head what it is. If you want to give that a shot - feel free. > Otherwise I'll get to it when I have the time. > I now think I have found a fix. You can find the code attached. I am not familiar with Git, so I'm not sure if the patch is correctly formatted. Regards, Kjell Magne Fauske |
From: Waylan L. <wa...@gm...> - 2008-08-26 17:05:12
|
On Tue, Aug 26, 2008 at 11:40 AM, Kjell Magne Fauske <kj...@gm...> wrote: > On Tue, Aug 26, 2008 at 9:58 AM, Waylan Limberg <wa...@gm...> wrote: >> Thanks Kjell. I suspected it was something like that. I just haven't >> had the time to work on it. I was thinking perhaps I would have the >> highlighter return the highlighted source without a div wrapping it, >> then we could place that within a ET generated div. IIRC, there is a >> way to get pygments to do that, but I couldn't tell you off the top of >> my head what it is. If you want to give that a shot - feel free. >> Otherwise I'll get to it when I have the time. >> > > I now think I have found a fix. You can find the code attached. I am > not familiar with Git, so I'm not sure if the patch is correctly > formatted. > Thanks Kjell, your patch was fine - and in the simple case it works. However, when pygments adds line numbers to the source, the source (and containing div) are wrapped in a table. However, with your patch the table is wrapped in the div instead. I realize the div is only there for styling hooks, but if css authors are expecting the div to be a child of the table, that might break their css - so we need to be consistent. After all, the idea is that people can use any of the publicly available styles for pygments without any modification to work with markdown. So I came up with another solution over lunch - which occurred to me after I sent you my last message. See the comment and diff here: http://gitorious.org/projects/python-markdown/repos/mainline/commits/a4c80246770b87ca3d2cce5b5184901fd2495a7d -- ---- Waylan Limberg wa...@gm... |
From: Waylan L. <wa...@gm...> - 2008-08-26 17:22:01
|
On Tue, Aug 26, 2008 at 1:05 PM, Waylan Limberg <wa...@gm...> wrote: > > So I came up with another solution over lunch - which occurred to me > after I sent you my last message. See the comment and diff here: > http://gitorious.org/projects/python-markdown/repos/mainline/commits/a4c80246770b87ca3d2cce5b5184901fd2495a7d > Btw Kjell, don't feel bad that I didn't use your patch. I would have tried the same thing first myself before realizing the problem with it - which means we wouldn't have a fix yet. So thanks for saving me the time. You were a big help. -- ---- Waylan Limberg wa...@gm... |
From: Kjell M. F. <kj...@gm...> - 2008-08-26 17:23:52
Attachments:
codehilite.py.diff2
|
On Tue, Aug 26, 2008 at 1:05 PM, Waylan Limberg <wa...@gm...> wrote: > On Tue, Aug 26, 2008 at 11:40 AM, Kjell Magne Fauske <kj...@gm...> wrote: >> On Tue, Aug 26, 2008 at 9:58 AM, Waylan Limberg <wa...@gm...> wrote: >>> Thanks Kjell. I suspected it was something like that. I just haven't >>> had the time to work on it. I was thinking perhaps I would have the >>> highlighter return the highlighted source without a div wrapping it, >>> then we could place that within a ET generated div. IIRC, there is a >>> way to get pygments to do that, but I couldn't tell you off the top of >>> my head what it is. If you want to give that a shot - feel free. >>> Otherwise I'll get to it when I have the time. >>> >> >> I now think I have found a fix. You can find the code attached. I am >> not familiar with Git, so I'm not sure if the patch is correctly >> formatted. >> > > Thanks Kjell, your patch was fine - and in the simple case it works. > However, when pygments adds line numbers to the source, the source > (and containing div) are wrapped in a table. However, with your patch > the table is wrapped in the div instead. I realize the div is only > there for styling hooks, but if css authors are expecting the div to > be a child of the table, that might break their css - so we need to be > consistent. After all, the idea is that people can use any of the > publicly available styles for pygments without any modification to > work with markdown. > > So I came up with another solution over lunch - which occurred to me > after I sent you my last message. See the comment and diff here: > http://gitorious.org/projects/python-markdown/repos/mainline/commits/a4c80246770b87ca3d2cce5b5184901fd2495a7d > > -- > ---- > Waylan Limberg > wa...@gm... > Great! Your solution was much cleaner than mine. No hard feelings :) Regarding breaking css, I have filed a new ticket #16 and asked for the addition of an option for setting the name of the wrapper css class: http://www.freewisdom.org/projects/python-markdown/Tickets/000016 Patch is attached, but I have probably overlooked something. Regards, Kjell Magne Fauske |
From: Waylan L. <wa...@gm...> - 2008-08-26 17:37:58
|
On Tue, Aug 26, 2008 at 1:23 PM, Kjell Magne Fauske <kj...@gm...> wrote: > > Regarding breaking css, I have filed a new ticket #16 and asked for > the addition of an option for setting the name of the wrapper css > class: > > http://www.freewisdom.org/projects/python-markdown/Tickets/000016 > > Patch is attached, but I have probably overlooked something. > Yeah I saw that. It looks good from a quick glance. I'll add it to my list. Not sure why I didn't do that to begin with. -- ---- Waylan Limberg wa...@gm... |
From: Waylan L. <wa...@gm...> - 2008-09-03 20:21:53
|
Hey, just an FYI, I committed this today. Thanks for the patch. On Tue, Aug 26, 2008 at 1:38 PM, Waylan Limberg <wa...@gm...> wrote: > On Tue, Aug 26, 2008 at 1:23 PM, Kjell Magne Fauske <kj...@gm...> wrote: >> >> Regarding breaking css, I have filed a new ticket #16 and asked for >> the addition of an option for setting the name of the wrapper css >> class: >> >> http://www.freewisdom.org/projects/python-markdown/Tickets/000016 >> >> Patch is attached, but I have probably overlooked something. >> > > Yeah I saw that. It looks good from a quick glance. I'll add it to my > list. Not sure why I didn't do that to begin with. > > > -- > ---- > Waylan Limberg > wa...@gm... > -- ---- Waylan Limberg wa...@gm... |
From: Kjell M. F. <kj...@gm...> - 2008-09-04 08:35:36
|
On Wed, Sep 3, 2008 at 10:22 PM, Waylan Limberg <wa...@gm...> wrote: > Hey, just an FYI, I committed this today. Thanks for the patch. > > On Tue, Aug 26, 2008 at 1:38 PM, Waylan Limberg <wa...@gm...> wrote: >> On Tue, Aug 26, 2008 at 1:23 PM, Kjell Magne Fauske <kj...@gm...> wrote: >>> >>> Regarding breaking css, I have filed a new ticket #16 and asked for >>> the addition of an option for setting the name of the wrapper css >>> class: >>> >>> http://www.freewisdom.org/projects/python-markdown/Tickets/000016 >>> >>> Patch is attached, but I have probably overlooked something. >>> >> >> Yeah I saw that. It looks good from a quick glance. I'll add it to my >> list. Not sure why I didn't do that to begin with. >> Thank you Waylan for adding this useful feature! There seems to be a syntax error in line 897 in the current mainline version of markdown.py. It should probably be changed from _prettifyETree(e) to self._prettifyETree(e) I have also found a bug in the headerid extension. It inserts some strange <inline> tags in the output. I will file a ticket about this soon. Regards, Kjell Magne Fauske Regards, Kjell Magne Fauske |
From: Waylan L. <wa...@gm...> - 2008-09-04 13:01:22
|
On Thu, Sep 4, 2008 at 4:35 AM, Kjell Magne Fauske <kj...@gm...> wrote: > > There seems to be a syntax error in line 897 in the current mainline > version of markdown.py. It should probably be changed from > > _prettifyETree(e) > to > self._prettifyETree(e) Doh! That's what I get for failing to run the tests after the last change I made. It's fixed now. > > I have also found a bug in the headerid extension. It inserts some > strange <inline> tags in the output. I will file a ticket about this > soon. > Thanks for the report. -- ---- Waylan Limberg wa...@gm... |