Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(258)

Issue 4152042: code review 4152042: go/printer: remove notion of "Styler", remove HTML mode (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 1 month ago by gri
Modified:
13 years, 8 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

go/printer: remove notion of "Styler", remove HTML mode Neither gofmt nor godoc are making use of a Styler (for token-specific formatting) anymore. Stylers interacted in complicated ways with HTML-escaping which was why the printer needed an HTML mode in the first place. godoc now uses a more powerful and general text formatting function that does HTML escaping, text selection, and can handle token-specific formatting if so desired (currently used only for comments). As a consequence, cleaned up uses of go/printer in godoc; simplified the various write utility functions, and also removed the need for the "html" template format (in favor of html-esc which now does the same and is used more pervasively). Applied gofmt -w src misc to verify no changes occured, and tested godoc manually. There should be no visible changes except that (type) code snippets presented for godoc package documentation now uses the same formatting as for general source code and thus comments get the comment-specific color here as well (not the case at the moment). (TODO: godoc needs a good automatic test suite).

Patch Set 1 #

Patch Set 2 : diff -r a92de010b83d https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r a92de010b83d https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r a92de010b83d https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r a92de010b83d https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r a92de010b83d https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -200 lines) Patch
M lib/godoc/package.html View 1 2 3 4 2 chunks +10 lines, -11 lines 0 comments Download
M src/cmd/godoc/format.go View 1 2 4 chunks +7 lines, -14 lines 0 comments Download
M src/cmd/godoc/godoc.go View 1 2 3 4 5 chunks +35 lines, -40 lines 0 comments Download
M src/cmd/godoc/main.go View 1 1 chunk +5 lines, -1 line 0 comments Download
M src/cmd/godoc/snippet.go View 1 1 chunk +8 lines, -3 lines 0 comments Download
M src/cmd/gofmt/gofmt.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/go/printer/printer.go View 1 13 chunks +17 lines, -130 lines 0 comments Download

Messages

Total messages: 3
gri
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years, 1 month ago (2011-02-08 21:51:45 UTC) #1
rsc
LGTM
14 years, 1 month ago (2011-02-09 03:25:52 UTC) #2
gri
14 years, 1 month ago (2011-02-09 17:52:37 UTC) #3
*** Submitted as http://code.google.com/p/go/source/detail?r=631587dfe17f ***

go/printer: remove notion of "Styler", remove HTML mode

Neither gofmt nor godoc are making use of a Styler (for
token-specific formatting) anymore. Stylers interacted in complicated
ways with HTML-escaping which was why the printer needed an HTML mode
in the first place.

godoc now uses a more powerful and general text formatting
function that does HTML escaping, text selection, and can
handle token-specific formatting if so desired (currently
used only for comments).

As a consequence, cleaned up uses of go/printer in godoc;
simplified the various write utility functions, and also
removed the need for the "html" template format (in favor of
html-esc which now does the same and is used more pervasively).

Applied gofmt -w src misc to verify no changes occured,
and tested godoc manually.

There should be no visible changes except that (type) code
snippets presented for godoc package documentation now
uses the same formatting as for general source code and
thus comments get the comment-specific color here as well
(not the case at the moment).

(TODO: godoc needs a good automatic test suite).

R=rsc
CC=golang-dev
http://codereview.appspot.com/4152042

Committer: Robert Griesemer <gri@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b