A function created for filepath.Walk in the blog package accepts an error
as its third argument, but then does nothing with it. This change picks up
the dropped error and returns it should it be non-nil.
Change-Id: I68786f7f1f2accbe527994e2d3e7b2f3da257a2d
GitHub-Last-Rev: d740e91601833d1033a6b9709a6c333f9dc3c1bc
GitHub-Pull-Request: golang/tools#183
Reviewed-on: https://go-review.googlesource.com/c/tools/+/203884
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This change makes it possible for users of the blog package
to provide analytics HTML, which can then be inserted on pages.
Previously, this was possible by making ad-hoc modifications
to the template files. It's easier to have a dedicated field.
Change-Id: Id7c24dc9c7b5b9e23d18f3987f2f1af27c709681
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198323
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- Remove a stray comment which was no longer needed. The accompanying
issue golang.org/issue/7524 was discussed and closed.
- Combine 2 if conditions into a single if-else because
length of a slice can never be negative.
- Remove http links from golangOrgAbsLinkReplacer now that all
links have been changed to https in the blog articles.
Change-Id: I2fe2ec245b580a91760c9331e9626b367f1b6740
Reviewed-on: https://go-review.googlesource.com/107155
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The blog repo can still be imported by older Go versions. Hence,
we need to maintain backward compatibility.
Change-Id: I0235d888734c2f191d04924815f8ffea0239aace
Reviewed-on: https://go-review.googlesource.com/107175
Run-TryBot: Kevin Burke <kev@inburke.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Currently, links inside blog articles are absolute links to golang.org.
But when a godoc server is run locally, the blog package should
serve local links pointing to the local godoc server. It is not possible
to simply change the links inside the blog templates to relative urls
because the blog articles are independant pages on their own.
And moreover, they are served from blog.golang.org.
Rather, the blog package consumes and serves blog articles.
So, a flag was added in the Config struct to denote whether
to convert the links or not. This flag is then set from the
call site in godoc package where the blog server is initialized from.
This was required because "golang.org/x/tools/blog" is a package
which can be used by other code to serve blog pages and not just godoc.
This preserves existing functionality for all working code which
imports "golang.org/x/tools/blog" and changes the functionality only
when a godoc server is run locally.
And while here, replace relevant bytes.Buffer occurences
with strings.Builder.
Fixesgolang/go#22681
Change-Id: I7dbf9c5f2f93fd0b7e17915238de1c084fcd1431
Reviewed-on: https://go-review.googlesource.com/105835
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Currently, if the blog binary is executed outside the root directory
without any additional flags, it bails out with the following error -
"open template/root.tmpl: no such file or directory"
This CL prints out a more user friendly error which allows the user to
learn that there is a flag with which the template directory can be set.
Fixesgolang/go#22622
Change-Id: I726e7c28f5e5036146769ca01516368f45a6262c
Reviewed-on: https://go-review.googlesource.com/86855
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Rewrite performed with this command:
sed -i '' 's_code.google.com/p/go\._golang.org/x/_g' \
$(grep -lr 'code.google.com/p/go.' *)
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/170920043
When computing the time for the "updated" tag of the atom feed, the
current code checks if there is more than one article and if that is
not true, it sets the time to the zero time.Time. This means that
the feed also gets the zero time in this tag when there is exactly one
article.
This trivial patch fixes this so that when there is exactly one
article, the time is set to that article's time.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/18420044
The blog code is quite generic and with the replacement of template and
static files, it can be re-used. But the atom feed title is hard-coded
into the code. This patch adds a field to set the atom feed title to
the Config structure and uses it in the code where the title was
previously hard-coded.
A CL sent separately will set this Config field in the main package in
the go.blog sub-repository. (See CL 16850043 for that other patch).
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/16830043
Fixesgolang/go#6539
The problem happens on my win7,
for example, the path is "/content\\foo.article".
It leads to the wrong link in generated html page.
So I think we should replace all"\\" with "/" in path string at first.
R=golang-dev, dsymonds, mirtchovski, dave, adg, alex.brainman
CC=golang-dev
https://golang.org/cl/14023043