gerrit/Documentation/asciidoc.defs
Yuxuan 'fishy' Wang 1bfb51d524 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
2013-09-05 16:47:50 -07:00

62 lines
1.6 KiB
Plaintext

# Copyright (C) 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
def genasciidoc(
srcs = [],
outs = [],
deps = {},
attributes = [],
backend = None,
visibility = []):
EXPN = '.expn'
asciidoc = ['$(exe //lib/asciidoctor:asciidoc)']
if backend:
asciidoc.extend(['-b', backend])
for attribute in attributes:
asciidoc.extend(['-a', attribute])
asciidoc.extend(['-o', '$OUT'])
for p in zip(srcs, outs):
src, out = p
dep = deps.get(src) or []
tx = []
fn = src
if fn.startswith('BUCKGEN:') :
fn = src[8:]
tx = [':' + fn]
ex = fn + EXPN
genrule(
name = ex,
cmd = '$(exe :replace_macros) --suffix=' + EXPN +
' -s $SRCDIR/%s' % fn +
' -o $OUT',
srcs = [src],
deps = tx + [':replace_macros'],
out = ex,
)
genrule(
name = out,
cmd = ' '.join(asciidoc + ['$SRCDIR/' + ex]),
srcs = [genfile(ex)] + [genfile(n + EXPN) for n in dep],
deps = [':' + n + EXPN for n in dep] + [
':' + ex,
'//lib/asciidoctor:asciidoc',
],
out = out,
visibility = visibility,
)