Re: backslashes get stripped from $ signs

will kahn-greene <[email protected]> Sun, 26 Dec 2010 20:41:16 -0500
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Looks like a problem with the blosxom renderer.  Templates use $ for
variables.  It allows you to escape the $ in a template with a \ so that
you can have dollar signs show up in templates.

However, it looks like render_template totally does this wrong by
changing \$ to $ after the variables have been expanded and affecting
the variable expansion values.  Thus any \$ get converted to $ in the
story body.

The code in the blosxom renderer that handles variable finding and
substitution is pretty complex.  Seems like it might be a good idea to
ditch that code, switch to using a real parser, and then we'd be able to
trivially fix this issue, too.  We'd also be able to add some other
features like if blocks.

I don't think that's something I want to do in 1.5, though.  This is
definitely a 1.6 issue.

In the meantime, you could add a second \ or patch your copy of the
renderer locally.


On 12/26/2010 05:25 PM, Dieter Plaetinck wrote:
> Hi guys,
> using pyblosxom 1.5 from git
> with an very simple entry like the following:
> 
> $ cat entries/backslash.txt 
> backslash
> PS1="\u@\h \[\$foo \]\W\[$RST\] \$"
> <![CDATA[
> PS1="\u@\h \[\$foo \]\W\[$RST\] \$"
> ]]>
> 
> PB emits html code as follows:
> (...)
> PS1="\u@\h \[$foo \]\W\[$RST\] $"
> <![CDATA[
> PS1="\u@\h \[$foo \]\W\[$RST\] $"
> ]]>
> (...)
> 
> notice how the backslashes before the $'s are now gone.
> i disabled *all* plugins and use the default (plain) parser.
> blog-encoding is utf-8
> I have this issue with both static rendering and "normal mode".
> I use a regular html flavour and can reproduce it even like this:
> 
> $ cat flavours/html.flav/story 
> $(body)
> 
> 
> anyone an idea?
> 
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and, 
> should the need arise, upgrade to a full multi-node Oracle RAC database 
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> pyblosxom-users mailing list
> pyblosxom-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/pyblosxom-users
> 

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl