Permalink
Browse files

Changed readChild to function model.

  • Loading branch information...
inca committed Apr 17, 2012
1 parent 29b9f8b commit 900cfd850e1a2ea922b28d44e2404ea5c4bca140
Showing with 12 additions and 7 deletions.
  1. +1 −1 circumflex-markeven/src/main/scala/inline.scala
  2. +11 −6 circumflex-xml/src/main/scala/holder.scala
@@ -33,13 +33,13 @@ class InlineProcessor(val out: Writer, val conf: MarkevenConf = EmptyMarkevenCon
if (tryMedia(walk)) return
if (tryLink(walk)) return
// Now generic characters
+ out.write(conf.scrambler.getSpan)
flushGeneric(walk)
}
/*! Generic characters are spit to the output "as is". */
def flushGeneric(walk: Walker) {
out.write(walk.current)
- out.write(conf.scrambler.getSpan)
walk.skip()
}
@@ -160,18 +160,23 @@ trait ListHolder[T <: ElemHolder]
this
}
- def readChild(it: TagIterator): Option[T]
+ def readChild: String => T
def readXml(it: TagIterator): this.type = {
if (accept(it)) {
set(Nil)
findAttrs.foreach(a => a.readXml(it))
it.takeWhile(_ != EndTag(elemName)) foreach {
- case t: StartTag => readChild(it) map {
- c =>
- c.readXml(it)
- addChild(c)
- }
+ case t: StartTag =>
+ try {
+ val child = readChild(t.name)
+ child.readXml(it)
+ addChild(child)
+ } catch {
+ case e: MatchError =>
+ XML_LOG.warn("Unexpected element <" + t.toString + ">. " +
+ "Please check `readChild` or XML input.")
+ }
case _ =>
}
}

0 comments on commit 900cfd8

Please sign in to comment.