Textile parser outputs non-valid output
The documentation for MetaData indicates that when the attribute list is empty, it should be scala.xml.Null (not null). Block quotes and footnotes return an element with a null attribute list:
(TextileParser.toHtml("bq. Block quote") \ "p").map(_.attributes).first
Here's a short patch:
(TextileParser.toHtml("bq. Block quote") \ "p").map(_.attributes).first
Here's a short patch:
--- lift-textile/src/main/scala/net/liftweb/textile/TextileParser.scala Fri Oct 9 23:22:53 2009 +++ lift-textile_patch/src/main/scala/net/liftweb/textile/TextileParser.scala Fri Oct 9 23:22:37 2009 @@ -995,7 +995,7 @@ case class BlockQuote(elems : List[Textile], attrs : List[Attribute]) extends ATextile(elems, attrs) { override def toHtml : NodeSeq = { - val par : NodeSeq = XmlElem(null, "p", null, TopScope, flattenAndDropLastEOL(elems) : _*) ++ Text("\n") + val par : NodeSeq = XmlElem(null, "p", Null, TopScope, flattenAndDropLastEOL(elems) : _*) ++ Text("\n") XmlElem(null, "blockquote", fromStyle(attrs), TopScope, par : _*) ++ Text("\n") } } @@ -1023,7 +1023,7 @@ case class Footnote(elems : List[Textile], attrs : List[Attribute], num : String) extends ATextile(elems, attrs) { override def toHtml : NodeSeq = { XmlElem(null, "p", fromStyle(AnyAttribute("id", "fn"+num) :: attrs), TopScope, - (XmlElem(null, "sup", null, TopScope, Text(num) : _*) :: flattenAndDropLastEOL(elems)) : _*) ++ Text("\n") + (XmlElem(null, "sup", Null, TopScope, Text(num) : _*) :: flattenAndDropLastEOL(elems)) : _*) ++ Text("\n") } }
Leave a comment
on 2010-02-06 15:18 *
By github.importer
Imported from GitHub: http://github.com/dpp/liftweb/issues/94/find