/doc/codewalk/
name
is loaded from the input file $GOROOT/doc/codewalk/
name.xml
.
$GOROOT/doc/codewalk/codewalk.xml
,
shown in the main window pane to the left.
<codewalk>
element.
That element's title
attribute gives the title
that is used both on the codewalk page and in the codewalk list.
<step>
element
nested inside the main <codewalk>
.
The step element's title
attribute gives the step's title,
which is shown in a shaded bar above the main step text.
The element's src
attribute specifies the source
code to show in the main window pane and, optionally, a range of
lines to highlight.
src
is just a file name.
src
attribute of the form
filename:
address,
where address is an address in the syntax used by the text editors sam and acme.
/title=/
,
which matches the first instance of that regular expression (title=
) in the file.
/
regexp1/,/
regexp2/
.
The highlight begins with the line containing the first match for regexp1
and ends with the line containing the first match for regexp2
after the end of the match for regexp1.
Ignoring the HTML quoting,
The line containing the first match for regexp1 will be the first one highlighted,
and the line containing the first match for regexp2.
/<step/,/step>/
looks for the first instance of
<step
in the file, and then starting after that point,
looks for the first instance of step>
.
(Click on the “Steps” step above to see the highlight in action.)
Note that the <
and >
had to be written
using XML escapes in order to be valid XML.
/
regexp/
and /
regexp1/,/
regexp2/
forms suffice for most highlighting.
sam
):
Simple addresses | |
# n |
The empty string after character n |
n | Line n |
/ regexp/ |
The first following match of the regular expression |
$ |
The null string at the end of the file |
Compound addresses | |
a1+ a2 |
The address a2 evaluated starting at the right of a1 |
a1- a2 |
The address a2 evaluated in the reverse direction starting at the left of a1 |
a1, a2 |
From the left of a1 to the right of a2 (default 0,$ ). |