-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkgi-patch0001.patch
52 lines (48 loc) · 2.59 KB
/
kgi-patch0001.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
commit 53c693e01577acaec4ce87dcca295178abfdde4a
Author: Konstantin Ignatyev <[email protected]>
Date: Wed Jun 26 14:29:07 2013 -0700
changes to make project compilable
diff --git a/src/main/scala/org/specs2/text/Markdown.scala b/src/main/scala/org/specs2/text/Markdown.scala
index c5cbd27..1031631 100644
--- a/src/main/scala/org/specs2/text/Markdown.scala
+++ b/src/main/scala/org/specs2/text/Markdown.scala
@@ -19,7 +19,7 @@ trait Markdown {
* @return a Markdown processor
* for now QUOTES and SMARTS are not rendered to avoid <?> characters to appear on html pages
*/
- def processor(implicit args: Arguments) = new PegDownProcessor(args.pegdownExtensions & ~Extensions.QUOTES & ~Extensions.SMARTS, args.pegdownTimeout)
+ def processor(implicit args: Arguments) = new PegDownProcessor(args.pegdownExtensions & ~Extensions.QUOTES & ~Extensions.SMARTS)
/**
* parse the markdown string and return html.
@@ -60,7 +60,7 @@ object Markdown extends Markdown
/**
* specialised pegdown visitor to control the rendering of code blocks
*/
-case class Specs2Visitor(text: String, options: MarkdownOptions = MarkdownOptions()) extends org.pegdown.ToHtmlSerializer(new LinkRenderer) {
+case class Specs2Visitor(text: String, options: MarkdownOptions = MarkdownOptions()) extends org.pegdown.ToHtmlSerializer {
override def visit(node: CodeNode) {
printTagAndAttribute(node, "code", "class", "prettyprint")
}
@@ -79,20 +79,20 @@ case class Specs2Visitor(text: String, options: MarkdownOptions = MarkdownOption
}
}
override def visit(node: VerbatimNode) {
- if (!options.verbatim && node.getType.isEmpty && node.getText.contains("\n")) {
+ if (!options.verbatim && node.getText.contains("\n")) {
val indents = text.split("\n").filter(_.nonEmpty).map(line => line.takeWhile(_==' ').size)
val verbatim = node.getText.split("\n").map(line => line.trim)
val lines = (indents zip verbatim).map { case (indent, line) => " "*indent + line }.mkString("<br/>")
super.visit(new TextNode(lines))
}
- else super.visit(new VerbatimNode(node.getText, "prettyprint"))
+ else super.visit(new VerbatimNode(node.getText))
}
private def printTagAndAttribute(node: TextNode, tag: String, attributeName: String, attributeValue: String) {
printer.print('<').print(tag)
printer.print(' ').print(attributeName).print('=').print('"').print(attributeValue).print('"')
printer.print('>')
- printer.printEncoded(node.getText())
+ printer.printEncoded(node.getText(),this)
printer.print('<').print('/').print(tag).print('>')
}
}