mirror of https://github.com/kivy/kivy.git
Docs: First take at nicer PDF generation. Basic fonts/layout adapted by
Flask (thanks Armin). Adapted our website color scheme where applicable. Also added a Pygments highlighting style for code snippets. To generate: make pdf in root folder and the pdf will be in doc/build/latex/Kivy.pdf TODO: * Get proper logo file for frontpage * Write Pygments lexer for kv lang * Would be nice if code boxes were also rounded. Find LaTeX guru
This commit is contained in:
parent
692b075315
commit
fe504d7553
5
Makefile
5
Makefile
|
@ -8,6 +8,9 @@ mesabuild:
|
|||
build:
|
||||
$(PYTHON) setup.py build_ext --inplace
|
||||
|
||||
pdf:
|
||||
$(MAKE) -C doc latex && make -C doc/build/latex all-pdf
|
||||
|
||||
style:
|
||||
$(PYTHON) $(CHECKSCRIPT) $(KIVY_DIR)
|
||||
|
||||
|
@ -15,6 +18,8 @@ stylereport:
|
|||
$(PYTHON) $(CHECKSCRIPT) -html $(KIVY_DIR)
|
||||
|
||||
hook:
|
||||
# Install pre-commit git hook to check your changes for styleguide
|
||||
# consistency.
|
||||
cp kivy/tools/pep8checker/pre-commit.githook .git/hooks/pre-commit
|
||||
chmod +x .git/hooks/pre-commit
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ master_doc = 'index'
|
|||
|
||||
# General substitutions.
|
||||
project = 'Kivy'
|
||||
copyright = '2010, kivy-dev'
|
||||
copyright = '2010, The Kivy Authors'
|
||||
|
||||
# The default replacements for |version| and |release|, also used in various
|
||||
# other places throughout the built documents.
|
||||
|
@ -84,7 +84,7 @@ today_fmt = '%B %d, %Y'
|
|||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = 'kivy_pygments_theme.KivyStyle'
|
||||
|
||||
|
||||
# Options for HTML output
|
||||
|
@ -168,16 +168,24 @@ htmlhelp_basename = 'Kivydoc'
|
|||
# (source start file, target name, title, author, document class [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'Kivy.tex', 'Kivy Documentation',
|
||||
'kivy-dev', 'manual'),
|
||||
'The Kivy Developers', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
latex_elements = {
|
||||
'fontpkg': r'\usepackage{mathpazo}',
|
||||
'papersize': 'a4paper',
|
||||
'pointsize': '8pt',
|
||||
'preamble': r'\usepackage{kivystyle}'
|
||||
}
|
||||
latex_additional_files = ['kivystyle.sty', 'logo.pdf']
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
latex_use_parts = True
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#latex_preamble = ''
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
\definecolor{TitleColor}{rgb}{0,0,0}
|
||||
\definecolor{InnerLinkColor}{rgb}{0,0,0}
|
||||
% Make links the same color as links on the website
|
||||
\definecolor{OuterLinkColor}{rgb}{0.875,0.392,0.133}
|
||||
|
||||
% TODO Find a way not to have this active when printing the file
|
||||
\definecolor{bgcolor}{rgb}{0.98,0.98,0.945}
|
||||
\pagecolor{bgcolor}
|
||||
|
||||
% Color for warning boxes
|
||||
\definecolor{warningcolor}{rgb}{0.78,0.18,0}
|
||||
|
||||
% This could be used to add a tiled background:
|
||||
%\usepackage{wallpaper}
|
||||
%\ThisTileSquareWallPaper{10}{background.png}
|
||||
|
||||
% Code background color
|
||||
\definecolor{VerbatimColor}{rgb}{0.925,0.918,0.882}
|
||||
|
||||
% Palatino needs more leading (space between lines)
|
||||
\linespread{1.05}
|
||||
|
||||
|
||||
% Override default commands below for custom style:
|
||||
|
||||
\renewcommand{\maketitle}{%
|
||||
\begin{titlepage}%1
|
||||
\let\footnotesize\small
|
||||
\let\footnoterule\relax
|
||||
\ifsphinxpdfoutput
|
||||
\begingroup
|
||||
% This \def is required to deal with multi-line authors; it
|
||||
% changes \\ to ', ' (comma-space), making it pass muster for
|
||||
% generating document info in the PDF file.
|
||||
\def\\{, }
|
||||
\pdfinfo{
|
||||
/Author (\@author)
|
||||
/Title (\@title)
|
||||
}
|
||||
\endgroup
|
||||
\fi
|
||||
\begin{flushright}%
|
||||
%\sphinxlogo%
|
||||
{\center
|
||||
\vspace*{3cm}
|
||||
\includegraphics[scale=0.7]{logo.pdf}
|
||||
\vspace{3cm}
|
||||
\par
|
||||
{\rm\Huge \@title \par}%
|
||||
{\em\LARGE \py@release\releaseinfo \par}
|
||||
% Small hack to get the URL onto the first page
|
||||
{\small www.kivy.org}
|
||||
{\large
|
||||
%\@date \par
|
||||
\py@authoraddress \par
|
||||
}
|
||||
}
|
||||
\end{flushright}%\par
|
||||
\@thanks
|
||||
\end{titlepage}%
|
||||
\cleardoublepage%
|
||||
\setcounter{footnote}{0}%
|
||||
\let\thanks\relax\let\maketitle\relax
|
||||
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
|
||||
}
|
||||
|
||||
\fancypagestyle{normal}{
|
||||
\fancyhf{}
|
||||
\fancyfoot[LE,RO]{{\thepage}}
|
||||
\fancyfoot[LO]{{\nouppercase{\rightmark}}}
|
||||
\fancyfoot[RE]{{\nouppercase{\leftmark}}}
|
||||
\fancyhead[LE,RO]{{ \@title, \py@release}}
|
||||
\renewcommand{\headrulewidth}{0.4pt}
|
||||
\renewcommand{\footrulewidth}{0.4pt}
|
||||
}
|
||||
|
||||
\fancypagestyle{plain}{
|
||||
\fancyhf{}
|
||||
\fancyfoot[LE,RO]{{\thepage}}
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
\renewcommand{\footrulewidth}{0.4pt}
|
||||
}
|
||||
|
||||
\titleformat{\section}{\Large}%
|
||||
{\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor}
|
||||
\titleformat{\subsection}{\large}%
|
||||
{\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
|
||||
\titleformat{\subsubsection}{}%
|
||||
{\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
|
||||
\titleformat{\paragraph}{\large}%
|
||||
{\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}
|
||||
|
||||
\ChNameVar{\raggedleft\normalsize}
|
||||
\ChNumVar{\raggedleft \bfseries\Large}
|
||||
\ChTitleVar{\raggedleft \rm\Huge}
|
||||
|
||||
\renewcommand\thepart{\@Roman\c@part}
|
||||
\renewcommand\part{%
|
||||
\pagestyle{plain}
|
||||
\if@noskipsec \leavevmode \fi
|
||||
\cleardoublepage
|
||||
\vspace*{6cm}%
|
||||
\@afterindentfalse
|
||||
\secdef\@part\@spart}
|
||||
|
||||
\def\@part[#1]#2{%
|
||||
\ifnum \c@secnumdepth >\m@ne
|
||||
\refstepcounter{part}%
|
||||
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
|
||||
\else
|
||||
\addcontentsline{toc}{part}{#1}%
|
||||
\fi
|
||||
{\parindent \z@ %\center
|
||||
\interlinepenalty \@M
|
||||
\normalfont
|
||||
\ifnum \c@secnumdepth >\m@ne
|
||||
\rm\Large \partname~\thepart
|
||||
\par\nobreak
|
||||
\fi
|
||||
\MakeUppercase{\rm\Huge #2}%
|
||||
\markboth{}{}\par}%
|
||||
\nobreak
|
||||
\vskip 8ex
|
||||
\@afterheading}
|
||||
\def\@spart#1{%
|
||||
{\parindent \z@ %\center
|
||||
\interlinepenalty \@M
|
||||
\normalfont
|
||||
\huge \bfseries #1\par}%
|
||||
\nobreak
|
||||
\vskip 3ex
|
||||
\@afterheading}
|
||||
|
||||
% We want colored warning boxes
|
||||
\renewcommand{\py@heavybox}{
|
||||
\setlength{\fboxrule}{1pt}
|
||||
\setlength{\fboxsep}{6pt}
|
||||
\setlength{\py@noticelength}{\linewidth}
|
||||
\addtolength{\py@noticelength}{-2\fboxsep}
|
||||
\addtolength{\py@noticelength}{-2\fboxrule}
|
||||
%\setlength{\shadowsize}{3pt}
|
||||
\color{warningcolor}
|
||||
\Sbox
|
||||
\minipage{\py@noticelength}
|
||||
% After drawing the box, reset to black
|
||||
\color{black}
|
||||
}
|
||||
|
||||
|
||||
% Font used for code snippets
|
||||
\usepackage{beramono}
|
||||
|
||||
|
||||
% XXX find a solution for this
|
||||
% fix single quotes, for inconsolata. (does not work)
|
||||
%%\usepackage{textcomp}
|
||||
%%\begingroup
|
||||
%% \catcode`'=\active
|
||||
%% \g@addto@macro\@noligs{\let'\textsinglequote}
|
||||
%% \endgroup
|
||||
%%\endinput
|
Binary file not shown.
|
@ -0,0 +1,87 @@
|
|||
# kivy pygments style based on flask/tango style
|
||||
from pygments.style import Style
|
||||
from pygments.token import Keyword, Name, Comment, String, Error, \
|
||||
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
|
||||
|
||||
|
||||
class KivyStyle(Style):
|
||||
# The background color is set in kivystyle.sty
|
||||
background_color = ""
|
||||
default_style = ""
|
||||
|
||||
styles = {
|
||||
# No corresponding class for the following:
|
||||
#Text: "", # class: ''
|
||||
Whitespace: "underline #ffffff", # class: 'w'
|
||||
Error: "#FF0000 border:#FF0000", # class: 'err'
|
||||
Other: "#FF0000", # class 'x'
|
||||
|
||||
Comment: "italic #aaa385", # class: 'c'
|
||||
Comment.Preproc: "noitalic", # class: 'cp'
|
||||
|
||||
Keyword: "bold #000000", # class: 'k'
|
||||
Keyword.Constant: "bold #000000", # class: 'kc'
|
||||
Keyword.Declaration: "bold #000000", # class: 'kd'
|
||||
Keyword.Namespace: "bold #000000", # class: 'kn'
|
||||
Keyword.Pseudo: "bold #000000", # class: 'kp'
|
||||
Keyword.Reserved: "bold #000000", # class: 'kr'
|
||||
Keyword.Type: "bold #000000", # class: 'kt'
|
||||
|
||||
Operator: "#582800", # class: 'o'
|
||||
Operator.Word: "bold #000000", # class: 'ow' - like keywords
|
||||
|
||||
Punctuation: "bold #000000", # class: 'p'
|
||||
|
||||
# because special names such as Name.Class, Name.Function, etc.
|
||||
# are not recognized as such later in the parsing, we choose them
|
||||
# to look the same as ordinary variables.
|
||||
Name: "#000000", # class: 'n'
|
||||
Name.Attribute: "#c4a000", # class: 'na' - to be revised
|
||||
Name.Builtin: "#000000", # class: 'nb'
|
||||
Name.Builtin.Pseudo: "#aa1105", # class: 'bp'
|
||||
Name.Class: "#db6500", # class: 'nc' - to be revised
|
||||
Name.Constant: "#000000", # class: 'no' - to be revised
|
||||
Name.Decorator: "#888", # class: 'nd' - to be revised
|
||||
Name.Entity: "#ce5c00", # class: 'ni'
|
||||
Name.Exception: "bold #cc0000", # class: 'ne'
|
||||
Name.Function: "#db6500", # class: 'nf'
|
||||
Name.Property: "#000000", # class: 'py'
|
||||
Name.Label: "#f57900", # class: 'nl'
|
||||
Name.Namespace: "#000000", # class: 'nn' - to be revised
|
||||
Name.Other: "#000000", # class: 'nx'
|
||||
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
|
||||
Name.Variable: "#000000", # class: 'nv' - to be revised
|
||||
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
|
||||
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
|
||||
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
|
||||
|
||||
Number: "#990000", # class: 'm'
|
||||
|
||||
Literal: "#000000", # class: 'l'
|
||||
Literal.Date: "#000000", # class: 'ld'
|
||||
|
||||
String: "#74171b", # class: 's'
|
||||
String.Backtick: "#4e9a06", # class: 'sb'
|
||||
String.Char: "#4e9a06", # class: 'sc'
|
||||
String.Doc: "italic #640000", # class: 'sd' - like a comment
|
||||
String.Double: "#74171b", # class: 's2'
|
||||
String.Escape: "#74171b", # class: 'se'
|
||||
String.Heredoc: "#74171b", # class: 'sh'
|
||||
String.Interpol: "#74171b", # class: 'si'
|
||||
String.Other: "#74171b", # class: 'sx'
|
||||
String.Regex: "#74171b", # class: 'sr'
|
||||
String.Single: "#74171b", # class: 's1'
|
||||
String.Symbol: "#74171b", # class: 'ss'
|
||||
|
||||
Generic: "#000000", # class: 'g'
|
||||
Generic.Deleted: "#a40000", # class: 'gd'
|
||||
Generic.Emph: "italic #000000", # class: 'ge'
|
||||
Generic.Error: "#ef2929", # class: 'gr'
|
||||
Generic.Heading: "bold #000080", # class: 'gh'
|
||||
Generic.Inserted: "#00A000", # class: 'gi'
|
||||
Generic.Output: "#888", # class: 'go'
|
||||
Generic.Prompt: "#745334", # class: 'gp'
|
||||
Generic.Strong: "bold #000000", # class: 'gs'
|
||||
Generic.Subheading: "bold #800080", # class: 'gu'
|
||||
Generic.Traceback: "bold #a40000", # class: 'gt'
|
||||
}
|
|
@ -52,7 +52,7 @@ if __name__ == '__main__':
|
|||
|
||||
errors = 0
|
||||
pep8.process_options([''])
|
||||
exclude_dirs = ['/lib', '/coverage', '/pep8']
|
||||
exclude_dirs = ['/lib', '/coverage', '/pep8', '/doc']
|
||||
exclude_files = ['kivy/gesture.py', 'osx/build.py', 'win32/build.py']
|
||||
for target in targets:
|
||||
if os.path.isdir(target):
|
||||
|
|
Loading…
Reference in New Issue