Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
1ddedbae
Commit
1ddedbae
authored
Dec 08, 2011
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tmpltohtml: put a DO NOT EDIT mark automatically in the output
R=r, rsc, r CC=golang-dev
https://golang.org/cl/5469045
parent
0397b28a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
1 deletion
+25
-1
effective_go.html
doc/effective_go.html
+5
-0
effective_go.tmpl
doc/effective_go.tmpl
+1
-0
go_tutorial.html
doc/go_tutorial.html
+6
-0
go_tutorial.tmpl
doc/go_tutorial.tmpl
+2
-0
tmpltohtml.go
doc/tmpltohtml.go
+11
-1
No files found.
doc/effective_go.html
View file @
1ddedbae
<!-- Effective Go -->
<!--
DO NOT EDIT: created by
tmpltohtml effective_go.tmpl
-->
<h2
id=
"introduction"
>
Introduction
</h2>
...
...
doc/effective_go.tmpl
View file @
1ddedbae
<
!-- Effective Go -->
{{
donotedit
}}
<
h2
id
=
"introduction"
>
Introduction
</
h2
>
...
...
doc/go_tutorial.html
View file @
1ddedbae
<!-- 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
...
...
doc/go_tutorial.tmpl
View file @
1ddedbae
<
!-- 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
...
...
doc/tmpltohtml.go
View file @
1ddedbae
...
...
@@ -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
(
template
Funcs
)
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment