[dpdk-dev] [PATCH v2 2/4] doc: Add Sphinx config to build pdf version of guides

2015-01-30 Thread Thomas Monjalon
2015-01-30 18:13, John McNamara:
> Add Python Sphinx config to allow conversion of guides
> to PDF format.
> 
> Signed-off-by: John McNamara 
> ---
>  doc/guides/conf.py|   51 
> ++---
>  doc/guides/freebsd_gsg/conf.py|   41 +
>  doc/guides/linux_gsg/conf.py  |   41 +
>  doc/guides/prog_guide/conf.py |   41 +
>  doc/guides/rel_notes/conf.py  |   41 +
>  doc/guides/sample_app_ug/conf.py  |   41 +
>  doc/guides/testpmd_app_ug/conf.py |   41 +
>  7 files changed, 293 insertions(+), 4 deletions(-)
>  create mode 100644 doc/guides/freebsd_gsg/conf.py
>  create mode 100644 doc/guides/linux_gsg/conf.py
>  create mode 100644 doc/guides/prog_guide/conf.py
>  create mode 100644 doc/guides/rel_notes/conf.py
>  create mode 100644 doc/guides/sample_app_ug/conf.py
>  create mode 100644 doc/guides/testpmd_app_ug/conf.py

I think it is possible to use the existing conf.py.
The only thing different in all these files is the generated filename
which could be computed from the title or extracted from an rst comment.

> --- a/doc/guides/conf.py
> +++ b/doc/guides/conf.py
> +texinfo_documents = [
> +('index',
> + '',
> + '',
> + '',
> + '',
> + '',
> + 'Miscellaneous')]

Why texinfo?

> +
> +# Override the dafault Latex formatter.

Typo: default

> +class CustomLatexFormatter(LatexFormatter):
> +
> +def __init__(self, **options):
> +
> +super(CustomLatexFormatter, self).__init__(**options)
> +
> +self.verboptions = r"formatcom=\footnotesize"

Please comment this line. I don't understand.

> +
> +PygmentsBridge.latex_formatter = CustomLatexFormatter

-- 
Thomas


[dpdk-dev] [PATCH v2 2/4] doc: Add Sphinx config to build pdf version of guides

2015-01-30 Thread John McNamara
Add Python Sphinx config to allow conversion of guides
to PDF format.

Signed-off-by: John McNamara 
---
 doc/guides/conf.py|   51 ++---
 doc/guides/freebsd_gsg/conf.py|   41 +
 doc/guides/linux_gsg/conf.py  |   41 +
 doc/guides/prog_guide/conf.py |   41 +
 doc/guides/rel_notes/conf.py  |   41 +
 doc/guides/sample_app_ug/conf.py  |   41 +
 doc/guides/testpmd_app_ug/conf.py |   41 +
 7 files changed, 293 insertions(+), 4 deletions(-)
 create mode 100644 doc/guides/freebsd_gsg/conf.py
 create mode 100644 doc/guides/linux_gsg/conf.py
 create mode 100644 doc/guides/prog_guide/conf.py
 create mode 100644 doc/guides/rel_notes/conf.py
 create mode 100644 doc/guides/sample_app_ug/conf.py
 create mode 100644 doc/guides/testpmd_app_ug/conf.py

diff --git a/doc/guides/conf.py b/doc/guides/conf.py
index 385af03..71253c5 100644
--- a/doc/guides/conf.py
+++ b/doc/guides/conf.py
@@ -28,12 +28,55 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-import subprocess
+from subprocess import check_output
+from sphinx.highlighting import PygmentsBridge
+from pygments.formatters.latex import LatexFormatter

 project = 'DPDK'
-
 copyright = '2014, Intel'
+master_doc = 'index'

-version = subprocess.check_output(["make","-sRrC","../../", "showversion"])

-master_doc = 'index'
+# Configuration for latex/pdf files.
+latex_preamble = r"""
+\usepackage[utf8]{inputenc}
+\usepackage{DejaVuSansMono}
+\usepackage[T1]{fontenc}
+\usepackage{helvet}
+\renewcommand{\familydefault}{\sfdefault}
+
+\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{xleftmargin=5mm}
+"""
+
+latex_elements = {
+'papersize': 'a4paper',
+'pointsize': '11pt',
+'preamble': latex_preamble}
+
+latex_documents = [
+('index',
+ 'dpdk_docs.tex',
+ '',
+ '',
+ 'manual')]
+
+texinfo_documents = [
+('index',
+ '',
+ '',
+ '',
+ '',
+ '',
+ 'Miscellaneous')]
+
+
+# Override the dafault Latex formatter.
+class CustomLatexFormatter(LatexFormatter):
+
+def __init__(self, **options):
+
+super(CustomLatexFormatter, self).__init__(**options)
+
+self.verboptions = r"formatcom=\footnotesize"
+
+PygmentsBridge.latex_formatter = CustomLatexFormatter
diff --git a/doc/guides/freebsd_gsg/conf.py b/doc/guides/freebsd_gsg/conf.py
new file mode 100644
index 000..fd97d69
--- /dev/null
+++ b/doc/guides/freebsd_gsg/conf.py
@@ -0,0 +1,41 @@
+#   BSD LICENSE
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+execfile('../conf.py')
+
+release = check_output(['make', '-sRrC', '../../../', 'showversion'])
+
+# Overide the latex_documents to change the output name.
+latex_documents = [
+('index',
+ 'dpdk_freebsd_getting_started_guide.tex',
+ '',
+ '',
+ 'manual')]
diff --git a/doc/guides/linux_gsg/conf.py b/doc/guides/linux_gsg/conf.py
new file mode 100644
index 000..8086763
--- /dev/null
+++ b/doc/guides/linux_gsg/conf.py
@@ -0,0 +1,41 @@
+#   BSD LICENSE
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with