Commit 1cd272d1 authored by Rob Pike's avatar Rob Pike

doc/go1: template packages have changed since r60

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5787049
parent 2b8a7add
...@@ -1953,6 +1953,38 @@ a cast that must be added by hand; the <code>go</code> <code>fix</code> tool wil ...@@ -1953,6 +1953,38 @@ a cast that must be added by hand; the <code>go</code> <code>fix</code> tool wil
</p> </p>
<h3 id="templates">The template packages</h3>
<p>
The <code>template</code> and <code>exp/template/html</code> packages have moved to
<a href="/pkg/text/template/"><code>text/template</code></a> and
<a href="/pkg/html/template/"><code>html/template</code></a>.
More significant, the interface to these packages has been simplified.
The template language is the same, but the concept of "template set" is gone
and the functions and methods of the packages have changed accordingly,
often by elimination.
</p>
<p>
Instead of sets, a <code>Template</code> object
may contain multiple named template definitions,
in effect constructing
name spaces for template invocation.
A template can invoke any other template associated with it, but only those
templates associated with it.
The simplest way to associate templates is to parse them together, something
made easier with the new structure of the packages.
</p>
<p>
<em>Updating</em>:
The imports will be updated by fix tool.
Single-template uses will be otherwise be largely unaffected.
Code that uses multiple templates in concert will need to be updated by hand.
The <a href="/pkg/text/template/#examples">examples</a> in
the documentation for <code>text/template</code> can provide guidance.
</p>
<h3 id="testing">The testing package</h3> <h3 id="testing">The testing package</h3>
<p> <p>
......
...@@ -1838,6 +1838,38 @@ a cast that must be added by hand; the <code>go</code> <code>fix</code> tool wil ...@@ -1838,6 +1838,38 @@ a cast that must be added by hand; the <code>go</code> <code>fix</code> tool wil
</p> </p>
<h3 id="templates">The template packages</h3>
<p>
The <code>template</code> and <code>exp/template/html</code> packages have moved to
<a href="/pkg/text/template/"><code>text/template</code></a> and
<a href="/pkg/html/template/"><code>html/template</code></a>.
More significant, the interface to these packages has been simplified.
The template language is the same, but the concept of "template set" is gone
and the functions and methods of the packages have changed accordingly,
often by elimination.
</p>
<p>
Instead of sets, a <code>Template</code> object
may contain multiple named template definitions,
in effect constructing
name spaces for template invocation.
A template can invoke any other template associated with it, but only those
templates associated with it.
The simplest way to associate templates is to parse them together, something
made easier with the new structure of the packages.
</p>
<p>
<em>Updating</em>:
The imports will be updated by fix tool.
Single-template uses will be otherwise be largely unaffected.
Code that uses multiple templates in concert will need to be updated by hand.
The <a href="/pkg/text/template/#examples">examples</a> in
the documentation for <code>text/template</code> can provide guidance.
</p>
<h3 id="testing">The testing package</h3> <h3 id="testing">The testing package</h3>
<p> <p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment