Browse files

Merge pull request #9 from amataes/patch-1

Updated single.pdf generation
  • Loading branch information...
2 parents dd569ce + e276d6f commit cdbe6633d0910b0981c2e359dac1b4d05852eeb8 @bluesliverx bluesliverx committed Nov 2, 2012
Showing with 18 additions and 3 deletions.
  1. +4 −0 src/groovy/grails/plugins/newdoc/PdfBuilder.groovy
  2. +14 −3 src/template/style/layout.html
View
4 src/groovy/grails/plugins/newdoc/PdfBuilder.groovy
@@ -53,6 +53,10 @@ class PdfBuilder {
public static String createXml(File htmlFile, String base) {
String xml = htmlFile.text
+
+ //file paths are not a URIs in Windows
+ if (System.properties['os.name'].toLowerCase().contains('windows')){ base = '/' + base.replaceAll('\\\\', '/'); }
+
// fix inner anchors
xml = xml.replaceAll('<a href="\\.\\./guide/single\\.html', '<a href="')
View
17 src/template/style/layout.html
@@ -52,8 +52,19 @@
<% if (sponsorLogo) { %>
<span id="sponsor">${sponsorLogo}</span>
<% } %>
- </div>
- <p>${subtitle.encodeAsHtml()}</p>
+ </div
+ <%
+ if (single) {
+ %>
+ <p>${subtitle}</p>
+ <%
+ }
+ else {
+ %>
+ <p>${subtitle.encodeAsHtml()}</p>
+ <%
+ }
+ %>
</div>
@@ -77,7 +88,7 @@
sectionWriter = { lvl, section, topSection, prefix ->
if (single) {
%>
- <div class="toc-item" style="margin-left:${lvl * 10}px"><a href="#${ section.name.encodeAsUrlFragment().encodeAsHtml() }"><strong>$prefix</strong><span>${section.title?.encodeAsHtml()}</span></a></div>
+ <div class="toc-item" style="margin-left:${lvl * 10}px"><a href="#${ section.name.encodeAsUrlFragment().encodeAsHtml() }"><strong>$prefix</strong><span>${section.title}</span></a></div>
<%
}
else {

0 comments on commit cdbe663

Please sign in to comment.