]> Cypherpunks repositories - gostls13.git/commitdiff
tmpltohtml: put a DO NOT EDIT mark automatically in the output
authorRob Pike <r@golang.org>
Thu, 8 Dec 2011 19:26:49 +0000 (11:26 -0800)
committerRob Pike <r@golang.org>
Thu, 8 Dec 2011 19:26:49 +0000 (11:26 -0800)
R=r, rsc, r
CC=golang-dev
https://golang.org/cl/5469045

doc/effective_go.html
doc/effective_go.tmpl
doc/go_tutorial.html
doc/go_tutorial.tmpl
doc/tmpltohtml.go

index 8ce72fc19604a585152a906fae6e4939722221ab..e825f747abf3515050d5e2bfa9141150e451e581 100644 (file)
@@ -1,4 +1,9 @@
 <!-- Effective Go -->
+<!--
+  DO NOT EDIT: created by
+    tmpltohtml effective_go.tmpl
+-->
+
 
 <h2 id="introduction">Introduction</h2>
 
index bd19f95d344a230b52f3a02150b6c45698056cfd..8ca4902c3b422707d204a9620a21e40d0461c117 100644 (file)
@@ -1,4 +1,5 @@
 <!-- Effective Go -->
+{{donotedit}}
 
 <h2 id="introduction">Introduction</h2>
 
index 423abe8b0a44fa92f5fba241eead1d58d6b09720..145ea211066058cc0058ce5d62d48169b53b9663 100644 (file)
@@ -1,4 +1,10 @@
 <!-- A Tutorial for the Go Programming Language -->
+<!--
+  DO NOT EDIT: created by
+    tmpltohtml go_tutorial.tmpl
+-->
+
+
 <h2>Introduction</h2>
 <p>
 This document is a tutorial introduction to the basics of the Go programming
index d1219b47edd6ac911bcf4c72796604a2d4b84b0e..2a583e2f494a8f6ca9e0e565e602e7a4ede421bd 100644 (file)
@@ -1,4 +1,6 @@
 <!-- A Tutorial for the Go Programming Language -->
+{{donotedit}}
+
 <h2>Introduction</h2>
 <p>
 This document is a tutorial introduction to the basics of the Go programming
index 1e3424cf5efeaae59d327a4968a9f2f3721799ea..84a47d6ed2bd8b00849534e2350b81642ebe77ae 100644 (file)
@@ -35,6 +35,11 @@ func Usage() {
        os.Exit(2)
 }
 
+var templateFuncs = template.FuncMap{
+       "code":      code,
+       "donotedit": donotedit,
+}
+
 func main() {
        flag.Usage = Usage
        flag.Parse()
@@ -44,7 +49,7 @@ func main() {
 
        // Read and parse the input.
        name := flag.Args()[0]
-       tmpl := template.New(name).Funcs(template.FuncMap{"code": code})
+       tmpl := template.New(name).Funcs(templateFuncs)
        if _, err := tmpl.ParseFiles(name); err != nil {
                log.Fatal(err)
        }
@@ -80,6 +85,11 @@ func format(arg interface{}) string {
        return ""
 }
 
+func donotedit() string {
+       // No editing please.
+       return fmt.Sprintf("<!--\n  DO NOT EDIT: created by\n    tmpltohtml %s\n-->\n", flag.Args()[0])
+}
+
 func code(file string, arg ...interface{}) (string, error) {
        text := contents(file)
        var command string