To participate you must create an account on apostrophenow.com. If you have already done so, click Login.

Ticket #497 (closed defect: invalid)

Opened 7 weeks ago

Last modified 7 weeks ago

aString::limitWords is not closing opened tags

Reported by: johnnyoffline Owned by: boutell
Priority: critical Milestone: 1.4.1
Component: apostrophePlugin Version: trunk
Keywords: aString, Toolkit Cc: johnnyoffline, dordille, agilbert, rickybanister, geoffd, jake
Symfony version: 1.4

Description

Rick is using aString::limitWords and it is creating invalid markup.

Markup and content output from browser

<li class="profile">
<p>In lobortis risus quis ipsum malesuada ac placerat eros adipiscing. In vel metus quis tortor malesuada venenatis? Ut ullamcorper eros non magna eleifend eget venenatis nunc sagittis. Aliquam vestibulum libero vel velit hendrerit sit&hellip;
</li>

Code

<?php if ($person->getProfile()): ?>
  <li class="profile">
   <?php echo aString::limitWords($person->getProfile(), 40, array('append_ellipsis' => true)) ?>
  </li>
<?php endif ?>

Validation Error caused by bug

Attachments

validation-error-caused-by-aStringLimitWords.PNG (43.4 kB) - added by anonymous 7 weeks ago.

Change History

Changed 7 weeks ago by anonymous

Changed 7 weeks ago by johnnyoffline

I have an idea about why this is happening - aString::limitWords is for truncating strings, and aHtml::limitWords is for truncating html.

And the value of the object is html markup.

The problem is, aHtml::limitWords does not have an append ellipses option.

Maybe the -real- ticket here is the bridge the functionality between the two functions.

Do we really need two?

Changed 7 weeks ago by tboutell

  • status changed from new to closed
  • resolution set to invalid

HTML and plaintext are very different animals. We need two.

A more appropriate ticket, yes, would be to extend aHtml::limitWords with whatever it currently lacks. Go ahead and open that. I'm closing this one.

Changed 7 weeks ago by johnnyoffline

Tom, It wasn't as scary as I thought it was, I don't know why I didn't just do it myself.

All I had to do was pull over the ellipses option from aString to aHtml.

It works great :)

Changed 7 weeks ago by tboutell

Sounds good... could be weird though if you asked it to abbreviate something that's a block element, and the ellipses wind up after the automatically supplied closing of that element. Unless you addressed that somehow. I suppose we could just document that limitation

Changed 7 weeks ago by johnnyoffline

The ellipses is appended to the result before the closing tag. That seemed to make the most sense to me.

Changed 7 weeks ago by tboutell

Very good sir

Note: See TracTickets for help on using tickets.