Markdown spacing inside page render

3 views
Skip to first unread message

David

unread,
Mar 21, 2010, 2:41:29 AM3/21/10
to Webby
I'm just starting to use Webby and am thrilled that I can build a
handcoded but DRY website.

I generally use Markdown for my blog entries. To test out a blog
system (using Webby's website and not blog setup), I'm calling the
following from inside index.txt:

************************

This is a Markdown test.

This section (before the erb code) will generate properly spaced html.
(One empty line in between paragraphs or other DOM elements.)

The following section generates paragraphs spread out by three or four
empty lines:

<% pages = @pages.find( :limit => 10, :in_directory =>
'posts', :sort_by => 'created_at', :reverse => true) %>

<% pages.each do |page| %>
<%= page.title %>
==================

<%= render(page) %>
<% end %>

*****************************

The text inside each page is standard Markdown and should only be
generating one empty line between paragraph elements. But it generates
three to four empty lines, leading to mess source code.

Since RDiscount renders the Markdown correctly outside of the block,
I'm thinking the spacing issue is specific to Webby. If that's
correct, is there any way you guys could fix this?

Regards,
David

aimee daniells

unread,
Mar 21, 2010, 10:16:22 AM3/21/10
to webby...@googlegroups.com
You may find it works if you use a minus character where you'd use an equals character for output.

such as:
<%- pages.each do |page| %>

I think that will have the effect you want. Those tags are actually ERB, not Markdown. The minus character specifically tells ERB not to send any output.

aimee


To unsubscribe from this group, send email to webby-forum+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

aimee daniells

unread,
Mar 21, 2010, 10:18:27 AM3/21/10
to webby...@googlegroups.com
of course, to the purists, that's a hyphen, not a minus. my bad! ;)

David Jacobs

unread,
Mar 21, 2010, 12:10:35 PM3/21/10
to webby...@googlegroups.com
That's perfect, thanks! It's been too long since I messed around with ERB. My output looks great!

While we're talking about page rendering, what's the easiest way to include SmartyPants-style character escaping? Ie, --- turns into an em-dash and & turns into &amp;? Should I patch my RDiscount code myself, integrate another Ruby gem, another solution?

David

aimee daniells

unread,
Mar 21, 2010, 12:15:24 PM3/21/10
to webby...@googlegroups.com
I've never heard of SmartyPants, but if it's a gem you might be able to simply include it in the filters.
Reply all
Reply to author
Forward
0 new messages