commit | 5b97e2cceb90b86195660efe8a92cab5316017b5 | [log] [tgz] |
---|---|---|
author | Wyatt Allen <wyatta@google.com> | Thu Nov 03 17:35:32 2016 -0700 |
committer | Wyatt Allen <wyatta@google.com> | Tue Nov 22 09:39:50 2016 -0800 |
tree | 9754427162031c1e42ebaf345592096ff2e397b6 | |
parent | 84c49a63d25a002af11d516b5190801d09c2f1a2 [diff] |
Wiki-like comment formatting for HTML emails Parse reviewer comments into an array of "format blocks" and pass them into Soy templates for HTML emails where the blocks can be traversed and safely set in appropriate HTML tags. A parameterized private template is provided in Soy for convenient formatting. This format language matches the existing style in the GWT UI as much as possible. Parsing code is borrowed from the gerrit-gwtexpui SafeHtml classes (which are too tightly coupled to GWT to be used for email). In this change, however, a stricter approach to escaping is employed. GWTEXPUI SafeHtml Mail CommentFormatter (Existing) | (New) +----------------------------+ | +----------------------------+ | `SafeHtml#wikify` | | `CommentFormatter#parse` | | Decompose the comment | | | Decomposes the comment | | string into blocks. | | string into blocks. | +----------------------------+ | +----------------------------+ | | | | v | +----------------------------+ v | | Traverse blocks and emit | +----------------------------+ | block objects that contain | | Traverse blocks and emit | | | unescaped text content. | | calls to SafeHtmlBuilder | +----------------------------+ | methods to wrap comment | | | | text in appropriate tags. | v | (HTML escaping is added | | +----------------------------+ | here, based on the builder | | Pass block objects to Soy. | | methods used.) | | +----------------------------+ +----------------------------+ | | | v | +----------------------------+ | | | Soy traverses blocks and | v | constructs HTML in the | +----------------------------+ | | same manner as other mail | | Inject resulting HTML. | | content. (HTML escaping is | | The HTML is assumed to | | | done here for free via | | be safe by construction. | | Soy auto-escaping.) | +----------------------------+ | +----------------------------+ Test cases are adapted from SafeHtml to ensure that CommentFormatter functions in the same way. However, CommentFormatter differs from SafeHtml in two small ways: * CommentFormatter does not linkify URLs (email clients generally do this). * CommentFormatter does not encode nested blockquotes. Feature: Issue 4861 Change-Id: I8e11d363b80bff0b6395f56e210b636f68db36fa
Gerrit is a code review and project management tool for Git based projects.
Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.
Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer.
For information about how to install and use Gerrit, refer to the documentation.
Our canonical Git repository is located on googlesource.com. There is a mirror of the repository on Github.
Please report bugs on the issue tracker.
Gerrit is the work of hundreds of contributors. We appreciate your help!
Please read the contribution guidelines.
Note that we do not accept Pull Requests via the Github mirror.
The IRC channel on freenode is #gerrit. An archive is available at: echelog.com.
The Developer Mailing list is repo-discuss on Google Groups.
Gerrit is provided under the Apache License 2.0.
Install Buck and run the following:
git clone --recursive https://gerrit.googlesource.com/gerrit cd gerrit && buck build release
The instruction how to configure GerritForge/BinTray repositories is here
On Debian/Ubuntu run:
apt-get update & apt-get install gerrit=<version>-<release>
NOTE: release is a counter that starts with 1 and indicates the number of packages that have been released with the same version of the software.
On CentOS/RedHat run:
yum clean all && yum install gerrit-<version>[-<release>]
On Fedora run:
dnf clean all && dnf install gerrit-<version>[-<release>]
Docker images of Gerrit are available on DockerHub
To run a CentOS 7 based Gerrit image:
docker run -p 8080:8080 gerritforge/gerrit-centos7[:version]
To run a Ubuntu 15.04 based Gerrit image:
docker run -p 8080:8080 gerritforge/gerrit-ubuntu15.04[:version]
NOTE: release is optional. Last released package of the version is installed if the release number is omitted.