doc: added EPUB target into Makefile

This commit is contained in:
Daniel Salzman 2020-01-24 14:37:24 +01:00 committed by Jan Hak
parent 1840e6aebc
commit a71174f4f2
6 changed files with 88 additions and 4 deletions

View file

@ -1,8 +1,8 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src tests tests-fuzz python samples distro doc
.PHONY: singlehtml install-singlehtml
singlehtml install-singlehtml:
.PHONY: singlehtml epub install-singlehtml install-epub
singlehtml install-singlehtml epub install-epub:
$(MAKE) -C doc $@
.PHONY: check-compile

View file

@ -76,7 +76,7 @@ man_SPHINXOPTS = $(_SPHINXOPTS) \
$(SPHINXOPTS) \
$(srcdir)
.PHONY: html-local singlehtml pdf-local info-local man install-html-local install-singlehtml install-pdf-local install-info-local
.PHONY: html-local singlehtml pdf-local info-local epub man install-html-local install-singlehtml install-pdf-local install-info-local install-epub
man_MANS =
@ -155,6 +155,15 @@ install-singlehtml: singlehtml
$(INSTALL_DATA) $(SPHINXBUILDDIR)/singlehtml/*.html $(DESTDIR)/$(docdir)/
$(INSTALL_DATA) $(SPHINXBUILDDIR)/singlehtml/_static/* $(DESTDIR)/$(docdir)/_static/
epub:
$(AM_V_SPHINX)$(SPHINXBUILD) -b epub -A today=$(RELEASE_DATE) -d $(SPHINXBUILDDIR)/doctrees $(ALLSPHINXOPTS) $(SPHINXBUILDDIR)/epub
$(AM_V_ECHO)
$(AM_V_ECHO) "Build finished. The EPUB file is in $(SPHINXBUILDDIR)/epub/."
install-epub:
$(INSTALL) -d $(DESTDIR)/$(docdir)
$(INSTALL_DATA) $(SPHINXBUILDDIR)/epub/KnotDNS.epub $(DESTDIR)/$(docdir)/
if HAVE_PDFLATEX
pdf-local:
$(AM_V_SPHINX)$(SPHINXBUILD) -b latex -d $(SPHINXBUILDDIR)/doctrees $(ALLSPHINXOPTS) $(SPHINXBUILDDIR)/latex
@ -201,7 +210,7 @@ $(MANPAGES_IN): $(MANPAGES_RST)
$(AM_V_ECHO) "Build finished. The man pages are in man/."
else
html-local singlehtml pdf-local info-local man install-html-local install-singlehtml install-pdf-local install-info-local:
html-local singlehtml pdf-local info-local epub man install-html-local install-singlehtml install-pdf-local install-info-local install-epub:
$(AM_V_ECHO) "Please install sphinx (python-sphinx) to generate Knot DNS documentation."
endif # HAVE_SPHINXBUILD

View file

@ -256,3 +256,14 @@ texinfo_documents = [
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# -- Options for Epub output ----------------------------------------------
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
epub_theme = 'theme_epub'
epub_cover = ('_static/logo.svg', 'epub-cover.html')
epub_exclude_files = ['epub-cover.xhtml']

View file

@ -0,0 +1,33 @@
{#
epub/epub-cover.html
~~~~~~~~~~~~~~~~~~~~
Sample template for the html cover page.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{%- extends "layout.html" %}
{%- block header %}{% endblock %}
{%- block rootrellink %}{% endblock %}
{%- block relbaritems %}{% endblock %}
{%- block sidebarlogo %}{% endblock %}
{%- block linktags %}{% endblock %}
{%- block relbar1 %}{% endblock %}
{%- block sidebar1 %}{% endblock %}
{%- block sidebar2 %}{% endblock %}
{%- block footer %}{% endblock %}
{% block content %}
<div class="epub-cover">
<img src="{{ image }}" alt="Cover image" />
<h1>Knot DNS Documentation</h1>
{% if version %}
<h2 class="version">Release {{ version }}</h2>
{% endif %}{% if copyright %}
<h2>{{ copyright }}</h2>
{% endif %}{% if today %}
<p class="date">{{ today }}</p>
{% endif %}
</div>
{% endblock %}

View file

@ -0,0 +1,28 @@
@import url("epub.css");
/* Addendum for admonitions */
@import url("admons.css");
/* Other overrides here */
.epub-cover {
border-top: 1px solid black;
padding: 10px 25px 0px 25px;
text-align: right;
}
.epub-cover img {
display: block;
margin-left: auto;
margin-right: auto;
max-width: 80%;
}
.epub-cover .version {
font-style: italic;
margin-bottom: 100px;
}
.epub-cover .date {
margin-top: 200px;
font-size: 125%;
}

View file

@ -0,0 +1,3 @@
[theme]
inherit = epub
stylesheet = main.css