Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

sanitizing singlehtml toc

  • Loading branch information...
commit adcb46159df752671974e3f720914fec0b27fe9c 1 parent db74e98
csokol csokol authored
7 src/test/java/br/com/caelum/tubaina/parser/html/desktop/SingleHtmlTOCGeneratorTest.java
View
@@ -33,10 +33,9 @@ public void shouldCreateATOCFromBook() throws Exception {
SingleHtmlTOCGenerator tocGenerator = new SingleHtmlTOCGenerator(build, cfg);
String toc = tocGenerator.generateTOC().toString();
-
- assertTrue(toc.contains("O que é java"));
- assertTrue(toc.contains("Primeira seção"));
- assertTrue(toc.contains("Segunda seção"));
+ assertTrue(toc.contains("O que é java"));
+ assertTrue(toc.contains("Primeira seção"));
+ assertTrue(toc.contains("Segunda seção"));
}
6 templates/singlehtml/chapter.ftl
View
@@ -1,6 +1,6 @@
<div class="chapter referenceable">
- <div class="chapterHeader">Capítulo<span>${chapter.chapterNumber}</span></div>
- <h1 class="referenceableTitle">${chapter.title}</h1>
+ <div class="chapterHeader">Cap&iacute;tulo<span>${chapter.chapterNumber}</span></div>
+ <h1 class="referenceableTitle">${sanitizer.sanitize(chapter.title)}</h1>
${chapter.getIntroduction(parser)}
@@ -18,4 +18,4 @@
<#assign sectionCount = sectionCount + 1>
</#list>
- </div>
+ </div>
6 templates/singlehtml/toc.ftl
View
@@ -2,14 +2,14 @@
<#assign chapterCount = 1>
<ul>
<#list book.chapters as chapter>
- <li>${chapterCount} - ${chapter.title}</li>
+ <li>${chapterCount} - ${sanitizer.sanitize(chapter.title)}</li>
<#assign sectionCount = 1>
<ul>
<#list chapter.sections as section>
- <li>${sectionCount} - ${section.title}</li>
+ <li>${sectionCount} - ${sanitizer.sanitize(section.title)}</li>
</#list>
</ul>
<#assign chapterCount = chapterCount + 1>
</#list>
</ul>
-</div>
+</div>
Please sign in to comment.
Something went wrong with that request. Please try again.