gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 121 forks source link

page.summary for haml missing paragraph tag #75

Closed hishma closed 12 years ago

hishma commented 12 years ago

It looks like page summaries aren’t getting rendered inside a paragraph tag for pages that are written in haml using nest 0.9.11.

<li>
  <article>
    <header>
      <h1>
        <a href="/haml-page">Page written in haml</a>
      </h1>
    </header>
    This page was created using haml and IS NOT in a paragraph
    <p class="read_more">
      <a href="/haml-page">Continue reading</a>
    </p>
    <footer>
      <p class="meta">
        Published
        on
        <time datetime="2011-09-24T00:00:00+00:00" pubdate=“”>24 September 2011</time>
        in
        <a href="/stuff">Stuff</a>
      </p>
    </footer>
  </article>
</li>
<li>
  <article>
    <header>
      <h1>
        <a href="/mdown-page">Page written in mdown</a>
      </h1>
    </header>
    <p>This page was created using markdown and IS in a paragraph</p>
    <p class="read_more">
      <a href="/mdown-page">Continue reading</a>
    </p>
    <footer>
      <p class="meta">
        Published
        on
        <time datetime="2011-09-24T00:00:00+00:00" pubdate=“”>24 September 2011</time>
        in
        <a href="/stuff">Stuff</a>
      </p>
    </footer>
  </article>
</li>
etc commented 12 years ago

I've seen this too. A quick fix for now is to put %p at the start of your summary.

gma commented 12 years ago

Yes, that is inconsistent. Thanks for the report.

I suppose we'll need to parse the summary, work out how many paragraphs there are, and insert the right number of

tags…

On 24 Sep 2011, at 18:00, Jeff Johnston wrote:

It looks like page summaries aren’t getting rendered inside a paragraph tag for pages that are written in haml.

<li>
 <article>
   <header>
     <h1>
       <a href="/haml-page">Page written in haml</a>
     </h1>
   </header>
   This page was created using haml and IS NOT in a paragraph
   <p class="read_more">
     <a href="/haml-page">Continue reading</a>
   </p>
   <footer>
     <p class="meta">
       Published
       on
       <time datetime="2011-09-24T00:00:00+00:00" pubdate=“”>24 September 2011</time>
       in
       <a href="/stuff">Stuff</a>
     </p>
   </footer>
 </article>
</li>
<li>
 <article>
   <header>
     <h1>
       <a href="/mdown-page">Page written in mdown</a>
     </h1>
   </header>
   <p>This page was created using markdown and IS in a paragraph</p>
   <p class="read_more">
     <a href="/mdown-page">Continue reading</a>
   </p>
   <footer>
     <p class="meta">
       Published
       on
       <time datetime="2011-09-24T00:00:00+00:00" pubdate=“”>24 September 2011</time>
       in
       <a href="/stuff">Stuff</a>
     </p>
   </footer>
 </article>
</li>

Reply to this email directly or view it on GitHub: https://github.com/gma/nesta/issues/75

gma commented 12 years ago

If you could check this patch out on a real site and report back, it'd be much appreciated.

To install the master branch into your site, modify your site's Gemfile like this:

gem "nesta", :git => "git@github.com:gma/nesta.git"

Cheers.

hishma commented 12 years ago

Yep, works great. Thanks!

etc commented 12 years ago

This is working fine for me with a single line, but not with multiple lines. In fact, it seems to me that Nesta scraps everything past the first line of an (attempted) multiline summary (perhaps this is related to #77; is Nesta just ignoring the remaining lines on grounds that they don't contain colons?).

gma commented 12 years ago

How are you trying to do multi-line summaries?

You need to insert "\n" in the middle of one long line in order to do multi-line summaries. I wrote a test that covers that scenario, so I'd be (a bit) surprised if it didn't work. So you could do this:

Summary: Line one\nLine two

Not the most pleasurable API, I grant you.

etc commented 12 years ago

Right, my mistake. This works for Haml pages, though not for Markdown pages. I suspect I'll just keep my summaries as a single line, which they probably should be anyway (I had noticed the problem initially not because I was trying to do multiple line summaries, but because the summaries page was producing badly spaced text on account of the missing %p tag).