- # Create a PDF file, using docbook2pdf.
+ # Create a PDF file, using fop.
input_xml_file = sys.argv[2]
output_pdf_file = sys.argv[3]
- output_dir = os.path.dirname(output_pdf_file)
- if not output_dir:
- output_dir = '.'
- output_basename = os.path.basename(output_pdf_file)
- if output_basename.endswith('.pdf'):
- output_basename = output_basename[:-4]
- xml_file = os.path.join(output_dir, output_basename + '.xml')
+ fo_file = os.path.splitext(output_pdf_file)[0] + '.fo'
+
+ # For a list of available parameters, see http://docbook.sourceforge.net/release/xsl/current/doc/fo/
+ # For a list of available paper types, see the description of the page.width.portrait parameter.
+ xslt_params = [
+ '--param', 'toc.section.depth', '1',
+ '--stringparam', 'fop1.extensions', '1',
+ '--stringparam', 'page.orientation', 'portrait',
+ '--stringparam', 'paper.type', 'A4',
+ ]
+
+ xslt_stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl'
- # We need to produce an XML file with all of the XIncludes done.
+ # Generate a .fo (formatting object) file.
+ # fop can take an xslt stylesheet parameter, but it can only read local files.
+ # xsltproc is necessary if you want to read the stylesheet from the internet.
cmd = [
- 'xmllint',
+ 'xsltproc',
+ ] + xslt_params + [
+ '-o', fo_file,
'--xinclude',
- '--postvalid',
- '--output', xml_file,
+ xslt_stylesheet,
input_xml_file,
]
result = subprocess.run(cmd)
@@ -121,9 +160,9 @@ def docbook2pdf():
return result.returncode
cmd = [
- 'docbook2pdf',
- '--output', output_dir,
- xml_file,
+ 'fop',
+ '-fo', fo_file,
+ '-pdf', output_pdf_file,
]
return subprocess.run(cmd).returncode
@@ -168,8 +207,8 @@ def dist_doc():
sys.exit(xmllint())
if subcommand == 'dblatex':
sys.exit(dblatex())
-if subcommand == 'docbook2pdf':
- sys.exit(docbook2pdf())
+if subcommand == 'fop':
+ sys.exit(fop())
if subcommand == 'dist_doc':
sys.exit(dist_doc())
print(sys.argv[0], ': illegal subcommand,', subcommand)
diff --git a/untracked/README b/untracked/README
index 1fd8eca5..e7bd7d22 100644
--- a/untracked/README
+++ b/untracked/README
@@ -15,10 +15,10 @@ or the tarball is created with Meson.
1. Files copied by mm-common-get
--------------------------------
-untracked/docs/docs/doc-install.pl
- doc-postprocess.pl
- doxygen-extra.css
- tagfile-to-devhelp2.xsl
+untracked/docs/doc_install.py or doc-install.pl
+ doc_postprocess.py or doc-postprocess.pl
+ doxygen-extra.css
+ tagfile-to-devhelp2.xsl
untracked/build_scripts/dist-build-scripts.py
dist-changelog.py
doc-reference.py
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy