inline build-html glob
This commit is contained in:
parent
afefc4e649
commit
f38b70f833
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,4 @@
|
||||
build
|
||||
tool/build-html-inner
|
||||
tool/build-html
|
||||
tool/number
|
||||
tool/measure
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user