Kannan Goundan
2011-Feb-04 02:47 UTC
[webgen-users] Making {include_file} work well with Maruku
I write most of my webpage in Maruku, but there are two places where I want to include code samples. I use the {include_file} tag to include the code samples. For example: --- title: "Example" --- name:content pipeline:tags,maruku Please look at the following code: {include_file: {filename: Example.java}} Here is an applet: <applet ...> <param name="initial" value="{include_file: {filename: Example.java}}" </applet> In the first case, only the first line is placed in a <pre> block. The rest of the lines are just dumped out at the top level. In the second case, Maruku complains because the "value" attribute ends up expanding to multiple lines. Is there a way to tell {include_file} to escape newlines as well? Thanks! -- Kannan
Kannan Goundan
2011-Feb-07 07:58 UTC
[webgen-users] Making {include_file} work well with Maruku
Kannan Goundan wrote:> I write most of my webpage in Maruku, but there are two places where I > want to include code samples. I use the {include_file} tag to include > the code samples. For example: > > --- > title: "Example" > --- name:content pipeline:tags,maruku Please look at the following > code: > > {include_file: {filename: Example.java}} > > Here is an applet: > > <applet ...> > <param name="initial" value="{include_file: {filename: > Example.java}}" > </applet> > > In the first case, only the first line is placed in a <pre> block. The > rest of the lines are just dumped out at the top level. > > In the second case, Maruku complains because the "value" attribute ends > up expanding to multiple lines. Is there a way to tell {include_file} > to escape newlines as well? > > Thanks! > -- KannanI kinda worked around the problem by switching to ERB and writing Ruby code to pull in the file. Is there a way to embed Ruby code in Markdown content?
Thomas Leitner
2011-Feb-15 15:31 UTC
[webgen-users] Making {include_file} work well with Maruku
On 2011-02-07 07:58 +0000 Kannan Goundan wrote:> I kinda worked around the problem by switching to ERB and writing > Ruby code to pull in the file. Is there a way to embed Ruby code in > Markdown content?You can use the ERB and Maruku content processors together but you need to be aware of the order in which they are used. It is normally better to first use the ERB processor and then Maruku because Maruku might mangle the special start/end tags that ERB uses. So, the following works as expected: --- pipeline:erb,maruku > This is a paragraph in a blockquote. <% 5.times do %> * This is an item <% end %> Here is a paragraph after the list. So just use the normal ERB syntax (<% ... %>) anywhere you like and make sure that you output correct Markdown syntax! Best regards, Thomas