Switch from asciidoc to asciidoctor

To avoid possible GPL licensing issues, switch documentation
rendering from asciidoc to to the MIT licensed asciidoctor.

Asciidoctor can't render our docs if it uses xhtml11 backend, so use
the html5 backend instead.

The current stable version of asciidoctor (0.1.3) has no default CSS.
Configure documentation to reference a modified copy of Gerrit's own
pegdown.css, which is used by plugin documentation rendering to get a
close approximation to the original asciidoc look.

Change-Id: If1ee984c77533d603768e5fac8a91eee211f0d5b
This commit is contained in:
Yuxuan 'fishy' Wang
2013-09-05 11:44:11 -07:00
parent bf15ebc1b5
commit 1bfb51d524
5 changed files with 94 additions and 4 deletions

View File

@@ -20,23 +20,32 @@ genrule(
'images/*.jpg',
'images/*.png',
]) + [
genfile('doc.css'),
genfile('licenses.html'),
genfile('licenses.txt'),
],
deps = [':' + d for d in HTML] + [
':licenses.html',
':licenses.txt',
':doc.css',
],
out = 'html.zip',
visibility = ['PUBLIC'],
)
genrule(
name = 'doc.css',
cmd = 'ln -s $SRCDIR/doc.css $OUT',
srcs = ['doc.css'],
out = 'doc.css',
)
genasciidoc(
srcs = SRCS + [genfile('licenses.txt')],
outs = HTML + ['licenses.html'],
deps = DOCUMENTATION_DEPS,
attributes = documentation_attributes(git_describe()),
backend = 'xhtml11',
backend = 'html5',
)
genrule(

View File

@@ -21,7 +21,7 @@ def genasciidoc(
visibility = []):
EXPN = '.expn'
asciidoc = ['asciidoc']
asciidoc = ['$(exe //lib/asciidoctor:asciidoc)']
if backend:
asciidoc.extend(['-b', backend])
for attribute in attributes:
@@ -52,7 +52,10 @@ def genasciidoc(
name = out,
cmd = ' '.join(asciidoc + ['$SRCDIR/' + ex]),
srcs = [genfile(ex)] + [genfile(n + EXPN) for n in dep],
deps = [':' + ex] + [':' + n + EXPN for n in dep],
deps = [':' + n + EXPN for n in dep] + [
':' + ex,
'//lib/asciidoctor:asciidoc',
],
out = out,
visibility = visibility,
)

View File

@@ -13,5 +13,7 @@ def documentation_attributes(revision):
'startsb="["',
'endsb="]"',
'tilde="~"',
'revision="%s"' % revision,
'source-highlighter=prettify',
'stylesheet=doc.css',
'revnumber="%s"' % revision,
]

37
Documentation/doc.css Normal file
View File

@@ -0,0 +1,37 @@
body {
margin: 1em;
}
#toctitle {
margin-top: 0.5em;
font-weight: bold;
}
h1, h2, h3, h4, h5, h6, #toctitle {
color: #527bbd;
font-family: sans-serif;
}
h1, h2, h3 {
border-bottom: 2px solid silver;
}
p {
margin: 0.5em 0 0.5em 0;
}
li p {
margin: 0.2em 0 0.2em 0;
}
pre {
border: 2px solid silver;
background: #ebebeb;
margin-left: 2em;
width: 100em;
color: darkgreen;
padding: 2px;
}
dl dt {
margin-top: 1em;
}

39
lib/asciidoctor/BUCK Normal file
View File

@@ -0,0 +1,39 @@
include_defs('//lib/maven.defs')
java_binary(
name = 'asciidoc',
main_class = 'org.asciidoctor.cli.AsciidoctorInvoker',
deps = [':asciidoctor'],
visibility = ['PUBLIC'],
)
maven_jar(
name = 'asciidoctor',
id = 'org.asciidoctor:asciidoctor-java-integration:0.1.3',
sha1 = '5cf21b4331d737ef0f3b3f543a7e5a343c1f27ec',
license = 'Apache2.0',
visibility = [],
attach_source = False,
deps = [
':jcommander',
':jruby',
],
)
maven_jar(
name = 'jcommander',
id = 'com.beust:jcommander:1.30',
sha1 = 'c440b30a944ba199751551aee393f8aa03b3c327',
license = 'Apache2.0',
visibility = [],
attach_source = False,
)
maven_jar(
name = 'jruby',
id = 'org.jruby:jruby-complete:1.7.4',
sha1 = '74984d84846523bd7da49064679ed1ccf199e1db',
license = 'DO_NOT_DISTRIBUTE',
visibility = [],
attach_source = False,
)