All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: "Jonathan Corbet" <corbet@lwn.net>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org
Subject: [PATCH RFC] docs: experimental: build PDF with rst2pdf
Date: Thu, 10 Dec 2020 17:01:19 +0100	[thread overview]
Message-ID: <a29b97f95cae490cb83da28410fade13d880f365.1607616056.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <20201210074845.4eb67f22@lwn.net>

Add an experimental PDF builder using rst2pdf

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 Documentation/Makefile                     |  5 +++++
 Documentation/conf.py                      | 21 +++++++++++++++------
 Documentation/userspace-api/media/Makefile |  1 +
 Makefile                                   |  4 ++--
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 61a7310b49e0..c3c8fb10f94e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -115,6 +115,10 @@ pdfdocs: latexdocs
 
 endif # HAVE_PDFLATEX
 
+rst2pdf:
+	@$(srctree)/scripts/sphinx-pre-install --version-check
+	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,pdf,$(var),pdf,$(var)))
+
 epubdocs:
 	@$(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
@@ -140,6 +144,7 @@ dochelp:
 	@echo  '  htmldocs        - HTML'
 	@echo  '  latexdocs       - LaTeX'
 	@echo  '  pdfdocs         - PDF'
+	@echo  '  rst2pdf         - PDF, using experimental rst2pdf support'
 	@echo  '  epubdocs        - EPUB'
 	@echo  '  xmldocs         - XML'
 	@echo  '  linkcheckdocs   - check for broken external links'
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 66e121df59cd..6f2788aac81e 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -123,6 +123,12 @@ if (major == 1 and minor > 3) or (major > 1):
 else:
     extensions.append("sphinx.ext.pngmath")
 
+# Enable experimental rst2pdf, if available
+try:
+    extensions.append("rst2pdf.pdfbuilder")
+except:
+    sys.stderr.write('rst2pdf extension not available.\n')
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -614,12 +620,15 @@ epub_exclude_files = ['search.html']
 #
 # See the Sphinx chapter of https://ralsina.me/static/manual.pdf
 #
-# FIXME: Do not add the index file here; the result will be too big. Adding
-# multiple PDF files here actually tries to get the cross-referencing right
-# *between* PDF files.
-pdf_documents = [
-    ('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
-]
+
+# Add all LaTeX files to PDF documents as well
+pdf_documents = []
+for l in latex_documents:
+    doc = l[0]
+    fn = l[1].replace(".tex", "")
+    name = l[2]
+    authors = l[3]
+    pdf_documents.append((doc, fn, name, authors))
 
 # kernel-doc extension configuration for running Sphinx directly (e.g. by Read
 # the Docs). In a normal build, these are supplied from the Makefile via command
diff --git a/Documentation/userspace-api/media/Makefile b/Documentation/userspace-api/media/Makefile
index 81a4a1a53bce..8c6b3ac4ecb0 100644
--- a/Documentation/userspace-api/media/Makefile
+++ b/Documentation/userspace-api/media/Makefile
@@ -59,6 +59,7 @@ all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
 html: all
 epub: all
 xml: all
+pdf: all
 latex: $(IMGPDF) all
 linkcheck:
 
diff --git a/Makefile b/Makefile
index 43ecedeb3f02..db4043578eec 100644
--- a/Makefile
+++ b/Makefile
@@ -264,7 +264,7 @@ no-dot-config-targets := $(clean-targets) \
 			 cscope gtags TAGS tags help% %docs check% coccicheck \
 			 $(version_h) headers headers_% archheaders archscripts \
 			 %asm-generic kernelversion %src-pkg dt_binding_check \
-			 outputmakefile
+			 outputmakefile rst2pdf
 no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
 
@@ -1654,7 +1654,7 @@ $(help-board-dirs): help-%:
 
 # Documentation targets
 # ---------------------------------------------------------------------------
-DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
+DOC_TARGETS := xmldocs latexdocs pdfdocs rst2pdf htmldocs epubdocs cleandocs \
 	       linkcheckdocs dochelp refcheckdocs
 PHONY += $(DOC_TARGETS)
 $(DOC_TARGETS):
-- 
2.29.2


  reply	other threads:[~2020-12-10 16:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 10:55 [PATCH 00/13] Address issues with PDF output at media uAPI docs Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 01/13] docs: conf.py: fix sphinx version detection for margin set Mauro Carvalho Chehab
2020-12-10 14:48   ` Jonathan Corbet
2020-12-10 16:01     ` Mauro Carvalho Chehab [this message]
2020-12-10 16:29       ` [PATCH RFC] docs: experimental: build PDF with rst2pdf Mauro Carvalho Chehab
2020-12-11  8:33         ` [PATCH RFC v2] " Mauro Carvalho Chehab
2020-12-11 20:48           ` Jonathan Corbet
2020-12-11 23:54             ` Mauro Carvalho Chehab
2020-12-12  0:03               ` Jonathan Corbet
2020-12-10 16:03     ` [PATCH 01/13] docs: conf.py: fix sphinx version detection for margin set Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 02/13] media: colorspaces-details.rst: drop tabularcolumns Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 03/13] media: control.rst: use a table for V4L2_CID_POWER_LINE Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 04/13] media: docs: sliced-vbi: fix V4L2_SLICED_WSS_625 docs Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 05/13] media: ext-ctrls-codec-stateless.rst: change a FWHT flag description Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 06/13] media: ext-ctrls-codec.rst: add a missing profile description Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 07/13] media: ext-ctrls-codec.rst: simplify a few tables Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 08/13] media: ext-ctrls-jpeg.rst: cleanup V4L2_CID_JPEG_COMPRESSION_QUALITY text Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 09/13] media: docs: pixfmt: use section titles for bayer formats Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 10/13] media: buffer.rst: fix a PDF output issue Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 11/13] media: ext-ctrls-codec-stateless.rst: fix an H-264 table format Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 12/13] media: pixfmt-yuv-planar.rst: fix PDF OUTPUT Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 13/13] media: docs: uAPI: fix table output in LaTeX/PDF format Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a29b97f95cae490cb83da28410fade13d880f365.1607616056.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=michal.lkml@markovi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.