diff --git a/src/contents/contents.html b/src/contents/contents.html
index 1e8b6cd..6a46643 100644
--- a/src/contents/contents.html
+++ b/src/contents/contents.html
@@ -1,7 +1,7 @@
`, indexName)
+ if (indexName == "title") || (indexName == "contents") || (indexName == "introduction") {
+ sourcePath := "src/" + indexName + "/" + indexName + ".html"
+ sourceBytes, err := ioutil.ReadFile(sourcePath)
+ if err != nil {
+ panic(err)
+ }
+ _, err = outF.Write(sourceBytes)
+ if err != nil {
+ panic(err)
+ }
+ } else {
+ chapterPath := "src/" + indexName
+ fmt.Fprintf(outF,
+ `
`,
+ chapterPath)
+ sourcePaths := mustGlob(chapterPath + "/*")
+ for _, sourcePath := range sourcePaths {
+ if strings.HasSuffix(sourcePath, ".go") || strings.HasSuffix(sourcePath, ".sh") {
+ segs := parseAndRenderSegs(sourcePath)
+ for _, seg := range segs {
+ codeClasses := "code"
+ if seg.code == "" {
+ codeClasses = codeClasses + " empty"
+ }
+ fmt.Fprintf(outF,
+ `
+ %s |
+ %s |
+
`,
+ seg.docsRendered, codeClasses, seg.codeRendered)
+ }
+ }
+ }
+ fmt.Fprint(outF, `
`)
+ }
+ fmt.Fprintf(outF, `
`)
+ }
+ fmt.Fprint(outF, ``)
}
diff --git a/tool/build-pdf b/tool/build-pdf
index 9bc8d64..f0bdc86 100755
--- a/tool/build-pdf
+++ b/tool/build-pdf
@@ -1,3 +1,3 @@
#!/bin/bash
-exec prince build/gobyexample.html -o build/gobyexample.pdf
+exec prince $1 -o $2
diff --git a/tool/gofmt b/tool/gofmt
index 31481f7..1afd1ba 100755
--- a/tool/gofmt
+++ b/tool/gofmt
@@ -3,4 +3,4 @@
set -e
set -o pipefail
-ls tool/src/*.go src/*/*.go | xargs gofmt -tabs=false -tabwidth=4 -w=true
+ls tool/*.go src/*/*.go | xargs gofmt -tabs=false -tabwidth=4 -w=true