Skip to content

Commit

Permalink
Fixed toc and link errors for epub build (Issue cakephp#1126). Add co…
Browse files Browse the repository at this point in the history
…ver to epub.

* The epub build is derived from the html build in sphinx; however, some
sections, such as "Welcome" don't make sense to include in the epub.
Essentially, this means that the epub needs it's own toc file which
is what this commit adds (epub-contents.rst). Since there's no
epub_ type option to override the master_doc var, this has to be done
as an arg to sphinx-build.

* This commit also adds a cover to the epub so it looks more like a
real book. The cover isn't great but at least the framework will
be there for someone to add a real cover image.
  • Loading branch information
kmasaryk committed Mar 4, 2014
1 parent ce99b33 commit 3913959
Show file tree
Hide file tree
Showing 23 changed files with 218 additions and 23 deletions.
13 changes: 10 additions & 3 deletions config/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,22 @@

epub_theme = 'cakephp-epub'

# The cover page information.
epub_cover = ('_static/epub-logo.png', 'epub-cover.html')

# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''

# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
epub_scheme = 'URL'

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
epub_identifier = 'http://cakephp.org'

# A unique identification for the text.
#epub_uid = ''
epub_uid = 'cakephpcookbook1393624653'

# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
Expand All @@ -275,6 +278,7 @@
'index.html',
'pdf-contents.html',
'search.html',
'contents.html'
]

# The depth of the table of contents in toc.ncx.
Expand All @@ -283,6 +287,9 @@
# Allow duplicate toc entries.
epub_tocdup = False

# If true, add an index to the epub document.
epub_use_index = False

# Languages available.
languages = ['en', 'pt', 'es', 'ja', 'ru', 'fr']

Expand Down
2 changes: 1 addition & 1 deletion en/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
4 changes: 3 additions & 1 deletion en/core-libraries/behaviors/containable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ model, you don't need to use 'contain' again for related models
all models used in containment, you may consider attaching it to
your AppModel.

.. _containablebehavior-options:

ContainableBehavior options
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -428,7 +430,7 @@ Here's an example of how to contain associations when paginating::
.. note::

If you contained the associations through the model instead,
it will not honor Containable's :ref:`recursive option <containableBehavior-options>`.
it will not honor Containable's :ref:`recursive option <containablebehavior-options>`.
So if you set recursive to -1 for example for the model, it won't work::

$this->User->recursive = -1;
Expand Down
2 changes: 1 addition & 1 deletion en/core-libraries/global-constants-and-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ such as debugging and translating content.
If ``$showHTML`` is true or left as null, the data is rendered to be
browser-friendly.
If $showFrom is not set to false, the debug output will start with the line from
which it was called
which it was called.
Also see :doc:`/development/debugging`

.. php:function:: env(string $key)
Expand Down
3 changes: 2 additions & 1 deletion en/core-libraries/helpers/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ Datetime options
Form Element-Specific Methods
=============================

All elements are created under a form for the ``User`` model as in the examples above.
All elements are created under a form for the ``User`` model as in the examples above.
For this reason, the HTML code generated will contain attributes that reference to the User model.
Ex: name=data[User][username], id=UserUsername

Expand Down Expand Up @@ -1057,6 +1057,7 @@ Ex: name=data[User][username], id=UserUsername
generated. Example:

.. code-block:: html

<textarea name="data[User][notes]" id="UserNotes">
This text is to be edited.
</textarea>
Expand Down
26 changes: 26 additions & 0 deletions en/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Contents
########

.. toctree::
:maxdepth: 3

installation
getting-started
cakephp-overview
controllers
views
models
core-libraries
plugins
console-and-shells
development
deployment
tutorials-and-examples
contributing
appendices

.. todolist::

.. meta::
:title lang=en: Contents
:keywords lang=en: core libraries,ref search,shells,deployment,appendices,glossary,models
4 changes: 2 additions & 2 deletions en/models/datasources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ So if the Sqlserver Datasource errors out with::
Error: Database connection "Sqlserver" is missing, or could not be created.

First check if the SQL Server PHP extension pdo_sqlsrv and the SQL Server Native
Client.
Client are installed properly.

.. meta::
:title lang=en: DataSources
:keywords lang=en: array values,model fields,connection configuration,implementation details,relational databases,best bet,mysql postgresql,sqlite,external sources,ldap server,database connection,rdbms,sqlserver,postgres,relational database,mssql,aggregates,apis,repository,signatures
Client are installed properly.

4 changes: 2 additions & 2 deletions es/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
PYTHON = python
LANG = es
LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
13 changes: 13 additions & 0 deletions es/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Contents
########

.. toctree::
:maxdepth: 3

installation
getting-started
cakephp-overview
tutorials-and-examples

.. todolist::

4 changes: 2 additions & 2 deletions fr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
PYTHON = python
LANG = fr
LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
26 changes: 26 additions & 0 deletions fr/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Contenu
#######

.. toctree::
:maxdepth: 3

installation
getting-started
cakephp-overview
controllers
views
models
core-libraries
plugins
console-and-shells
development
deployment
tutorials-and-examples
contributing
appendices

.. todolist::

.. meta::
:title lang=fr: Contents
:keywords lang=fr: librairies du coeur,ref search,shells,déploiement,appendices,glossary,models
4 changes: 2 additions & 2 deletions ja/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
PYTHON = python
LANG = ja
LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
23 changes: 23 additions & 0 deletions ja/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
コンテンツ
##########

.. toctree::
:maxdepth: 3

installation
getting-started
cakephp-overview
controllers
views
models
core-libraries
plugins
console-and-shells
development
deployment
tutorials-and-examples
contributing
appendices

.. todolist::

4 changes: 2 additions & 2 deletions pt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
PYTHON = python
LANG = pt
LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
23 changes: 23 additions & 0 deletions pt/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Contents
########

.. toctree::
:maxdepth: 3

installation
getting-started
cakephp-overview
controllers
views
models
core-libraries
plugins
console-and-shells
development
deployment
tutorials-and-examples
contributing
appendices

.. todolist::

4 changes: 2 additions & 2 deletions ro/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
PYTHON = python
LANG = ro
LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
9 changes: 9 additions & 0 deletions ro/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Cuprins
#######

.. toctree::
:maxdepth: 3

index

.. todolist::
4 changes: 2 additions & 2 deletions ru/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
PYTHON = python
LANG = ru
LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
23 changes: 23 additions & 0 deletions ru/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Содержание
##########

.. toctree::
:maxdepth: 3

installation
getting-started
cakephp-overview
controllers
views
models
core-libraries
plugins
console-and-shells
development
deployment
tutorials-and-examples
contributing
appendices

.. todolist::

4 changes: 2 additions & 2 deletions sr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
PYTHON = python
LANG = sr
LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -88,7 +88,7 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."

Expand Down
9 changes: 9 additions & 0 deletions sr/epub-contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Contents
########

.. toctree::
:maxdepth: 3

index

.. todolist::
Loading

0 comments on commit 3913959

Please sign in to comment.