You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kevin Minder <ke...@hortonworks.com> on 2013/03/20 20:04:49 UTC

Hiding markup from Velocity during site generation with md.vm source files

Hi Everyone,
I'm using Markdown formatting to create my site docs.  I'm also using 
Velocity templating to pass some version information from the pom to the 
md.vm files.  Lets assume that I have a md.vm file like this:

Heading
------

### Sub-heading

     Big long hairy code block with some nasty XML like this
     <message>Java failed, error 
message[\${wf:errorMessage(wf:lastErrorNode())}]</message>


I have two issues.

1. Velocity is eating the ### Sub-heading so my html doesn't have these 
section header.  I worked around this BTW by defining a property 
<HHH>###</HHH> in my POM and then using ${HHH} in my md.vm but this is a 
bit of a hack and hurts the readability of the raw file.
2. I can't figure out how to hide the code block from Velocity and it is 
choking on the nasty XML it.

I was hoping to be able to do this.

Heading
------

#[[###]]# Sub-heading

#[[
     Big long hairy code block with some nasty XML like this
     <message>Java failed, error 
message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
]]#

It looks like Velocity doesn't remove the #[[[[# markup from its 
rendered output so then Markdown chokes on the #[[.

Anyone have any other ideas?
Kevin.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Hiding markup from Velocity during site generation with md.vm source files

Posted by Martin Gainty <mg...@hotmail.com>.
Kevin i was thinking CDATA to tell the validator not to validatebut assuming your posting to a website and browsers do validate and sincebrowsers treat CDATA differently ..then wrap it in a javascript script
<script type="text/javascript">
<![CDATA[$data]]>
</script>
http://javascript.about.com/library/blxhtml.htm
Martin
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

 > Date: Wed, 20 Mar 2013 15:06:36 -0400
> From: kevin.minder@hortonworks.com
> To: users@maven.apache.org
> Subject: Re: Hiding markup from Velocity during site generation with md.vm source files
> 
> Point of clarification.  Velocity is eating the ### Sub-heading line 
> because from its perspective this is a comment and doesn't belong in the 
> rendered output.
> 
> On 3/20/13 3:04 PM, Kevin Minder wrote:
> > Hi Everyone,
> > I'm using Markdown formatting to create my site docs.  I'm also using 
> > Velocity templating to pass some version information from the pom to 
> > the md.vm files.  Lets assume that I have a md.vm file like this:
> >
> > Heading
> > ------
> >
> > ### Sub-heading
> >
> >     Big long hairy code block with some nasty XML like this
> >     <message>Java failed, error 
> > message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
> >
> >
> > I have two issues.
> >
> > 1. Velocity is eating the ### Sub-heading so my html doesn't have 
> > these section header.  I worked around this BTW by defining a property 
> > <HHH>###</HHH> in my POM and then using ${HHH} in my md.vm but this is 
> > a bit of a hack and hurts the readability of the raw file.
> > 2. I can't figure out how to hide the code block from Velocity and it 
> > is choking on the nasty XML it.
> >
> > I was hoping to be able to do this.
> >
> > Heading
> > ------
> >
> > #[[###]]# Sub-heading
> >
> > #[[
> >     Big long hairy code block with some nasty XML like this
> >     <message>Java failed, error 
> > message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
> > ]]#
> >
> > It looks like Velocity doesn't remove the #[[[[# markup from its 
> > rendered output so then Markdown chokes on the #[[.
> >
> > Anyone have any other ideas?
> > Kevin.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
 		 	   		  

Re: Hiding markup from Velocity during site generation with md.vm source files

Posted by Lukas Theussl <lt...@apache.org>.
Hmm, not sure if this is the correct behavior, the markdown module has never
been very well tested.

I would probably use your property hack, you don't have to define it in the pom
though, you can set it inside the template file like:

#set( $H = '###' )

$H


HTH,
-Lukas


