fix #15 - Add Filter for each a source
fix #13 - Modify the name to 'HomePage' from 'TopPage'
Disable HARDWRAPS extension of PegDownProcessor
Modify a name to 'source directory' from 'pages directory'
[from now] 2014/08/20 18:53:43

diff --git a/src/main/groovy/gaiden/BindingBuilder.groovy b/src/main/groovy/gaiden/BindingBuilder.groovy
index 467515c..b604689 100644
--- a/src/main/groovy/gaiden/BindingBuilder.groovy
+++ b/src/main/groovy/gaiden/BindingBuilder.groovy
@@ -233,6 +233,7 @@ class BindingBuilder {
         }

         def processor = new GaidenMarkdownProcessor()
+
         processor.markdownToHtml(file.text)
     }
 }
diff --git a/src/main/groovy/gaiden/markdown/HeaderParser.groovy b/src/main/groovy/gaiden/markdown/HeaderParser.groovy
index a24a0db..54e11bc 100644
--- a/src/main/groovy/gaiden/markdown/HeaderParser.groovy
+++ b/src/main/groovy/gaiden/markdown/HeaderParser.groovy
@@ -19,6 +19,7 @@ package gaiden.markdown
 import gaiden.Header
 import groovy.transform.CompileStatic
 import org.apache.commons.codec.digest.DigestUtils
+import org.apache.commons.lang3.StringEscapeUtils
 import org.pegdown.LinkRenderer
 import org.pegdown.ToHtmlSerializer
 import org.pegdown.ast.GaidenHeaderNode
@@ -44,7 +45,9 @@ class HeaderParser extends ToHtmlSerializer {

     @Override
     void visit(HeaderNode headerNode) {
+        println "*" * 10
         def title = new HeaderTextSerializer(headerNode).text
+        println title
         def hash = getHash(title, headerNode)
         headers << new Header(
             title: title,
@@ -97,9 +100,15 @@ class HeaderParser extends ToHtmlSerializer {

         String getText() {
             headerNode.children.each { Node node ->
+                println node.class
                 node.accept(this)
             }
-            printer.string
+
+            printer.string.replaceAll(/<code>(.+?)<\/code>/) { List<String> matches ->
+                println matches[0]
+                println matches[1]
+                StringEscapeUtils.escapeHtml4(matches[0] as String)
+            }.replaceAll(/<.+?>/, "")
         }
     }
 }
diff --git a/src/test/resources/test-project/headers/README.md b/src/test/resources/test-project/headers/README.md
index 22186cf..56a243c 100644
--- a/src/test/resources/test-project/headers/README.md
+++ b/src/test/resources/test-project/headers/README.md
@@ -85,3 +85,5 @@ Header2{#myid36}

 Header2   {#myid37 .class-1 .class_2}
 -------
+
+# Header1 <span>xxx</span> [link](http://example.com) `<code block>`