inline build-html glob

This commit is contained in:
Mark McGranaghan 2012-10-01 19:17:05 -07:00
parent afefc4e649
commit f38b70f833
4 changed files with 7 additions and 15 deletions

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
build
tool/build-html-inner
tool/build-html
tool/number
tool/measure

View File

@ -1,6 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
ls src/0*/*.{go,sh} | xargs tool/build-html-inner > build/go-by-example.html

View File

@ -2,6 +2,6 @@
set -e
go build -o tool/build-html-inner tool/src/build-html-inner.go
go build -o tool/build-html tool/src/build-html.go
go build -o tool/number tool/src/number.go
go build -o tool/measure tool/src/measure.go

View File

@ -8,6 +8,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
@ -88,13 +89,11 @@ type seg struct {
}
func main() {
if len(os.Args) <= 1 {
fmt.Fprintln(os.Stderr, "usage: tool/build-html-inner *.{go,sh} > output.html")
os.Exit(1)
}
ensureCache()
sourcePaths, err := filepath.Glob("./src/0*/*")
check(err)
fmt.Print(`<!DOCTYPE html>
<html>
<head>
@ -107,7 +106,7 @@ func main() {
<table cellspacing="0" cellpadding="0">
<tbody>`)
for _, sourcePath := range os.Args[1:] {
for _, sourcePath := range sourcePaths {
lexer := whichLexer(sourcePath)
lines := readLines(sourcePath)