On 03/21/2013 01:00 PM, Kevin Minder wrote:
> Just did and that doesn't work. Velocity doesn't remove the line from the output
> (which is good) but Markdown for some reason doesn't  interpret it as a heading
> (which is bad).  So I end up with:
> 
> ### Section Test
> 
> in the HTML instead of a nice shaded box.
> 
> On 3/21/13 3:27 AM, Lukas Theussl wrote:
>> Did you try to escape the special character:
>>
>> \#\#\# ?
>>
>> -Lukas
>>
>>
>> On 03/20/2013 08:06 PM, Kevin Minder wrote:
>>> Point of clarification.  Velocity is eating the ### Sub-heading line because
>>> from its perspective this is a comment and doesn't belong in the rendered
>>> output.
>>>
>>> On 3/20/13 3:04 PM, Kevin Minder wrote:
>>>> Hi Everyone,
>>>> I'm using Markdown formatting to create my site docs.  I'm also using Velocity
>>>> templating to pass some version information from the pom to the md.vm files.
>>>> Lets assume that I have a md.vm file like this:
>>>>
>>>> Heading
>>>> ------
>>>>
>>>> ### Sub-heading
>>>>
>>>>      Big long hairy code block with some nasty XML like this
>>>>      <message>Java failed, error
>>>> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
>>>>
>>>>
>>>> I have two issues.
>>>>
>>>> 1. Velocity is eating the ### Sub-heading so my html doesn't have these
>>>> section header.  I worked around this BTW by defining a property
>>>> <HHH>###</HHH> in my POM and then using ${HHH} in my md.vm but this is a bit
>>>> of a hack and hurts the readability of the raw file.
>>>> 2. I can't figure out how to hide the code block from Velocity and it is
>>>> choking on the nasty XML it.
>>>>
>>>> I was hoping to be able to do this.
>>>>
>>>> Heading
>>>> ------
>>>>
>>>> #[[###]]# Sub-heading
>>>>
>>>> #[[
>>>>      Big long hairy code block with some nasty XML like this
>>>>      <message>Java failed, error
>>>> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
>>>> ]]#
>>>>
>>>> It looks like Velocity doesn't remove the #[[[[# markup from its rendered
>>>> output so then Markdown chokes on the #[[.
>>>>
>>>> Anyone have any other ideas?
>>>> Kevin.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Hiding markup from Velocity during site generation with md.vm source files

Posted by Kevin Minder <ke...@hortonworks.com>.
Just did and that doesn't work. Velocity doesn't remove the line from 
the output (which is good) but Markdown for some reason doesn't  
interpret it as a heading (which is bad).  So I end up with:

### Section Test

in the HTML instead of a nice shaded box.

On 3/21/13 3:27 AM, Lukas Theussl wrote:
> Did you try to escape the special character:
>
> \#\#\# ?
>
> -Lukas
>
>
> On 03/20/2013 08:06 PM, Kevin Minder wrote:
>> Point of clarification.  Velocity is eating the ### Sub-heading line because
>> from its perspective this is a comment and doesn't belong in the rendered output.
>>
>> On 3/20/13 3:04 PM, Kevin Minder wrote:
>>> Hi Everyone,
>>> I'm using Markdown formatting to create my site docs.  I'm also using Velocity
>>> templating to pass some version information from the pom to the md.vm files.
>>> Lets assume that I have a md.vm file like this:
>>>
>>> Heading
>>> ------
>>>
>>> ### Sub-heading
>>>
>>>      Big long hairy code block with some nasty XML like this
>>>      <message>Java failed, error
>>> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
>>>
>>>
>>> I have two issues.
>>>
>>> 1. Velocity is eating the ### Sub-heading so my html doesn't have these
>>> section header.  I worked around this BTW by defining a property
>>> <HHH>###</HHH> in my POM and then using ${HHH} in my md.vm but this is a bit
>>> of a hack and hurts the readability of the raw file.
>>> 2. I can't figure out how to hide the code block from Velocity and it is
>>> choking on the nasty XML it.
>>>
>>> I was hoping to be able to do this.
>>>
>>> Heading
>>> ------
>>>
>>> #[[###]]# Sub-heading
>>>
>>> #[[
>>>      Big long hairy code block with some nasty XML like this
>>>      <message>Java failed, error
>>> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
>>> ]]#
>>>
>>> It looks like Velocity doesn't remove the #[[[[# markup from its rendered
>>> output so then Markdown chokes on the #[[.
>>>
>>> Anyone have any other ideas?
>>> Kevin.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Hiding markup from Velocity during site generation with md.vm source files

