Граф коммитов

20 Коммитов

Автор SHA1 Сообщение Дата
Rebecca Stambler d33bae4414 copyright: test that all files in the repo have copyright notices
Adapted the script that I used to automatically add copyright notices
into a test that all files in the repository currently have appropriate
copyrights. Caught a few typos and extra spaces, which I decided to fix
rather than adjust regular expression.

Change-Id: Ifdbad969eca482e25c89afc5a2ddd5968c6661a6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/282592
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-01-11 22:19:46 +00:00
Russ Cox 644a21fb14 blog: use serial comma in long author lists
This is the Go blog house style for the rest of the text.
We just missed the author list, presumably because it
was less code (only two entries still has no comma).

Change-Id: I8bb1ab582d6e300d521ac471736ee8ab6e0f61ec
Reviewed-on: https://go-review.googlesource.com/c/tools/+/225517
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-25 19:41:47 +00:00
Russ Cox ba25ddc855 blog: use first OldURL to generate atom feed ID
This way, renaming an article does not make it reappear
in an RSS reader as a new article.

Change-Id: I4e92707f9ea4983bf8506cde826d5e5f48a3b36f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223751
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-03-18 15:00:45 +00:00
Russ Cox b304dfc3e0 present: add OldURL metadata and use for redirects in blog
This will allow renaming blog pages to have shorter,
more easily typed URLs, while keeping the old links working.

Change-Id: I2cd6733eaaf02a4b8e73afc773173c655d317ee6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223603
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-03-17 20:53:37 +00:00
Lars Lehtonen 61f5e7d299 blog: fix swallowed error
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: d740e91601
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>
2019-12-18 19:17:56 +00:00
Dmitri Shuralyov 3769738f41 blog: add support for optional analytics HTML
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>
2019-10-02 16:18:51 +00:00
Agniva De Sarker 327197e6b0 godoc,blog: perform minor cleanup
- 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>
2018-04-14 19:30:04 +00:00
Agniva De Sarker 8723cc7387 blog: revert strings.Builder to bytes.Buffer
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>
2018-04-14 19:22:41 +00:00
Agniva De Sarker d11f6ec946 blog: serve relative links when run locally
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.

Fixes golang/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>
2018-04-13 18:10:15 +00:00
Agniva De Sarker 8ea45f9674 blog: show a helpful error for invalid template directory
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.

Fixes golang/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>
2018-01-15 07:04:26 +00:00
Alexander Kauer bd1cf89d8f blog/atom: support atom:link as in RFC4287 4.2.7
Change-Id: Id704a4b1f0deca1e9b090dd1fc21e7b1b55478ec
Reviewed-on: https://go-review.googlesource.com/36281
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-04 21:42:09 +00:00
David Symonds 24257c8cd2 tools: add import comments.
Change-Id: Idda6e64580432cb9a731e4ebf4005ee4ceb4202d
Reviewed-on: https://go-review.googlesource.com/1244
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 22:42:16 +00:00
Andrew Gerrand 5ebbcd132f go.tools: use golang.org/x/... import paths
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
2014-11-10 08:50:40 +11:00
Andrew Gerrand 50d9adec93 go.tools/blog: strip prefix when serving static content
This fix permits godoc to serve images correctly under /blog/.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/22700043
2013-11-08 13:28:32 +11:00
Brian Gitonga Marete 4a813e4058 blog: Fix atom feed's `updated' time when there's only one article.
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
2013-10-29 15:55:27 +09:00
Brian Gitonga Marete f3120b161e blog: Make the atom feed title configurable.
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
2013-10-28 10:17:10 +02:00
Tw da6f00a60b go.tools/blog: replace "\\" with "/" in path string to be compatible with windows platform
Fixes golang/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
2013-10-08 16:55:56 +11:00
Andrew Gerrand 228e3cbbaa go.tools/blog: remove playground package import
This is the responsibility of the godoc or blog binary,
not the blog package.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14323043
2013-10-03 15:07:29 +10:00
Andrew Gerrand cc069b6297 go.tools/blog: use atom and present packages from go.tools
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13244050
2013-09-19 10:58:36 +10:00
Andrew Gerrand 2cac03d805 go.tools/blog/atom: move package from go.blog
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13368058
2013-09-19 10:58:11 +10:00