Permalink
Browse files

Merge pull request #28 from ming13/improve-books-building

Improve books building
  • Loading branch information...
Karl Seguin
Karl Seguin committed Nov 23, 2012
2 parents 5823eb9 + b02db76 commit 51672439bf3a4c7fea1b474d98dbaf8dfbbb2a0d
Showing with 283 additions and 156 deletions.
  1. +5 −0 .gitignore
  2. +29 −0 Makefile
  3. +139 −0 common/pdf-template.tex
  4. +0 −3 en/metadata.xml
  5. +57 −80 en/redis.md
  6. +2 −0 en/title.txt
  7. +51 −36 readme.md
  8. +0 −37 template/xetex.template
View
@@ -0,0 +1,5 @@
+# Output books
+
+*.pdf
+*.epub
+*.mobi
View
@@ -0,0 +1,29 @@
+SOURCE_FILE_NAME = redis.md
+BOOK_FILE_NAME = redis
+
+PDF_BUILDER = pandoc
+PDF_BUILDER_FLAGS = \
+ --latex-engine xelatex \
+ --template ../common/pdf-template.tex \
+ --listings
+
+EPUB_BUILDER = pandoc
+EPUB_BUILDER_FLAGS = \
+ --epub-cover-image
+
+MOBI_BUILDER = kindlegen
+
+
+en/redis.pdf:
+ cd en && $(PDF_BUILDER) $(PDF_BUILDER_FLAGS) $(SOURCE_FILE_NAME) -o $(BOOK_FILE_NAME).pdf
+
+en/redis.epub: en/title.png en/title.txt en/redis.md
+ $(EPUB_BUILDER) $(EPUB_BUILDER_FLAGS) $^ -o $@
+
+en/redis.mobi: en/redis.epub
+ $(MOBI_BUILDER) $^
+
+clean:
+ rm -f */$(BOOK_FILE_NAME).pdf
+ rm -f */$(BOOK_FILE_NAME).epub
+ rm -f */$(BOOK_FILE_NAME).mobi
View
@@ -0,0 +1,139 @@
+\documentclass{book}
+
+
+% Fonts and typography
+
+%% Typography
+\usepackage[no-math]{fontspec}
+\defaultfontfeatures{Mapping = tex-text, Scale = MatchLowercase}
+
+%% Fonts
+\setmainfont{Verdana}
+\setsansfont{Verdana}
+\setmonofont{Consolas}
+
+%% Set Sans font in headings
+\usepackage{sectsty}
+\allsectionsfont{\sffamily}
+
+%% Set polyglossia language
+\usepackage{polyglossia}
+\setdefaultlanguage{english}
+
+
+% Page
+
+%% Use full page in book style
+\usepackage{fullpage}
+
+%% Set line spacing
+\usepackage{setspace}
+\setstretch{1.2}
+
+%% Disable paragraph indentation
+\usepackage{parskip}
+
+%% Start sections from new page
+\let\stdsection\section
+\renewcommand\section{\newpage\stdsection}
+
+
+% Colors
+
+\usepackage{xcolor}
+
+%% Tango color scheme
+\definecolor{SkyBlue}{HTML}{3465A4}
+\definecolor{DarkSkyBlue}{HTML}{204A87}
+
+\definecolor{Plum}{HTML}{75507B}
+
+\definecolor{ScarletRed}{HTML}{CC0000}
+
+\definecolor{Aluminium1}{HTML}{EEEEEC}
+\definecolor{Aluminium6}{HTML}{2e3436}
+
+\definecolor{Black}{HTML}{000000}
+
+
+% Listings
+
+\usepackage{listings}
+
+\lstdefinelanguage{JavaScript}{
+ keywords = {typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
+ keywordstyle = \color{SkyBlue}\bfseries,
+ ndkeywords = {class, export, boolean, throw, implements, import, this},
+ ndkeywordstyle = \color{Aluminium6}\bfseries,
+ identifierstyle = \color{Black},
+ sensitive = false,
+ comment = [l]{//},
+ morecomment = [s]{/*}{*/},
+ commentstyle = \color{Plum}\ttfamily,
+ stringstyle = \color{ScarletRed}\ttfamily,
+ morestring = [b]',
+ morestring = [b]"
+}
+
+\lstset{
+ language = JavaScript,
+ backgroundcolor = \color{Aluminium1},
+ extendedchars = true,
+ basicstyle = \normalsize\ttfamily,
+ showstringspaces = false,
+ showspaces = false,
+ tabsize = 1,
+ breaklines = true,
+ showtabs = false
+}
+
+
+% Links
+
+%% Hyperref
+\usepackage[colorlinks, breaklinks, bookmarks, xetex]{hyperref}
+
+\hypersetup {
+ linkcolor = DarkSkyBlue,
+ citecolor = DarkSkyBlue,
+ filecolor = DarkSkyBlue,
+ urlcolor = DarkSkyBlue
+}
+
+%% Don’t use Mono font for URLs
+\urlstyle{same}
+
+
+% Images
+
+\usepackage{graphicx}
+
+
+% Pandoc hacks
+
+%% Normal enumerates processing
+\usepackage{enumerate}
+
+%% Disable section numbers
+\setcounter{secnumdepth}{0}
+
+
+\begin{document}
+
+ % Title page
+
+ \thispagestyle{empty}
+
+ \vspace*{\fill}
+ \begin{center}
+ \includegraphics[width=0.7\textwidth]{title}
+ \end{center}
+ \vspace*{\fill}
+
+ \setcounter{page}{0}
+
+ % Book contents
+
+ $body$
+
+\end{document}
View
@@ -1,3 +0,0 @@
-<dc:title>The Little Redis Book</dc:title>
-<dc:creator opf:file-as="Seguin, Karl" opf:role="aut">Karl Seguin</dc:creator>
-<dc:contributor opf:file-as="Neal, Perry" opf:role="edt">Perry Neal</dc:contributor>
Oops, something went wrong.

0 comments on commit 5167243

Please sign in to comment.