1
0
mirror of https://github.com/golang/go synced 2024-11-13 18:50:24 -07:00
go/lib/godoc
Volker Dobler d97b975d5c cmd/godoc: show examples in text mode
Added the command line flag -ex to godoc to print examples in
text output.

Samples from the generated output:

$ godoc -ex strings Index
...
func Index(s, sep string) int
    Index returns the index of the first instance of sep in s, or -1 if sep
    is not present in s.

    Example:
        fmt.Println(strings.Index("chicken", "ken"))
        fmt.Println(strings.Index("chicken", "dmr"))
        // Output:
        // 4
        // -1
...

$ godoc -ex container/heap
...
package heap
    import "container/heap"

    Package heap provides heap operations for any type that implements
    heap.Interface. A heap is a tree with the property that each node is the
    minimum-valued node in its subtree.

    Example:
        // This example demonstrates an integer heap built using the heap interface.
        package heap_test

        import (
            "container/heap"
            "fmt"
        ...

    Example:
        // This example demonstrates a priority queue built using the heap interface.
        package heap_test

        import (
            "container/heap"
            "fmt"
        )
...

Fixes #3587.

R=golang-dev, minux.ma, adg, rsc, gri
CC=golang-dev
https://golang.org/cl/7356043
2013-02-25 10:37:17 +11:00
..
codewalk.html lib/godoc/codewalk.html: remove duplicate jquery inclusion 2012-11-18 02:28:54 +08:00
codewalkdir.html godoc: template cleanup 2011-08-17 16:38:58 -07:00
dirlist.html godoc: template cleanup 2011-08-17 16:38:58 -07:00
error.html godoc: first round of template cleanups 2011-08-12 10:06:32 -07:00
example.html lib/godoc/example.html: htmlify the play code 2012-12-13 19:08:51 +08:00
godoc.html godoc: add dropdown playground to nav bar 2012-10-10 11:17:47 +11:00
opensearch.xml godoc: added an opensearch description document. 2011-12-12 18:01:06 -05:00
package.html cmd/godoc: use go/build to determine package and example files 2013-02-19 11:19:58 -08:00
package.txt cmd/godoc: show examples in text mode 2013-02-25 10:37:17 +11:00
search.html lib/godoc: removing leading / from search links 2012-03-15 14:50:51 -04:00
search.txt godoc: fine tuning of template file 2011-09-08 18:27:26 -07:00