|
From: Yuri T. <qar...@gm...> - 2007-10-16 20:45:45
|
Has anyone gotten Trac working with Markdown? What exactly does it take? - yuri -- http://www.freewisdom.org/ |
|
From: Brian J. <bri...@gn...> - 2007-10-16 22:54:58
|
A while back I did an ugly hack that mostly worked (but I haven't used
it in a while). I just uses a giant regular expresion to extract link
targets, run them through the wiki engine, and then process the whole
thing with markdown.py.
There must be a better way.
"""Trac plugin for Markdown Syntax (with links)
Everything markdown-ed as a link target is run through Trac's wiki
formatter to get a substitute url.
Tested with Trac 0.8.1 and python-markdown 1.4 on Debian GNU/Linux.
Brian Jaress
2007-01-04
"""
from re import sub, compile, search, I
from markdown import markdown
from trac.WikiFormatter import wiki_to_oneliner
#links, autolinks, and reference-style links
LINK = compile(
r'(\]\()([^) ]+)([^)]*\))|(<)([^>]+)(>)|(\n\[[^]]+\]: *)([^ \n]+)(.*\n)'
)
HREF = compile(r'href=[\'"]?([^\'" ]*)')
def execute(hdf, txt, env):
abs = env.abs_href.base
abs = abs[:len(abs) - len(env.href.base)]
def convert(m):
pre, target, suf = filter(None, m.groups())
url = search(
HREF,
wiki_to_oneliner(target, hdf, env, env.get_db_cnx()),
I).groups()[0]
#Trac creates relative links, which markdown won't touch inside
# <autolinks> because they look like HTML
if pre == '<' and url != target:
pre += abs
return pre + str(url) + suf
return markdown(sub(LINK, convert, txt))
On Tue, Oct 16, 2007 at 03:45:46PM -0500, Yuri Takhteyev wrote:
> Has anyone gotten Trac working with Markdown? What exactly does it take?
>
> - yuri
>
> --
> http://www.freewisdom.org/
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Python-markdown-discuss mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
--
Brian Jaress
bri...@gn...
http://brian-jaress.livejournal.com
|
|
From: Yuri T. <qar...@gm...> - 2007-10-17 07:18:05
|
It doesn't seem that ugly, once I managed to parse it. :)
A question though: this being a "plugin" means that all Markdown formatting
would need to be surrounded by {{{...}}}, right? Is there a way of avoiding
this?
Judging by http://trac.edgewall.org/ticket/615, I am guessing that there
isn't any blessed solution. But one would think that there should be a way
to hack it to default to Markdown?
- yuri
On 10/16/07, Brian Jaress <bri...@gn...> wrote:
>
> A while back I did an ugly hack that mostly worked (but I haven't used
> it in a while). I just uses a giant regular expresion to extract link
> targets, run them through the wiki engine, and then process the whole
> thing with markdown.py.
>
> There must be a better way.
>
>
> """Trac plugin for Markdown Syntax (with links)
>
> Everything markdown-ed as a link target is run through Trac's wiki
> formatter to get a substitute url.
>
> Tested with Trac 0.8.1 and python-markdown 1.4 on Debian GNU/Linux.
>
> Brian Jaress
> 2007-01-04
> """
>
> from re import sub, compile, search, I
> from markdown import markdown
> from trac.WikiFormatter import wiki_to_oneliner
>
> #links, autolinks, and reference-style links
> LINK = compile(
> r'(\]\()([^) ]+)([^)]*\))|(<)([^>]+)(>)|(\n\[[^]]+\]: *)([^
> \n]+)(.*\n)'
> )
>
> HREF = compile(r'href=[\'"]?([^\'" ]*)')
>
> def execute(hdf, txt, env):
> abs = env.abs_href.base
> abs = abs[:len(abs) - len(env.href.base)]
> def convert(m):
> pre, target, suf = filter(None, m.groups())
> url = search(
> HREF,
> wiki_to_oneliner(target, hdf, env, env.get_db_cnx()),
> I).groups()[0]
> #Trac creates relative links, which markdown won't touch inside
> # <autolinks> because they look like HTML
> if pre == '<' and url != target:
> pre += abs
> return pre + str(url) + suf
>
> return markdown(sub(LINK, convert, txt))
>
>
>
> On Tue, Oct 16, 2007 at 03:45:46PM -0500, Yuri Takhteyev wrote:
> > Has anyone gotten Trac working with Markdown? What exactly does it
> take?
> >
> > - yuri
> >
> > --
> > http://www.freewisdom.org/
>
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Python-markdown-discuss mailing list
> > Pyt...@li...
> > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
>
>
> --
> Brian Jaress
> bri...@gn...
> http://brian-jaress.livejournal.com
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Python-markdown-discuss mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
>
--
Yuri Takhteyev
Ph.D. Candidate, UC Berkeley School of Information
http://takhteyev.org/, http://www.freewisdom.org/
|
|
From: Brian J. <bri...@gn...> - 2007-10-18 18:03:43
|
That's right, it needs the curly braces. I'm actually not using Trac
right now, and I was never very familiar with the internals.
One thing I remember is that the Trac devs seemed scornful of people
wanting to get rid of the curly braces.
A lot of users wanted that feature, so the devs may have changed their
mind since then, but I doubt it.
On Wed, Oct 17, 2007 at 02:18:04AM -0500, Yuri Takhteyev wrote:
> It doesn't seem that ugly, once I managed to parse it. :)
>
> A question though: this being a "plugin" means that all Markdown formatting
> would need to be surrounded by {{{...}}}, right? Is there a way of avoiding
> this?
>
> Judging by http://trac.edgewall.org/ticket/615, I am guessing that there
> isn't any blessed solution. But one would think that there should be a way
> to hack it to default to Markdown?
>
> - yuri
>
> On 10/16/07, Brian Jaress <bri...@gn...> wrote:
> >
> > A while back I did an ugly hack that mostly worked (but I haven't used
> > it in a while). I just uses a giant regular expresion to extract link
> > targets, run them through the wiki engine, and then process the whole
> > thing with markdown.py.
> >
> > There must be a better way.
> >
> >
> > """Trac plugin for Markdown Syntax (with links)
> >
> > Everything markdown-ed as a link target is run through Trac's wiki
> > formatter to get a substitute url.
> >
> > Tested with Trac 0.8.1 and python-markdown 1.4 on Debian GNU/Linux.
> >
> > Brian Jaress
> > 2007-01-04
> > """
> >
> > from re import sub, compile, search, I
> > from markdown import markdown
> > from trac.WikiFormatter import wiki_to_oneliner
> >
> > #links, autolinks, and reference-style links
> > LINK = compile(
> > r'(\]\()([^) ]+)([^)]*\))|(<)([^>]+)(>)|(\n\[[^]]+\]: *)([^
> > \n]+)(.*\n)'
> > )
> >
> > HREF = compile(r'href=[\'"]?([^\'" ]*)')
> >
> > def execute(hdf, txt, env):
> > abs = env.abs_href.base
> > abs = abs[:len(abs) - len(env.href.base)]
> > def convert(m):
> > pre, target, suf = filter(None, m.groups())
> > url = search(
> > HREF,
> > wiki_to_oneliner(target, hdf, env, env.get_db_cnx()),
> > I).groups()[0]
> > #Trac creates relative links, which markdown won't touch inside
> > # <autolinks> because they look like HTML
> > if pre == '<' and url != target:
> > pre += abs
> > return pre + str(url) + suf
> >
> > return markdown(sub(LINK, convert, txt))
> >
> >
> >
> > On Tue, Oct 16, 2007 at 03:45:46PM -0500, Yuri Takhteyev wrote:
> > > Has anyone gotten Trac working with Markdown? What exactly does it
> > take?
> > >
> > > - yuri
> > >
> > > --
> > > http://www.freewisdom.org/
> >
> > >
> > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems? Stop.
> > > Now Search log events and configuration files using AJAX and a browser.
> > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > Python-markdown-discuss mailing list
> > > Pyt...@li...
> > > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
> >
> >
> > --
> > Brian Jaress
> > bri...@gn...
> > http://brian-jaress.livejournal.com
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Python-markdown-discuss mailing list
> > Pyt...@li...
> > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
> >
>
>
>
> --
> Yuri Takhteyev
> Ph.D. Candidate, UC Berkeley School of Information
> http://takhteyev.org/, http://www.freewisdom.org/
--
Brian Jaress
bri...@gn...
http://brian-jaress.livejournal.com
|
|
From: Yuri T. <qar...@gm...> - 2007-10-19 06:37:13
|
Sure, it does seem that they are not interested in supporting it. But if
trac is designed well, it shouldn't be that hard to make this chance without
their support.
However, I spent way too much time today trying to install trac on dreamhost
and am ready to give up on it. I then tried MoinMoin and remembered why I
stopped using it earlier. I was going to try Infogami next, but the fact
that I would need to install Mercurial on dreamhost makes me suspect that
there would be a lot more of wasted time ahead. Unless someone can suggest
some other option that I haven't considered yet, I think I'll just go and
fix the current wiki by installing a new version.
- yuri
On 10/18/07, Brian Jaress <bri...@gn...> wrote:
>
> That's right, it needs the curly braces. I'm actually not using Trac
> right now, and I was never very familiar with the internals.
>
> One thing I remember is that the Trac devs seemed scornful of people
> wanting to get rid of the curly braces.
>
> A lot of users wanted that feature, so the devs may have changed their
> mind since then, but I doubt it.
>
>
> On Wed, Oct 17, 2007 at 02:18:04AM -0500, Yuri Takhteyev wrote:
> > It doesn't seem that ugly, once I managed to parse it. :)
> >
> > A question though: this being a "plugin" means that all Markdown
> formatting
> > would need to be surrounded by {{{...}}}, right? Is there a way of
> avoiding
> > this?
> >
> > Judging by http://trac.edgewall.org/ticket/615, I am guessing that there
> > isn't any blessed solution. But one would think that there should be a
> way
> > to hack it to default to Markdown?
> >
> > - yuri
> >
> > On 10/16/07, Brian Jaress <bri...@gn...> wrote:
> > >
> > > A while back I did an ugly hack that mostly worked (but I haven't used
> > > it in a while). I just uses a giant regular expresion to extract link
> > > targets, run them through the wiki engine, and then process the whole
> > > thing with markdown.py.
> > >
> > > There must be a better way.
> > >
> > >
> > > """Trac plugin for Markdown Syntax (with links)
> > >
> > > Everything markdown-ed as a link target is run through Trac's wiki
> > > formatter to get a substitute url.
> > >
> > > Tested with Trac 0.8.1 and python-markdown 1.4 on Debian GNU/Linux.
> > >
> > > Brian Jaress
> > > 2007-01-04
> > > """
> > >
> > > from re import sub, compile, search, I
> > > from markdown import markdown
> > > from trac.WikiFormatter import wiki_to_oneliner
> > >
> > > #links, autolinks, and reference-style links
> > > LINK = compile(
> > > r'(\]\()([^) ]+)([^)]*\))|(<)([^>]+)(>)|(\n\[[^]]+\]: *)([^
> > > \n]+)(.*\n)'
> > > )
> > >
> > > HREF = compile(r'href=[\'"]?([^\'" ]*)')
> > >
> > > def execute(hdf, txt, env):
> > > abs = env.abs_href.base
> > > abs = abs[:len(abs) - len(env.href.base)]
> > > def convert(m):
> > > pre, target, suf = filter(None, m.groups())
> > > url = search(
> > > HREF,
> > > wiki_to_oneliner(target, hdf, env, env.get_db_cnx()),
> > > I).groups()[0]
> > > #Trac creates relative links, which markdown won't touch
> inside
> > > # <autolinks> because they look like HTML
> > > if pre == '<' and url != target:
> > > pre += abs
> > > return pre + str(url) + suf
> > >
> > > return markdown(sub(LINK, convert, txt))
> > >
> > >
> > >
> > > On Tue, Oct 16, 2007 at 03:45:46PM -0500, Yuri Takhteyev wrote:
> > > > Has anyone gotten Trac working with Markdown? What exactly does it
> > > take?
> > > >
> > > > - yuri
> > > >
> > > > --
> > > > http://www.freewisdom.org/
> > >
> > > >
> > >
> -------------------------------------------------------------------------
> > > > This SF.net email is sponsored by: Splunk Inc.
> > > > Still grepping through log files to find problems? Stop.
> > > > Now Search log events and configuration files using AJAX and a
> browser.
> > > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > > _______________________________________________
> > > > Python-markdown-discuss mailing list
> > > > Pyt...@li...
> > > > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
> > >
> > >
> > > --
> > > Brian Jaress
> > > bri...@gn...
> > > http://brian-jaress.livejournal.com
> > >
> > >
> -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc.
> > > Still grepping through log files to find problems? Stop.
> > > Now Search log events and configuration files using AJAX and a
> browser.
> > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > Python-markdown-discuss mailing list
> > > Pyt...@li...
> > > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss
> > >
> >
> >
> >
> > --
> > Yuri Takhteyev
> > Ph.D. Candidate, UC Berkeley School of Information
> > http://takhteyev.org/, http://www.freewisdom.org/
>
> --
> Brian Jaress
> bri...@gn...
> http://brian-jaress.livejournal.com
>
--
Yuri Takhteyev
Ph.D. Candidate, UC Berkeley School of Information
http://takhteyev.org/, http://www.freewisdom.org/
|