]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 961398: Let rst2pdf build the PDF documentation if pdflatex is not available
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 21 Jan 2014 16:36:46 +0000 (17:36 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 21 Jan 2014 16:36:46 +0000 (17:36 +0100)
r=gerv a=glob

docs/en/Makefile
docs/en/make.bat
docs/en/rst/conf.py
docs/en/rst/index.rst
docs/makedocs.pl

index afbe6ee26b909d1b4cd35014a7ac2d1f6217ed6d..c0708059dcd3aa007df248bc2ee2f87a8cb29533 100644 (file)
@@ -108,6 +108,11 @@ latexpdf:
        $(MAKE) -C $(BUILDDIR)/latex all-pdf
        @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
 
+pdf:
+       $(SPHINXBUILD) -b pdf -t enable_rst2pdf $(ALLSPHINXOPTS) $(BUILDDIR)/pdf
+       @echo
+       @echo "Build finished. The PDF file is in $(BUILDDIR)/pdf."
+
 text:
        $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/txt
        @echo
index 5c1494bf7674f3b449ca4f2604a856781d702bdd..c12f0a720052ca5e005a23d7dcf8f6d38ef11049 100644 (file)
@@ -187,4 +187,11 @@ results in %BUILDDIR%/doctest/output.txt.
        goto end
 )
 
+if "%1" == "pdf" (
+        %SPHINXBUILD% -b pdf -t enable_rst2pdf %ALLSPHINXOPTS% %BUILDDIR%/pdf
+        echo.
+        echo.Build finished. The PDF file is in %BUILDDIR%/pdf
+        goto end
+)
+
 :end
index 159226809ffe7aff8fcc7a6653b2e69c37a386eb..1d8d0e909bfb1823c791463b03637d9dfa83f091 100644 (file)
@@ -27,6 +27,9 @@ import sys, os
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.todo']
 
+if tags.has('enable_rst2pdf'):
+  extensions.append('rst2pdf.pdfbuilder')
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -115,7 +118,7 @@ html_theme = 'default'
 # The name of an image file (within the static path) to use as favicon of the
 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
 # pixels large.
-#html_favicon = None
+html_favicon = '../../../images/favicon.ico'
 
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
@@ -147,7 +150,7 @@ html_static_path = ['_static']
 #html_split_index = False
 
 # If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+html_show_sourcelink = False
 
 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
 #html_show_sphinx = True
@@ -244,3 +247,102 @@ texinfo_documents = [
 definitions = "../../definitions.rst"
 if os.path.exists(definitions):
     execfile(definitions)
+
+
+# -- Options for PDF output --------------------------------------------------
+
+# Grouping the document tree into PDF files. List of tuples
+# (source start file, target name, title, author, options).
+#
+# If there is more than one author, separate them with \\.
+# For example: r'Guido van Rossum\\Fred L. Drake, Jr., editor'
+#
+# The options element is a dictionary that lets you override
+# this config per-document.
+# For example,
+# ('index', u'MyProject', u'My Project', u'Author Name',
+#  dict(pdf_compressed = True))
+# would mean that specific document would be compressed
+# regardless of the global pdf_compressed setting.
+
+pdf_documents = [
+('index', u'Bugzilla', u'Bugzilla Documentation', u'The Bugzilla Team'),
+]
+
+# A comma-separated list of custom stylesheets. Example:
+pdf_stylesheets = ['sphinx','kerning','a4']
+
+# A list of folders to search for stylesheets. Example:
+pdf_style_path = ['.', '_styles']
+
+# Create a compressed PDF
+# Use True/False or 1/0
+# Example: compressed=True
+pdf_compressed = True
+
+# A colon-separated list of folders to search for fonts. Example:
+# pdf_font_path = ['/usr/share/fonts', '/usr/share/texmf-dist/fonts/']
+
+# Language to be used for hyphenation support
+#pdf_language = "en_US"
+
+# Mode for literal blocks wider than the frame. Can be
+# overflow, shrink or truncate
+pdf_fit_mode = "shrink"
+
+# Section level that forces a break page.
+# For example: 1 means top-level sections start in a new page
+# 0 means disabled
+pdf_break_level = 2
+
+# When a section starts in a new page, force it to be 'even', 'odd',
+# or just use 'any'
+#pdf_breakside = 'any'
+
+# Insert footnotes where they are defined instead of
+# at the end.
+#pdf_inline_footnotes = True
+
+# verbosity level. 0 1 or 2
+pdf_verbosity = 0
+
+# If false, no index is generated.
+pdf_use_index = False
+
+# If false, no modindex is generated.
+pdf_use_modindex = False
+
+# If false, no coverpage is generated.
+#pdf_use_coverpage = True
+
+# Name of the cover page template to use
+#pdf_cover_template = 'sphinxcover.tmpl'
+
+# Documents to append as an appendix to all manuals.
+#pdf_appendices = []
+
+# Enable experimental feature to split table cells. Use it
+# if you get "DelayedTable too big" errors
+#pdf_splittables = False
+
+# Set the default DPI for images
+#pdf_default_dpi = 72
+
+# Enable rst2pdf extension modules (default is only vectorpdf)
+# you need vectorpdf if you want to use sphinx's graphviz support
+pdf_extensions = ['vectorpdf', 'dotted_toc']
+
+# Page template name for "regular" pages
+#pdf_page_template = 'cutePage'
+
+# Show Table Of Contents at the beginning?
+pdf_use_toc = True
+
+# How many levels deep should the table of contents be?
+pdf_toc_depth = 5
+
+# Add section number to section references
+pdf_use_numbered_links = True
+
+# Background images fitting mode
+pdf_fit_background_mode = 'scale'
index d7d7bf94c25cbda4e35e99a8f9f636e9c5477af5..b98b0a1d508f3591eb4a87c7080edabdcfe483dd 100644 (file)
@@ -6,8 +6,6 @@
 Bugzilla Documentation
 ======================
 
-Contents:
-
 .. toctree::
    :maxdepth: 3
    :numbered:
@@ -23,10 +21,3 @@ Contents:
    modules
    gfdl
    glossary
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`search`
index e46f7e7da5faa60ce19e82fc0f70c12caab5a83c..2fc6721eb19b3b8edaf9457c1c98941ba2a63200 100755 (executable)
@@ -50,6 +50,9 @@ use Bugzilla::Install::Requirements
     qw(REQUIRED_MODULES OPTIONAL_MODULES);
 use Bugzilla::Constants qw(DB_MODULE BUGZILLA_VERSION);
 
+use File::Path qw(rmtree);
+use File::Which qw(which);
+
 ###############################################################################
 # Generate minimum version list
 ###############################################################################
@@ -174,5 +177,17 @@ foreach my $lang (@langs) {
 
     MakeDocs('HTML', 'make html');
     MakeDocs('TXT', 'make text');
-    MakeDocs('PDF', 'make latexpdf') if grep { $_ eq '--with-pdf' } @ARGV;
+
+    if (grep { $_ eq '--with-pdf' } @ARGV) {
+        if (which('pdflatex')) {
+            MakeDocs('PDF', 'make latexpdf');
+        }
+        elsif (which('rst2pdf')) {
+            rmtree('pdf', 0, 1);
+            MakeDocs('PDF', 'make pdf');
+        }
+        else {
+            say 'pdflatex or rst2pdf not found. Skipping PDF file creation';
+        }
+    }
 }