Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | If SGML_CATALOG_FILES is in the environment, pass --catalogs to xmllint and |
| 2 | xsltproc. Also pass --nonet to xsltproc to detect future missing stylesheet |
| 3 | problems. |
| 4 | |
| 5 | An earlier version of this patch was filed upstream at |
| 6 | https://github.com/asciidoc/asciidoc-py3/issues/61 so depending on how that goes |
| 7 | this could get merged. |
| 8 | |
| 9 | Upstream-Status: Inappropriate |
| 10 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 11 | |
| 12 | diff --git a/a2x.py b/a2x.py |
| 13 | index 2d7699a..582d809 100755 |
| 14 | --- a/a2x.py |
| 15 | +++ b/a2x.py |
| 16 | @@ -57,6 +57,10 @@ LYNX_OPTS = '-dump' |
| 17 | W3M_OPTS = '-dump -cols 70 -T text/html -no-graph' |
| 18 | XSLTPROC_OPTS = '' |
| 19 | |
| 20 | +if "SGML_CATALOG_FILES" in os.environ: |
| 21 | + XMLLINT += " --catalogs" |
| 22 | + XSLTPROC += " --catalogs" |
| 23 | + |
| 24 | ###################################################################### |
| 25 | # End of configuration file parameters. |
| 26 | ###################################################################### |
| 27 | @@ -298,7 +302,7 @@ def exec_xsltproc(xsl_file, xml_file, dst_dir, opts = ''): |
| 28 | cwd = os.getcwd() |
| 29 | shell_cd(dst_dir) |
| 30 | try: |
| 31 | - shell('"%s" %s "%s" "%s"' % (XSLTPROC, opts, xsl_file, xml_file)) |
| 32 | + shell('%s %s "%s" "%s"' % (XSLTPROC, opts, xsl_file, xml_file)) |
| 33 | finally: |
| 34 | shell_cd(cwd) |
| 35 | |
| 36 | @@ -483,7 +487,7 @@ class A2X(AttrDict): |
| 37 | self.asciidoc_opts += ' --doctype %s' % self.doctype |
| 38 | for attr in self.attributes: |
| 39 | self.asciidoc_opts += ' --attribute "%s"' % attr |
| 40 | -# self.xsltproc_opts += ' --nonet' |
| 41 | + self.xsltproc_opts += ' --nonet' |
| 42 | if self.verbose: |
| 43 | self.asciidoc_opts += ' --verbose' |
| 44 | self.dblatex_opts += ' -V' |
| 45 | @@ -634,7 +638,7 @@ class A2X(AttrDict): |
| 46 | shell('"%s" --backend docbook -a "a2x-format=%s" %s --out-file "%s" "%s"' % |
| 47 | (self.asciidoc, self.format, self.asciidoc_opts, docbook_file, self.asciidoc_file)) |
| 48 | if not self.no_xmllint and XMLLINT: |
| 49 | - shell('"%s" --nonet --noout --valid "%s"' % (XMLLINT, docbook_file)) |
| 50 | + shell('%s --nonet --noout --valid "%s"' % (XMLLINT, docbook_file)) |
| 51 | |
| 52 | def to_xhtml(self): |
| 53 | self.to_docbook() |