Commit 2cf77ff7 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

Add support for ebook generation in ePUB and mobi format

parent 8c3f5cb3
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ endif
SOURCES=$(wildcard src/*.txt)
OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst)

.PHONY: help clean-all clean epub html pdf old venv
.PHONY: help clean-all clean ebook html pdf old venv

# ------------------------------------------

@@ -32,7 +32,7 @@ help:
	@echo "  pdf        create Manual.pdf and Developer.pdf in this dir"
	@echo "  old        create old-style HTML doc pages in old dir"
	@echo "  fetch      fetch HTML and PDF files from LAMMPS web site"
	@echo "  epub       create ePUB file with manual in this dir"
	@echo "  ebook      create ePUB/mobi file with manual in this dir"
	@echo "  clean      remove all intermediate RST files"
	@echo "  clean-all  reset the entire build environment"
	@echo "  txt2html   build txt2html tool"
@@ -64,16 +64,19 @@ html: $(OBJECTS)
	@rm -rf html/USER/*/*.[sg]*
	@echo "Build finished. The HTML pages are in doc/html."

epub: $(OBJECTS)
ebook: $(OBJECTS)
	@mkdir -p epub
	@cp src/JPG/lammps-logo.png epub/
	@(\
		. $(VENV)/bin/activate ;\
		cp -r src/* $(RSTDIR)/ ;\
		sphinx-build -j 8 -b epub -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
		deactivate ;\
	)
	@mv -f epub/LAMMPS.epub .
	@-(cd epub; ebook-convert LAMMPS.epub LAMMPS.mobi )
	@-mv -f epub/LAMMPS.epub epub/LAMMPS.mobi .
	@rm -rf epub
	@echo "Build finished. The ePUB file LAMMPS.epub is created/updated."
	@echo "Build finished. The ebook file(s) is/are created."

pdf: utils/txt2html/txt2html.exe
	@(\
+25 −1
Original line number Diff line number Diff line
LAMMPS Documentation

Depending on how you obtained LAMMPS, this directory has 2 or 3
sub-directories and optionally 2 PDF files:
sub-directories and optionally 2 PDF files and 2 ebook files:

src             content files for LAMMPS documentation
html            HTML version of the LAMMPS manual (see html/Manual.html)
tools           tools and settings for building the documentation
Manual.pdf      large PDF version of entire manual
Developer.pdf   small PDF with info about how LAMMPS is structured
LAMMPS.epub     Manual in ePUB format
LAMMPS.mobi     Manual in mobi format (required for for Kindle)

If you downloaded LAMMPS as a tarball from the web site, all these
directories and files should be included.
@@ -49,6 +51,9 @@ make pdf # generate 2 PDF files (Manual.pdf,Developer.pdf)
make old          # generate old-style HTML pages in old dir via txt2html
make fetch        # fetch HTML doc pages and 2 PDF files from web site
                  #   as a tarball and unpack into html dir and 2 PDFs
make ebook        # generate e-book LAMMPS.epub in ePUB format using Sphinx 
                  #   optionally convert it to mobi format (for Kindle
                  #   readers, requires "ebook-convert" from Calibre)
make clean        # remove intermediate RST files created by HTML build
make clean-all    # remove entire build folder and any cached data

@@ -91,3 +96,22 @@ This will install virtualenv from the Python Package Index.
----------------

Installing prerequisites for PDF build

[TBA]

----------------

Installing prerequisites for ebook build

## ePUB

Same as for HTML. This uses the same tools and configuration
files as the HTML tree.

## mobi

For converting the generated ePUB file to a mobi format file
(for e-book readers, that cannot read ePUB), you also need to have
the 'ebook-convert' tool from the "calibre" software installed.
http://calibre-ebook.com/
+4.79 KiB
Loading image diff...
+23 −0
Original line number Diff line number Diff line
@@ -276,4 +276,27 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

# -- Options for ePUB output ----------------------------------------------

epub_title = 'LAMMPS Documentation - ' + get_lammps_version()

epub_cover = ('lammps-logo.png', '')

epub_description = """
This is the Manual for the LAMMPS software package.

LAMMPS stands for Large-scale Atomic/Molecular Massively Parallel
Simulator and is a classical molecular dynamics simulation code
designed to run efficiently on parallel computers.  It was developed
at Sandia National Laboratories, a US Department of Energy facility,
with funding from the DOE.  It is an open-source code, distributed
freely under the terms of the GNU Public License (GPL).

The primary author of the code is Steve Plimpton, who can be emailed
at sjplimp@sandia.gov.  The LAMMPS WWW Site at lammps.sandia.gov has
more information about the code and its uses.
"""

epub_author = 'The LAMMPS Developers'