mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 22:45:51 +01:00
(refs #532) Fix rendering of link over image
This commit is contained in:
@@ -195,6 +195,32 @@ class GitBucketHtmlSerializer(
|
||||
printTag(node, "li")
|
||||
}
|
||||
}
|
||||
|
||||
override def visit(node: ExpLinkNode) {
|
||||
printLink(linkRenderer.render(node, printLinkChildrenToString(node)))
|
||||
}
|
||||
|
||||
def printLinkChildrenToString(node: SuperNode) = {
|
||||
val priorPrinter = printer
|
||||
printer = new Printer()
|
||||
visitLinkChildren(node)
|
||||
val result = printer.getString()
|
||||
printer = priorPrinter
|
||||
result
|
||||
}
|
||||
|
||||
def visitLinkChildren(node: SuperNode) {
|
||||
import scala.collection.JavaConversions._
|
||||
node.getChildren.foreach(child => child match {
|
||||
case node: ExpImageNode => visitLinkChild(node)
|
||||
case node: SuperNode => visitLinkChildren(node)
|
||||
case _ => child.accept(this)
|
||||
})
|
||||
}
|
||||
|
||||
def visitLinkChild(node: ExpImageNode) {
|
||||
printer.print("<img src=\"").print(fixUrl(node.url, true)).print("\" alt=\"").printEncoded(printChildrenToString(node)).print("\"/>")
|
||||
}
|
||||
}
|
||||
|
||||
object GitBucketHtmlSerializer {
|
||||
|
||||
Reference in New Issue
Block a user