summaryrefslogtreecommitdiff
path: root/asciidoc
diff options
context:
space:
mode:
authorMatthew Peveler <matt.peveler@gmail.com>2021-01-28 21:32:23 +0000
committerMatthew Peveler <matt.peveler@gmail.com>2021-01-28 21:32:23 +0000
commit5832a54d1e1e7e5c6229f25c1f1b3afc12f6090d (patch)
treeb81fe73995a0ae72ec6a556773cf84b3637d23b8 /asciidoc
parentdfffda23381014481cd13e8e9d8f131e1f93f08a (diff)
downloadasciidoc-git-5832a54d1e1e7e5c6229f25c1f1b3afc12f6090d.tar.gz
fix running a2x under new package structure
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
Diffstat (limited to 'asciidoc')
-rw-r--r--asciidoc/a2x.py75
-rw-r--r--asciidoc/resources/docbook-xsl/asciidoc-docbook-xsl.txt65
-rw-r--r--asciidoc/resources/docbook-xsl/chunked.xsl17
-rw-r--r--asciidoc/resources/docbook-xsl/common.xsl106
-rw-r--r--asciidoc/resources/docbook-xsl/epub.xsl35
-rw-r--r--asciidoc/resources/docbook-xsl/fo.xsl152
-rw-r--r--asciidoc/resources/docbook-xsl/htmlhelp.xsl28
-rw-r--r--asciidoc/resources/docbook-xsl/manpage.xsl31
-rw-r--r--asciidoc/resources/docbook-xsl/text.xsl55
-rw-r--r--asciidoc/resources/docbook-xsl/xhtml.xsl14
10 files changed, 543 insertions, 35 deletions
diff --git a/asciidoc/a2x.py b/asciidoc/a2x.py
index 8c58af3..32ee88e 100644
--- a/asciidoc/a2x.py
+++ b/asciidoc/a2x.py
@@ -28,6 +28,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
+import io
import os
import fnmatch
from html.parser import HTMLParser
@@ -40,6 +41,7 @@ from urllib.parse import urlparse
import zipfile
import xml.dom.minidom
import mimetypes
+from . import asciidoc
CONF_DIR = os.path.join(os.path.dirname(__file__), 'resources')
METADATA = {}
@@ -69,7 +71,7 @@ LYNX = 'lynx' # alternate text file generator.
XMLLINT = 'xmllint' # Set to '' to disable.
EPUBCHECK = 'epubcheck' # Set to '' to disable.
# External executable default options.
-ASCIIDOC_OPTS = ''
+ASCIIDOC_OPTS = []
BACKEND_OPTS = ''
DBLATEX_OPTS = ''
FOP_OPTS = ''
@@ -418,7 +420,7 @@ class A2X(AttrDict):
'''
self.process_options()
# Append configuration file options.
- self.asciidoc_opts += ' ' + ASCIIDOC_OPTS
+ self.asciidoc_opts += ASCIIDOC_OPTS
self.dblatex_opts += ' ' + DBLATEX_OPTS
self.fop_opts += ' ' + FOP_OPTS
self.xsltproc_opts += ' ' + XSLTPROC_OPTS
@@ -444,27 +446,22 @@ class A2X(AttrDict):
conf_files.append(os.path.join(a2xdir, CONF_FILE))
# If the asciidoc executable and conf files are in the a2x directory
# then use the local copy of asciidoc and skip the global a2x conf.
- asciidoc = os.path.join(a2xdir, 'asciidoc.py')
asciidoc_conf = os.path.join(a2xdir, 'asciidoc.conf')
- if os.path.isfile(asciidoc) and os.path.isfile(asciidoc_conf):
- self.asciidoc = asciidoc
- else:
- self.asciidoc = None
- # From global conf directory.
- conf_files.append(os.path.join(CONF_DIR, CONF_FILE))
+
+ # TODO: CONF_DIR work
+ # From global conf directory.
+ # conf_files.append(os.path.join(CONF_DIR, CONF_FILE))
+
# From $HOME directory.
home_dir = os.environ.get('HOME')
if home_dir is not None:
conf_files.append(os.path.join(home_dir, '.asciidoc', CONF_FILE))
- # If asciidoc is not local to a2x then search the PATH.
- if not self.asciidoc:
- self.asciidoc = find_executable(ASCIIDOC)
- if not self.asciidoc:
- die('unable to find asciidoc: %s' % ASCIIDOC)
+
# From backend plugin directory.
if self.backend is not None:
- stdout = shell(self.asciidoc + ' --backend list')[0]
- backends = [(i, os.path.split(i)[1]) for i in stdout.splitlines()]
+ outfile = io.StringIO()
+ asciidoc.execute('asciidoc', [('--backend', 'list'), ('--out-file', outfile)], [])
+ backends = [(i, os.path.split(i)[1]) for i in outfile.getvalue().splitlines()]
backend_dir = [i[0] for i in backends if i[1] == self.backend]
if len(backend_dir) == 0:
die('missing %s backend' % self.backend)
@@ -531,22 +528,21 @@ class A2X(AttrDict):
mimetypes.add_type(mimetype, ext)
else:
self.resource_files.append(r)
- for p in (os.path.dirname(self.asciidoc), CONF_DIR):
- for d in ('images', 'stylesheets'):
- d = os.path.join(p, d)
- if os.path.isdir(d):
- self.resource_dirs.append(d)
+ for d in ('images', 'stylesheets'):
+ d = os.path.join(CONF_DIR, d)
+ if os.path.isdir(d):
+ self.resource_dirs.append(d)
verbose('resource files: %s' % self.resource_files)
verbose('resource directories: %s' % self.resource_dirs)
if not self.doctype and self.format == 'manpage':
self.doctype = 'manpage'
if self.doctype:
- self.asciidoc_opts += ' --doctype %s' % self.doctype
+ self.asciidoc_opts.append(('--doctype', self.doctype))
for attr in self.attributes:
- self.asciidoc_opts += ' --attribute "%s"' % attr
+ self.asciidoc_opts.append(('--attribute', attr))
# self.xsltproc_opts += ' --nonet'
if self.verbose:
- self.asciidoc_opts += ' --verbose'
+ self.asciidoc_opts.append((' --verbose'))
self.dblatex_opts += ' -V'
if self.icons or self.icons_dir:
params = [
@@ -599,17 +595,16 @@ class A2X(AttrDict):
'''
return os.path.basename(os.path.splitext(self.asciidoc_file)[0]) + ext
- def asciidoc_conf_file(self, path):
+ @staticmethod
+ def asciidoc_conf_file(path):
'''
Return full path name of file in asciidoc configuration files directory.
Search first the directory containing the asciidoc executable then
the global configuration file directory.
'''
- f = os.path.join(os.path.dirname(self.asciidoc), path)
+ f = os.path.join(CONF_DIR, path)
if not os.path.isfile(f):
- f = os.path.join(CONF_DIR, path)
- if not os.path.isfile(f):
- die('missing configuration file: %s' % f)
+ die('missing configuration file: %s' % f)
return os.path.normpath(f)
def xsl_stylesheet(self, file_name=None):
@@ -697,8 +692,12 @@ class A2X(AttrDict):
if not os.path.isfile(docbook_file):
die('missing docbook file: %s' % docbook_file)
return
- shell('"%s" --backend docbook -a "a2x-format=%s" %s --out-file "%s" "%s"' %
- (self.asciidoc, self.format, self.asciidoc_opts, docbook_file, self.asciidoc_file))
+ options = self.asciidoc_opts[:]
+ options.append(('--backend', 'docbook'))
+ options.append(('-a', 'a2x-format=%s' % self.format))
+ options.append(('--out-file', docbook_file))
+ asciidoc.reset_asciidoc()
+ asciidoc.execute('asciidoc', options, [self.asciidoc_file])
if not self.no_xmllint and XMLLINT:
shell('"%s" --nonet --noout --valid "%s"' % (XMLLINT, docbook_file))
@@ -869,9 +868,13 @@ class A2X(AttrDict):
text_file = self.dst_path('.text')
html_file = self.dst_path('.text.html')
if self.lynx:
- shell('"%s" %s --conf-file "%s" -b html4 -a "a2x-format=%s" -o "%s" "%s"' %
- (self.asciidoc, self.asciidoc_opts, self.asciidoc_conf_file('text.conf'),
- self.format, html_file, self.asciidoc_file))
+ options = self.asciidoc_opts[:]
+ options.append(('--conf-file', self.asciidoc_conf_file('text.conf')))
+ options.append(('-b', 'html4'))
+ options.append(('-a', 'a2x-format=%s' % self.format))
+ options.append(('-o', html_file))
+ asciidoc.reset_asciidoc()
+ asciidoc.execute('asciidoc', options, [self.asciidoc_file])
cmd = '"%s" %s "%s" > "%s"' % (LYNX, LYNX_OPTS, html_file, text_file)
shell(cmd)
else:
@@ -888,6 +891,8 @@ class A2X(AttrDict):
def cli():
+ global OPTIONS
+
description = '''A toolchain manager for AsciiDoc (converts Asciidoc text files to other file formats)'''
from optparse import OptionParser
parser = OptionParser(usage='usage: %prog [OPTIONS] SOURCE_FILE',
@@ -995,7 +1000,7 @@ def cli():
opts, args = parser.parse_args(argv)
if len(args) != 1:
parser.error('incorrect number of arguments')
- opts.asciidoc_opts = ' '.join(opts.asciidoc_opts)
+ opts.asciidoc_opts = [x.split(' ', 1) for x in opts.asciidoc_opts]
opts.dblatex_opts = ' '.join(opts.dblatex_opts)
opts.fop_opts = ' '.join(opts.fop_opts)
opts.xsltproc_opts = ' '.join(opts.xsltproc_opts)
diff --git a/asciidoc/resources/docbook-xsl/asciidoc-docbook-xsl.txt b/asciidoc/resources/docbook-xsl/asciidoc-docbook-xsl.txt
new file mode 100644
index 0000000..295a7d4
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/asciidoc-docbook-xsl.txt
@@ -0,0 +1,65 @@
+AsciiDoc DocBook XSL Stylesheets Notes
+======================================
+
+Output file customisation is achieved by tweaking the DocBook XSL
+stylesheets. I've tried to keep customization to a minimum and
+confine it to the separate XSL driver files in the distribution
+`./docbook-xsl/` directory (see the User Guide for details).
+
+To polish some rough edges I've written some patches for the DocBook
+XSL stylesheets -- you don't need them but they're documented below
+and included in the distribution `./docbook-xsl/` directory.
+
+
+Manually upgrading Debian to the latest DocBook XSL stylesheets
+---------------------------------------------------------------
+The DocBook XSL Stylesheets distribution is just a directory full of
+text files and you can switch between releases by changing the
+directory name in the system XML catalog.
+
+To upgrade to the latest docbook-xsl stylesheets without having to
+wait for the Debian `docbook-xsl` package:
+
+- Download the latest docbook-xsl tarball from
+ https://github.com/docbook/xslt10-stylesheets. Bleeding edge snapshots
+ can be found at https://github.com/docbook/xslt10-stylesheets/releases.
+
+- Unzip the tarball to `/usr/share/xml/docbook/stylesheet/`:
+
+ $ cd /usr/share/xml/docbook/stylesheet
+ $ sudo tar -xzf /tmp/docbook-xsl-1.72.0.tar.gz
+
+- Edit `/etc/xml/docbook-xsl.xml` catalog and replace occurrences of
+ the current stylesheets directory with the new one (in our example
+ it would be `/usr/share/xml/docbook/stylesheet/docbook-xsl-1.72.0`.
+
+ $ cd /etc/xml/
+ $ sudo cp -p docbook-xsl.xml docbook-xsl.xml.ORIG
+ $ sudo vi docbook-xsl.xml
+
+
+Customizing Generated Text
+--------------------------
+An example
+http://www.sagehill.net/docbookxsl/CustomGentext.html#CustomGenText[DocBook
+XSL Stylesheets customization file] for formatting chapter titles
+without chapter numbering.
+
+.custom-chapter.xml
+---------------------------------------------------------------------
+<!-- Customize chapter title -->
+<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
+ <l:l10n language="en">
+ <l:context name="title">
+ <l:template name="chapter" text="%t"/>
+ </l:context>
+ </l:l10n>
+</l:i18n>
+---------------------------------------------------------------------
+
+Executed with this 'xsltproc' parameter:
+
+ --param local.l10n.xml document\(\'custom-chapter.xml\'\)
+
+NOTE: This example is hypothetical -- use the 'xsltproc'
+`--stringparam chapter.autolabel 0` option to do the same job.
diff --git a/asciidoc/resources/docbook-xsl/chunked.xsl b/asciidoc/resources/docbook-xsl/chunked.xsl
new file mode 100644
index 0000000..aafcca0
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/chunked.xsl
@@ -0,0 +1,17 @@
+<!--
+ Generates chunked XHTML documents from DocBook XML source using DocBook XSL
+ stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+<xsl:import href="common.xsl"/>
+<xsl:param name="navig.graphics.path">images/icons/</xsl:param>
+<xsl:param name="admon.graphics.path">images/icons/</xsl:param>
+<xsl:param name="callout.graphics.path" select="'images/icons/callouts/'"/>
+</xsl:stylesheet>
diff --git a/asciidoc/resources/docbook-xsl/common.xsl b/asciidoc/resources/docbook-xsl/common.xsl
new file mode 100644
index 0000000..6a475a1
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/common.xsl
@@ -0,0 +1,106 @@
+<!--
+ Included in xhtml.xsl, xhtml.chunked.xsl, htmlhelp.xsl.
+ Contains common XSL stylesheets parameters.
+ Output documents styled by docbook.css.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:param name="html.stylesheet" select="'docbook-xsl.css'"/>
+
+<xsl:param name="htmlhelp.chm" select="'htmlhelp.chm'"/>
+<xsl:param name="htmlhelp.hhc.section.depth" select="5"/>
+
+<xsl:param name="section.autolabel">
+ <xsl:choose>
+ <xsl:when test="/processing-instruction('asciidoc-numbered')">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+
+<xsl:param name="suppress.navigation" select="0"/>
+<xsl:param name="navig.graphics.extension" select="'.png'"/>
+<xsl:param name="navig.graphics" select="0"/>
+<xsl:param name="navig.graphics.path">images/icons/</xsl:param>
+<xsl:param name="navig.showtitles">0</xsl:param>
+
+<xsl:param name="shade.verbatim" select="0"/>
+<xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="border">0</xsl:attribute>
+ <xsl:attribute name="background-color">#E0E0E0</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="admon.graphics" select="1"/>
+<xsl:param name="admon.graphics.path">images/icons/</xsl:param>
+<xsl:param name="admon.graphics.extension" select="'.png'"/>
+<xsl:param name="admon.style">
+ <xsl:text>margin-left: 0; margin-right: 10%;</xsl:text>
+</xsl:param>
+<xsl:param name="admon.textlabel" select="1"/>
+
+<xsl:param name="callout.defaultcolumn" select="'60'"/>
+<xsl:param name="callout.graphics.extension" select="'.png'"/>
+<xsl:param name="callout.graphics" select="'1'"/>
+<xsl:param name="callout.graphics.number.limit" select="'10'"/>
+<xsl:param name="callout.graphics.path" select="'images/icons/callouts/'"/>
+<xsl:param name="callout.list.table" select="'1'"/>
+
+<!-- This does not seem to work. -->
+<xsl:param name="section.autolabel.max.depth" select="2"/>
+
+<xsl:param name="chunk.first.sections" select="1"/>
+<xsl:param name="chunk.section.depth" select="1"/>
+<xsl:param name="chunk.quietly" select="0"/>
+<xsl:param name="chunk.toc" select="''"/>
+<xsl:param name="chunk.tocs.and.lots" select="0"/>
+
+<xsl:param name="html.cellpadding" select="'4px'"/>
+<xsl:param name="html.cellspacing" select="''"/>
+
+<xsl:param name="table.borders.with.css" select="1"/>
+<xsl:param name="table.cell.border.color" select="'#527bbd'"/>
+
+<xsl:param name="table.cell.border.style" select="'solid'"/>
+<xsl:param name="table.cell.border.thickness" select="'1px'"/>
+<xsl:param name="table.footnote.number.format" select="'a'"/>
+<xsl:param name="table.footnote.number.symbols" select="''"/>
+<xsl:param name="table.frame.border.color" select="'#527bbd'"/>
+<xsl:param name="table.frame.border.style" select="'solid'"/>
+<xsl:param name="table.frame.border.thickness" select="'3px'"/>
+<xsl:param name="tablecolumns.extension" select="'1'"/>
+
+<xsl:param name="highlight.source" select="1"/>
+
+<xsl:param name="section.label.includes.component.label" select="1"/>
+
+<!--
+ Table of contents inserted by <?asciidoc-toc?> processing instruction.
+-->
+<xsl:param name="generate.toc">
+ <xsl:choose>
+ <xsl:when test="/processing-instruction('asciidoc-toc')">
+article toc,title
+book toc,title,figure,table,example,equation
+ <!-- The only way I could find that suppressed book chapter TOCs -->
+ <xsl:if test="$generate.section.toc.level != 0">
+chapter toc,title
+part toc,title
+preface toc,title
+qandadiv toc
+qandaset toc
+reference toc,title
+sect1 toc
+sect2 toc
+sect3 toc
+sect4 toc
+sect5 toc
+section toc
+set toc,title
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+article nop
+book nop
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+
+</xsl:stylesheet>
diff --git a/asciidoc/resources/docbook-xsl/epub.xsl b/asciidoc/resources/docbook-xsl/epub.xsl
new file mode 100644
index 0000000..b15748d
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/epub.xsl
@@ -0,0 +1,35 @@
+<!--
+ Generates EPUB XHTML documents from DocBook XML source using DocBook XSL
+ stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/epub/docbook.xsl"/>
+<xsl:import href="common.xsl"/>
+
+<!--
+DocBook XSL 1.75.2: Nav headers are invalid XHTML (table width element).
+Suppressed by default in Docbook XSL 1.76.1 epub.xsl.
+-->
+<xsl:param name="suppress.navigation" select="1"/>
+
+<!--
+DocBook XLS 1.75.2 doesn't handle TOCs
+-->
+<xsl:param name="generate.toc">
+ <xsl:choose>
+ <xsl:when test="/article">
+/article nop
+ </xsl:when>
+ <xsl:when test="/book">
+/book nop
+ </xsl:when>
+ </xsl:choose>
+</xsl:param>
+
+</xsl:stylesheet>
diff --git a/asciidoc/resources/docbook-xsl/fo.xsl b/asciidoc/resources/docbook-xsl/fo.xsl
new file mode 100644
index 0000000..5537e8e
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/fo.xsl
@@ -0,0 +1,152 @@
+<!--
+ Generates single FO document from DocBook XML source using DocBook XSL
+ stylesheets.
+
+ See xsl-stylesheets/fo/param.xsl for all parameters.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+<xsl:import href="common.xsl"/>
+
+<xsl:param name="fop1.extensions" select="1" />
+<xsl:param name="variablelist.as.blocks" select="1" />
+
+<xsl:param name="paper.type" select="'A4'"/>
+<!--
+<xsl:param name="paper.type" select="'USletter'"/>
+-->
+<xsl:param name="hyphenate">false</xsl:param>
+<!-- justify, left or right -->
+<xsl:param name="alignment">left</xsl:param>
+
+<xsl:param name="body.font.family" select="'serif'"/>
+<xsl:param name="body.font.master">12</xsl:param>
+<xsl:param name="body.font.size">
+ <xsl:value-of select="$body.font.master"/><xsl:text>pt</xsl:text>
+</xsl:param>
+
+<xsl:param name="body.margin.bottom" select="'0.5in'"/>
+<xsl:param name="body.margin.top" select="'0.5in'"/>
+<xsl:param name="bridgehead.in.toc" select="0"/>
+
+<!-- overide setting in common.xsl -->
+<xsl:param name="table.frame.border.thickness" select="'2px'"/>
+
+<!-- Default fetches image from Internet (long timeouts) -->
+<xsl:param name="draft.watermark.image" select="''"/>
+
+<!-- Line break -->
+<xsl:template match="processing-instruction('asciidoc-br')">
+ <fo:block/>
+</xsl:template>
+
+<!-- Horizontal ruler -->
+<xsl:template match="processing-instruction('asciidoc-hr')">
+ <fo:block space-after="1em">
+ <fo:leader leader-pattern="rule" rule-thickness="0.5pt" rule-style="solid" leader-length.minimum="100%"/>
+ </fo:block>
+</xsl:template>
+
+<!-- Hard page break -->
+<xsl:template match="processing-instruction('asciidoc-pagebreak')">
+ <fo:block break-after='page'/>
+</xsl:template>
+
+<!-- Sets title to body text indent -->
+<xsl:param name="body.start.indent">
+ <xsl:choose>
+ <xsl:when test="$fop.extensions != 0">0pt</xsl:when>
+ <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
+ <xsl:otherwise>1pc</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+<xsl:param name="title.margin.left">
+ <xsl:choose>
+ <xsl:when test="$fop.extensions != 0">-1pc</xsl:when>
+ <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
+ <xsl:otherwise>0pt</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+<xsl:param name="page.margin.bottom" select="'0.25in'"/>
+<xsl:param name="page.margin.inner">
+ <xsl:choose>
+ <xsl:when test="$double.sided != 0">0.75in</xsl:when>
+ <xsl:otherwise>0.75in</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+<xsl:param name="page.margin.outer">
+ <xsl:choose>
+ <xsl:when test="$double.sided != 0">0.5in</xsl:when>
+ <xsl:otherwise>0.5in</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+
+<xsl:param name="page.margin.top" select="'0.5in'"/>
+<xsl:param name="page.orientation" select="'portrait'"/>
+<xsl:param name="page.width">
+ <xsl:choose>
+ <xsl:when test="$page.orientation = 'portrait'">
+ <xsl:value-of select="$page.width.portrait"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$page.height.portrait"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+
+<xsl:attribute-set name="monospace.properties">
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:attribute-set name="admonition.title.properties">
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:attribute-set name="sidebar.properties" use-attribute-sets="formal.object.properties">
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-width">1pt</xsl:attribute>
+ <xsl:attribute name="border-color">silver</xsl:attribute>
+ <xsl:attribute name="background-color">#ffffee</xsl:attribute>
+ <xsl:attribute name="padding-left">12pt</xsl:attribute>
+ <xsl:attribute name="padding-right">12pt</xsl:attribute>
+ <xsl:attribute name="padding-top">6pt</xsl:attribute>
+ <xsl:attribute name="padding-bottom">6pt</xsl:attribute>
+ <xsl:attribute name="margin-left">0pt</xsl:attribute>
+ <xsl:attribute name="margin-right">12pt</xsl:attribute>
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="callout.graphics" select="'1'"/>
+
+<!-- Only shade programlisting and screen verbatim elements -->
+<xsl:param name="shade.verbatim" select="1"/>
+<xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="background-color">
+ <xsl:choose>
+ <xsl:when test="self::programlisting|self::screen">#E0E0E0</xsl:when>
+ <xsl:otherwise>inherit</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+</xsl:attribute-set>
+
+<!--
+ Force XSL Stylesheets 1.72 default table breaks to be the same as the current
+ version (1.74) default which (for tables) is keep-together="auto".
+-->
+<xsl:attribute-set name="table.properties">
+ <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
+</xsl:attribute-set>
+
+</xsl:stylesheet>
diff --git a/asciidoc/resources/docbook-xsl/htmlhelp.xsl b/asciidoc/resources/docbook-xsl/htmlhelp.xsl
new file mode 100644
index 0000000..ef38fa4
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/htmlhelp.xsl
@@ -0,0 +1,28 @@
+<!--
+ Generates chunked HTML Help HTML documents from DocBook XML source using
+ DocBook XSL stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"/>
+<xsl:import href="common.xsl"/>
+<xsl:param name="htmlhelp.hhp" select="'asciidoc.hhp'"/>
+<xsl:param name="suppress.navigation" select="1"/>
+
+<!-- Line break -->
+<xsl:template match="processing-instruction('asciidoc-br')">
+ <br/>
+</xsl:template>
+
+<!-- Horizontal ruler -->
+<xsl:template match="processing-instruction('asciidoc-hr')">
+ <hr/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/asciidoc/resources/docbook-xsl/manpage.xsl b/asciidoc/resources/docbook-xsl/manpage.xsl
new file mode 100644
index 0000000..b5201a5
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/manpage.xsl
@@ -0,0 +1,31 @@
+<!--
+ Generates single roff manpage document from DocBook XML source using DocBook
+ XSL stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
+<xsl:import href="common.xsl"/>
+
+<!-- Only render the link text -->
+<xsl:template match="ulink">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:value-of select="$content"/>
+</xsl:template>
+
+<!-- Don't automatically generate the REFERENCES section -->
+<xsl:template name="endnotes.list">
+</xsl:template>
+<!-- Next entry for backward compatibility with old docbook-xsl versions -->
+<xsl:template name="format.links.list">
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/asciidoc/resources/docbook-xsl/text.xsl b/asciidoc/resources/docbook-xsl/text.xsl
new file mode 100644
index 0000000..566884c
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/text.xsl
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+ Used by AsciiDoc a2x(1) for w3m(1) based text generation.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+ <xsl:import
+ href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
+
+ <!-- parameters for optimal text output -->
+ <xsl:param name="callout.graphics" select="0"/>
+ <xsl:param name="callout.unicode" select="0"/>
+ <xsl:param name="section.autolabel" select="1"/>
+ <xsl:param name="section.label.includes.component.label" select="1"/>
+ <xsl:param name="generate.toc">
+ appendix title
+ article/appendix nop
+ article toc,title
+ book toc,title,figure,table,example,equation
+ chapter title
+ part toc,title
+ preface toc,title
+ qandadiv toc
+ qandaset toc
+ reference toc,title
+ section toc
+ set toc,title
+ </xsl:param>
+
+ <xsl:template match="book/bookinfo/title | article/articleinfo/title" mode="titlepage.mode">
+ <hr />
+ <xsl:apply-imports/>
+ <hr />
+ </xsl:template>
+
+ <xsl:template match="book/*/title | article/*/title" mode="titlepage.mode">
+ <br /><hr />
+ <xsl:apply-imports/>
+ <hr />
+ </xsl:template>
+
+ <xsl:template match="book/chapter/*/title | article/section/*/title" mode="titlepage.mode">
+ <br />
+ <xsl:apply-imports/>
+ <hr width="100" align="left" />
+ </xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/asciidoc/resources/docbook-xsl/xhtml.xsl b/asciidoc/resources/docbook-xsl/xhtml.xsl
new file mode 100644
index 0000000..cdfe27f
--- /dev/null
+++ b/asciidoc/resources/docbook-xsl/xhtml.xsl
@@ -0,0 +1,14 @@
+<!--
+ Generates single XHTML document from DocBook XML source using DocBook XSL
+ stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
+<xsl:import href="common.xsl"/>
+</xsl:stylesheet>