diff options
author | Matthew Peveler <matt.peveler@gmail.com> | 2021-01-28 21:49:22 +0000 |
---|---|---|
committer | Matthew Peveler <matt.peveler@gmail.com> | 2021-01-28 21:49:22 +0000 |
commit | 065fd2984a827f4cb87f71fe478ccc0da92eb540 (patch) | |
tree | b7c45ef110c4c3c626edbc4e8d1044b15eef8bf0 /asciidoc | |
parent | 5832a54d1e1e7e5c6229f25c1f1b3afc12f6090d (diff) | |
download | asciidoc-git-065fd2984a827f4cb87f71fe478ccc0da92eb540.tar.gz |
fix building website with new package structure
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
Diffstat (limited to 'asciidoc')
-rw-r--r-- | asciidoc/a2x.py | 6 | ||||
-rw-r--r-- | asciidoc/resources/dblatex/asciidoc-dblatex.sty | 22 | ||||
-rw-r--r-- | asciidoc/resources/dblatex/asciidoc-dblatex.xsl | 74 | ||||
-rw-r--r-- | asciidoc/resources/dblatex/dblatex-readme.txt | 39 |
4 files changed, 140 insertions, 1 deletions
diff --git a/asciidoc/a2x.py b/asciidoc/a2x.py index 32ee88e..756ae96 100644 --- a/asciidoc/a2x.py +++ b/asciidoc/a2x.py @@ -41,7 +41,11 @@ from urllib.parse import urlparse import zipfile import xml.dom.minidom import mimetypes -from . import asciidoc + +try: + from . import asciidoc +except ImportError: + import asciidoc CONF_DIR = os.path.join(os.path.dirname(__file__), 'resources') METADATA = {} diff --git a/asciidoc/resources/dblatex/asciidoc-dblatex.sty b/asciidoc/resources/dblatex/asciidoc-dblatex.sty new file mode 100644 index 0000000..309459f --- /dev/null +++ b/asciidoc/resources/dblatex/asciidoc-dblatex.sty @@ -0,0 +1,22 @@ +%% +%% This style is derived from the docbook one. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{asciidoc}[2008/06/05 AsciiDoc DocBook Style] +%% Just use the original package and pass the options. +\RequirePackageWithOptions{docbook} + +% Sidebar is a boxed minipage that can contain verbatim. +% Changed shadow box to double box. +\renewenvironment{sidebar}[1][0.95\textwidth]{ + \hspace{0mm}\newline% + \noindent\begin{Sbox}\begin{minipage}{#1}% + \setlength\parskip{\medskipamount}% +}{ + \end{minipage}\end{Sbox}\doublebox{\TheSbox}% +} + +% For DocBook literallayout elements, see `./dblatex/dblatex-readme.txt`. +\usepackage{alltt} +% To preserve simple quotes in the blocs of code +\usepackage{upquote} diff --git a/asciidoc/resources/dblatex/asciidoc-dblatex.xsl b/asciidoc/resources/dblatex/asciidoc-dblatex.xsl new file mode 100644 index 0000000..3df2d2e --- /dev/null +++ b/asciidoc/resources/dblatex/asciidoc-dblatex.xsl @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- +dblatex(1) XSL user stylesheet for asciidoc(1). +See dblatex(1) -p option. +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <!-- TOC links in the titles, and in blue. --> + <xsl:param name="latex.hyperparam">colorlinks,linkcolor=blue,pdfstartview=FitH</xsl:param> + <xsl:param name="doc.publisher.show">1</xsl:param> + <xsl:param name="doc.lot.show"></xsl:param> + <xsl:param name="term.breakline">1</xsl:param> + <xsl:param name="doc.collab.show">0</xsl:param> + <xsl:param name="doc.section.depth">3</xsl:param> + <xsl:param name="table.in.float">0</xsl:param> + <xsl:param name="monoseq.hyphenation">0</xsl:param> + <xsl:param name="latex.output.revhistory">1</xsl:param> + + <!-- This doesn't work, don't know why, see: + http://dblatex.sourceforge.net/html/manual/apas03.html + ./docbook-xsl/common.xsl + --> + <!-- + <xsl:param name="doc.toc.show"> + <xsl:choose> + <xsl:when test="/processing-instruction('asciidoc-toc')"> +1 + </xsl:when> + <xsl:otherwise> +0 + </xsl:otherwise> + </xsl:choose> + </xsl:param> + <xsl:param name="doc.lot.show"> + <xsl:choose> + <xsl:when test="/book"> +figure,table,equation,example + </xsl:when> + </xsl:choose> + </xsl:param> + --> + <xsl:param name="doc.toc.show">1</xsl:param> + + <!-- + Override default literallayout template. + See `./dblatex/dblatex-readme.txt`. + --> + <xsl:template match="address|literallayout[@class!='monospaced']"> + <xsl:text>\begin{alltt}</xsl:text> + <xsl:text> \normalfont{} </xsl:text> + <xsl:apply-templates/> + <xsl:text> \end{alltt}</xsl:text> + </xsl:template> + + <xsl:template match="processing-instruction('asciidoc-pagebreak')"> + <!-- force hard pagebreak, varies from 0(low) to 4(high) --> + <xsl:text>\pagebreak[4] </xsl:text> + <xsl:apply-templates /> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="processing-instruction('asciidoc-br')"> + <xsl:text>\newline </xsl:text> + </xsl:template> + + <xsl:template match="processing-instruction('asciidoc-hr')"> + <!-- draw a 444 pt line (centered) --> + <xsl:text>\begin{center} </xsl:text> + <xsl:text>\line(1,0){444} </xsl:text> + <xsl:text>\end{center} </xsl:text> + </xsl:template> + +</xsl:stylesheet> + diff --git a/asciidoc/resources/dblatex/dblatex-readme.txt b/asciidoc/resources/dblatex/dblatex-readme.txt new file mode 100644 index 0000000..026ef2b --- /dev/null +++ b/asciidoc/resources/dblatex/dblatex-readme.txt @@ -0,0 +1,39 @@ +AsciiDoc dblatex README +======================= + +Customization +------------- +The `./dblatex` directory contains: + +`./dblatex/asciidoc-dblatex.xsl`:: Optional dblatex XSL parameter +customization. + +`./dblatex/asciidoc-dblatex.sty`:: Optional customized LaTeX styles. + +Use these files with dblatex(1) `-p` and `-s` options, for example: + + dblatex -p ../dblatex/asciidoc-dblatex.xsl \ + -s ../dblatex/asciidoc-dblatex.sty article.xml + + +Limitations +----------- +Observed in dblatex 0.2.8. + +- dblatex doesn't seem to process the DocBook 'literallayout' element + correctly: it is rendered in a monospaced font and no inline + elements are processed. By default the normal font should be used + and almost all DocBook inline elements should be processed + (https://tdg.docbook.org/tdg/4.5/literallayout.html). I almost + fixed this by overriding the default dblatex literallayout template + (in `./dblatex/asciidoc-dblatex.xsl`) and using the LaTeX 'alltt' + package, but there are remaining problems: + + * Blank lines are replaced by a single space. + * The 'literallayout' element incorrectly wraps text when rendered + inside a table. + +- Callouts do not work inside DocBook 'literallayout' elements which + means callouts are not displayed inside AsciiDoc literal blocks. A + workaround is to change the AsciiDoc literal block to a listing + block. |