| | |
| | | |
| | | import sys, os |
| | | |
| | | # skip raw nodes |
| | | from sphinx.writers.text import TextTranslator |
| | | from docutils import nodes |
| | | def raw(*arg): |
| | | raise nodes.SkipNode |
| | | TextTranslator.visit_raw = raw |
| | | |
| | | book = os.environ.get('BOOK') |
| | | |
| | | # If your extensions are in another directory, add it here. If the directory |
| | |
| | | # other places throughout the built documents. |
| | | # |
| | | # The short X.Y version. |
| | | version = '1.2a9' |
| | | version = '1.3a4' |
| | | # The full version, including alpha/beta/rc tags. |
| | | release = version |
| | | |
| | |
| | | |
| | | \pagestyle{fancy} |
| | | |
| | | % header and footer styles |
| | | \renewcommand{\chaptermark}[1]% |
| | | {\markboth{\MakeUppercase{\thechapter.\ #1}}{}} |
| | | {\markboth{\MakeUppercase{\thechapter.\ #1}}{} |
| | | } |
| | | \renewcommand{\sectionmark}[1]% |
| | | {\markright{\MakeUppercase{\thesection.\ #1}}} |
| | | \renewcommand{\headrulewidth}{0.5pt} |
| | | {\markright{\MakeUppercase{\thesection.\ #1}} |
| | | } |
| | | |
| | | % defaults for fancy style |
| | | \renewcommand{\headrulewidth}{0pt} |
| | | \renewcommand{\footrulewidth}{0pt} |
| | | \fancyhf{} |
| | | \fancyfoot[C]{\thepage} |
| | | \fancyhead[LO]{\rightmark} |
| | | \fancyhead[RE]{\leftmark} |
| | | |
| | | % plain style |
| | | \fancypagestyle{plain}{ |
| | | \fancyhf{} % empty header and footer |
| | | \renewcommand{\headrulewidth}{0pt} % ho header line |
| | | \renewcommand{\footrulewidth}{0pt}% not footer line |
| | | \fancyfoot[C]{\thepage}% like fancy style |
| | | \renewcommand{\footrulewidth}{0pt}% no footer line |
| | | \fancyhf{} % empty header and footer |
| | | \fancyfoot[C]{\thepage} |
| | | } |
| | | |
| | | % title page styles |
| | | \makeatletter |
| | | \def\@subtitle{\relax} |
| | | \newcommand{\subtitle}[1]{\gdef\@subtitle{#1}} |
| | | \renewcommand{\maketitle}{ |
| | | \begin{titlepage} |
| | | {\rm\Huge\@title\par} |
| | | {\em\large\py@release\releaseinfo\par} |
| | | \if\@subtitle\relax\else\large\@subtitle\par\fi |
| | | {\large\@author\par} |
| | | \end{titlepage} |
| | | } |
| | | \makeatother |
| | | |
| | | % Redefine link and title colors |
| | | \definecolor{TitleColor}{rgb}{0,0,0} |
| | | \definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486} |
| | | \definecolor{OuterLinkColor}{rgb}{0.216,0.439,0.388} |
| | | % Redefine these colors to something not white if you want to have colored |
| | | % background and border for code examples. |
| | | \definecolor{VerbatimColor}{rgb}{1,1,1} |
| | | \definecolor{VerbatimBorderColor}{rgb}{1,1,1} |
| | | |
| | | \makeatletter |
| | | \renewcommand{\py@noticestart@warning}{\py@heavybox} |
| | | \renewcommand{\py@noticeend@warning}{\py@endheavybox} |
| | | \renewcommand{\py@noticestart@note}{\py@heavybox} |
| | | \renewcommand{\py@noticeend@note}{\py@endheavybox} |
| | | \makeatother |
| | | |
| | | % icons in note and warning boxes |
| | | \usepackage{ifthen} |
| | | % Keep a copy of the original notice environment |
| | | \let\origbeginnotice\notice |
| | | \let\origendnotice\endnotice |
| | | |
| | | % Redefine the notice environment so we can add our own code to it |
| | | \renewenvironment{notice}[2]{% |
| | | \origbeginnotice{#1}{}% equivalent to original \begin{notice}{#1}{#2} |
| | | % load graphics |
| | | \ifthenelse{\equal{#1}{warning}}{\includegraphics{exclaim.png}}{} |
| | | \ifthenelse{\equal{#1}{note}}{\includegraphics{info.png}}{} |
| | | % etc. |
| | | }{% |
| | | \origendnotice% equivalent to original \end{notice} |
| | | } |
| | | |
| | | % try to prevent code-block boxes from splitting across pages |
| | | \sloppy |
| | | \widowpenalty=300 |
| | | \clubpenalty=300 |
| | | \setlength{\parskip}{3ex plus 2ex minus 2ex} |
| | | |
| | | % suppress page numbers on pages showing part title |
| | | \makeatletter |
| | | \let\sv@endpart\@endpart |
| | | \def\@endpart{\thispagestyle{empty}\sv@endpart} |
| | | \makeatother |
| | | |
| | | % prevent page numbers in TOC (reset to fancy by frontmatter directive) |
| | | \pagestyle{empty} |
| | | """ |
| | | |
| | | latex_elements = { |
| | | 'preamble': _PREAMBLE, |
| | | 'wrapperclass':'book', |
| | | 'date':'', |
| | | 'releasename':'Version', |
| | | 'title':r'The repoze.bfg Web Application \newline Framework', |
| | | # 'pointsize':'12pt', # uncomment for 12pt version |
| | | } |
| | | |
| | | from docutils import nodes |
| | | |
| | | # secnumdepth counter reset to 2 causes numbering in related matter; |
| | | # reset to -1 causes chapters to not be numbered, reset to -2 causes |
| | | # parts to not be numbered. |
| | | |
| | | #part -1 |
| | | #chapter 0 |
| | | #section 1 |
| | | #subsection 2 |
| | | #subsubsection 3 |
| | | #paragraph 4 |
| | | #subparagraph 5 |
| | | |
| | | def frontmatter(name, arguments, options, content, lineno, |
| | | content_offset, block_text, state, state_machine): |
| | | return [nodes.raw('', '\\frontmatter\n', format='latex')] |
| | | return [nodes.raw( |
| | | '', |
| | | r""" |
| | | \frontmatter |
| | | % prevent part/chapter/section numbering |
| | | \setcounter{secnumdepth}{-2} |
| | | % suppress headers |
| | | \pagestyle{plain} |
| | | % reset page counter |
| | | \setcounter{page}{1} |
| | | % suppress first toc pagenum |
| | | \addtocontents{toc}{\protect\thispagestyle{empty}} |
| | | """, |
| | | format='latex')] |
| | | |
| | | def mainmatter(name, arguments, options, content, lineno, |
| | | content_offset, block_text, state, state_machine): |
| | | return [nodes.raw('', '\\mainmatter\n', format='latex')] |
| | | return [nodes.raw( |
| | | '', |
| | | r""" |
| | | \mainmatter |
| | | % allow part/chapter/section numbering |
| | | \setcounter{secnumdepth}{2} |
| | | % get headers back |
| | | \pagestyle{fancy} |
| | | \fancyhf{} |
| | | \renewcommand{\headrulewidth}{0.5pt} |
| | | \renewcommand{\footrulewidth}{0pt} |
| | | \fancyfoot[C]{\thepage} |
| | | \fancyhead[RO]{\rightmark} |
| | | \fancyhead[LE]{\leftmark} |
| | | """, |
| | | format='latex')] |
| | | |
| | | def backmatter(name, arguments, options, content, lineno, |
| | | content_offset, block_text, state, state_machine): |
| | | return [nodes.raw('', '\\backmatter\n', format='latex')] |
| | | return [nodes.raw('', '\\backmatter\n\\setcounter{secnumdepth}{-1}\n', |
| | | format='latex')] |
| | | |
| | | def setup(app): |
| | | app.add_directive('frontmatter', frontmatter, 1, (0, 0, 0)) |
| | |
| | | ## self.linenos = False |
| | | |
| | | ## PygmentsBridge.latex_formatter = NoLinenosLatexFormatter |
| | | |
| | | # -- Options for Epub output --------------------------------------------------- |
| | | |
| | | # Bibliographic Dublin Core info. |
| | | epub_title = 'The repoze.bfg Web Application Framework, Version 1.3' |
| | | epub_author = 'Chris McDonough' |
| | | epub_publisher = 'Agendaless Consulting' |
| | | epub_copyright = '2008-2010' |
| | | |
| | | # The language of the text. It defaults to the language option |
| | | # or en if the language is not set. |
| | | epub_language = 'en' |
| | | |
| | | # The scheme of the identifier. Typical schemes are ISBN or URL. |
| | | epub_scheme = 'ISBN' |
| | | |
| | | # The unique identifier of the text. This can be a ISBN number |
| | | # or the project homepage. |
| | | epub_identifier = '0615345379' |
| | | |
| | | # A unique identification for the text. |
| | | epub_uid = 'The repoze.bfg Web Application Framework, Version 1.3-v0' |
| | | |
| | | # HTML files that should be inserted before the pages created by sphinx. |
| | | # The format is a list of tuples containing the path and title. |
| | | #epub_pre_files = [] |
| | | |
| | | # HTML files shat should be inserted after the pages created by sphinx. |
| | | # The format is a list of tuples containing the path and title. |
| | | #epub_post_files = [] |
| | | |
| | | # A list of files that should not be packed into the epub file. |
| | | #epub_exclude_files = [] |
| | | |
| | | # The depth of the table of contents in toc.ncx. |
| | | epub_tocdepth = 3 |