Posted by Lukas Theussl <lt...@apache.org>.
Did you try to escape the special character:

\#\#\# ?

-Lukas


On 03/20/2013 08:06 PM, Kevin Minder wrote:
> Point of clarification.  Velocity is eating the ### Sub-heading line because
> from its perspective this is a comment and doesn't belong in the rendered output.
> 
> On 3/20/13 3:04 PM, Kevin Minder wrote:
>> Hi Everyone,
>> I'm using Markdown formatting to create my site docs.  I'm also using Velocity
>> templating to pass some version information from the pom to the md.vm files. 
>> Lets assume that I have a md.vm file like this:
>>
>> Heading
>> ------
>>
>> ### Sub-heading
>>
>>     Big long hairy code block with some nasty XML like this
>>     <message>Java failed, error
>> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
>>
>>
>> I have two issues.
>>
>> 1. Velocity is eating the ### Sub-heading so my html doesn't have these
>> section header.  I worked around this BTW by defining a property
>> <HHH>###</HHH> in my POM and then using ${HHH} in my md.vm but this is a bit
>> of a hack and hurts the readability of the raw file.
>> 2. I can't figure out how to hide the code block from Velocity and it is
>> choking on the nasty XML it.
>>
>> I was hoping to be able to do this.
>>
>> Heading
>> ------
>>
>> #[[###]]# Sub-heading
>>
>> #[[
>>     Big long hairy code block with some nasty XML like this
>>     <message>Java failed, error
>> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
>> ]]#
>>
>> It looks like Velocity doesn't remove the #[[[[# markup from its rendered
>> output so then Markdown chokes on the #[[.
>>
>> Anyone have any other ideas?
>> Kevin.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Hiding markup from Velocity during site generation with md.vm source files

Posted by Kevin Minder <ke...@hortonworks.com>.
Point of clarification.  Velocity is eating the ### Sub-heading line 
because from its perspective this is a comment and doesn't belong in the 
rendered output.

On 3/20/13 3:04 PM, Kevin Minder wrote:
> Hi Everyone,
> I'm using Markdown formatting to create my site docs.  I'm also using 
> Velocity templating to pass some version information from the pom to 
> the md.vm files.  Lets assume that I have a md.vm file like this:
>
> Heading
> ------
>
> ### Sub-heading
>
>     Big long hairy code block with some nasty XML like this
>     <message>Java failed, error 
> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
>
>
> I have two issues.
>
> 1. Velocity is eating the ### Sub-heading so my html doesn't have 
> these section header.  I worked around this BTW by defining a property 
> <HHH>###</HHH> in my POM and then using ${HHH} in my md.vm but this is 
> a bit of a hack and hurts the readability of the raw file.
> 2. I can't figure out how to hide the code block from Velocity and it 
> is choking on the nasty XML it.
>
> I was hoping to be able to do this.
>
> Heading
> ------
>
> #[[###]]# Sub-heading
>
> #[[
>     Big long hairy code block with some nasty XML like this
>     <message>Java failed, error 
> message[\${wf:errorMessage(wf:lastErrorNode())}]</message>
> ]]#
>
> It looks like Velocity doesn't remove the #[[[[# markup from its 
> rendered output so then Markdown chokes on the #[[.
>
> Anyone have any other ideas?
> Kevin.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org