diff --git a/Makefile b/Makefile index 5077af9a..668633aa 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,13 @@ BUILD_DIR = build build-revisions: clean-build prep-dirs bowerize compile-less compile-js cp-static api overview pkg-old-revisions -all: rev1 +all: rev1 + +pdf: + REV=rev1 REV_NUM=1.1 make latex + +latex: + REV=rev1 REV_NUM=1.1 BALANCED_REV=rev1 $(SPHINXBUILD) -b pdf -c api/rev1 api/rev1 api/rev1/latex cache-clean: -rm -f *.cache diff --git a/api/rev1/conf.py b/api/rev1/conf.py index 4df208de..92fa7afc 100644 --- a/api/rev1/conf.py +++ b/api/rev1/conf.py @@ -28,7 +28,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.todo'] +extensions = ['sphinx.ext.todo', 'rst2pdf.pdfbuilder'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -194,13 +194,42 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'Balanced.tex', u'Balanced Documentation', + ('api', 'Balanced.tex', u'Balanced Documentation', u'Balanced', 'manual'), ] +pdf_documents = [ + ('api', 'Balanced.tex', u'Balanced Documentation', + u'Balanced', 'manual'), +] + +# A comma-separated list of custom stylesheets. Example: +pdf_stylesheets = ['test', 'monokai'] + + +# A list of folders to search for stylesheets. Example: +pdf_style_path = ['.', 'assets'] + +# Mode for literal blocks wider than the frame. Can be +# overflow, shrink or truncate +pdf_fit_mode = "shrink" + +# Section level that forces a break page. +# For example: 1 means top-level sections start in a new page +# 0 means disabled +pdf_break_level = 1 + +# If false, no coverpage is generated. +#pdf_use_coverpage = True + + +# Name of the cover page template to use +#pdf_cover_template = 'sphinxcover.tmpl' + + # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +latex_logo = '../../assets/img/logo.png' # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. @@ -270,7 +299,7 @@ def setup(app): dcode.DCodeDefaultDirective.registry['scenario'].update({ 'script': "scripts/lang-scenario.py -d clients/{0}/curl -c scenario.cache".format(os.environ.get('BALANCED_REV', 'rev1')), 'section-chars': '~^', - 'lang': ['ruby', 'python', 'node', 'java', 'php'] + #'lang': ['ruby', 'python', 'node', 'java', 'php'] }) dcode.DCodeDefaultDirective.registry['endpoint'].update({ 'script': 'scripts/rst.py endpoint' diff --git a/assets/img/logo.png b/assets/img/logo.png new file mode 100644 index 00000000..6808b5d0 Binary files /dev/null and b/assets/img/logo.png differ diff --git a/assets/monokai.style b/assets/monokai.style new file mode 100644 index 00000000..11f665c5 --- /dev/null +++ b/assets/monokai.style @@ -0,0 +1,86 @@ +styles: + pygments-bp: {parent: code, textColor: #f8f8f2} + pygments-c: {parent: code, textColor: #75715e} + pygments-c1: {parent: code, textColor: #75715e} + pygments-cm: {parent: code, textColor: #75715e} + pygments-cp: {parent: code, textColor: #75715e} + pygments-cs: {parent: code, textColor: #75715e} + pygments-err: + backColor: #1e0010 + parent: code + textColor: #960050 + + pygments-g: {parent: code, textColor: black} + pygments-gd: {parent: code, textColor: black} + pygments-ge: + fontName: stdMonoItalic + parent: code + textColor: black + + pygments-gh: {parent: code, textColor: black} + pygments-gi: {parent: code, textColor: black} + pygments-go: {parent: code, textColor: black} + pygments-gp: {parent: code, textColor: black} + pygments-gr: {parent: code, textColor: black} + pygments-gs: + fontName: stdMonoBold + parent: code + textColor: black + + pygments-gt: {parent: code, textColor: black} + pygments-gu: {parent: code, textColor: black} + pygments-hll: + backColor: #49483e + parent: code + textColor: black + + pygments-il: {parent: code, textColor: #ae81ff} + pygments-k: {parent: code, textColor: #66d9ef} + pygments-kc: {parent: code, textColor: #66d9ef} + pygments-kd: {parent: code, textColor: #66d9ef} + pygments-kn: {parent: code, textColor: #f92672} + pygments-kp: {parent: code, textColor: #66d9ef} + pygments-kr: {parent: code, textColor: #66d9ef} + pygments-kt: {parent: code, textColor: #66d9ef} + pygments-l: {parent: code, textColor: #ae81ff} + pygments-ld: {parent: code, textColor: #e6db74} + pygments-m: {parent: code, textColor: #ae81ff} + pygments-mf: {parent: code, textColor: #ae81ff} + pygments-mh: {parent: code, textColor: #ae81ff} + pygments-mi: {parent: code, textColor: #ae81ff} + pygments-mo: {parent: code, textColor: #ae81ff} + pygments-n: {parent: code, textColor: #f8f8f2} + pygments-na: {parent: code, textColor: #a6e22e} + pygments-nb: {parent: code, textColor: #f8f8f2} + pygments-nc: {parent: code, textColor: #a6e22e} + pygments-nd: {parent: code, textColor: #a6e22e} + pygments-ne: {parent: code, textColor: #a6e22e} + pygments-nf: {parent: code, textColor: #a6e22e} + pygments-ni: {parent: code, textColor: #f8f8f2} + pygments-nl: {parent: code, textColor: #f8f8f2} + pygments-nn: {parent: code, textColor: #f8f8f2} + pygments-no: {parent: code, textColor: #66d9ef} + pygments-nt: {parent: code, textColor: #f92672} + pygments-nv: {parent: code, textColor: #f8f8f2} + pygments-nx: {parent: code, textColor: #a6e22e} + pygments-o: {parent: code, textColor: #f92672} + pygments-ow: {parent: code, textColor: #f92672} + pygments-p: {parent: code, textColor: #f8f8f2} + pygments-py: {parent: code, textColor: #f8f8f2} + pygments-s: {parent: code, textColor: #e6db74} + pygments-s1: {parent: code, textColor: #e6db74} + pygments-s2: {parent: code, textColor: #e6db74} + pygments-sb: {parent: code, textColor: #e6db74} + pygments-sc: {parent: code, textColor: #e6db74} + pygments-sd: {parent: code, textColor: #e6db74} + pygments-se: {parent: code, textColor: #ae81ff} + pygments-sh: {parent: code, textColor: #e6db74} + pygments-si: {parent: code, textColor: #e6db74} + pygments-sr: {parent: code, textColor: #e6db74} + pygments-ss: {parent: code, textColor: #e6db74} + pygments-sx: {parent: code, textColor: #e6db74} + pygments-vc: {parent: code, textColor: #f8f8f2} + pygments-vg: {parent: code, textColor: #f8f8f2} + pygments-vi: {parent: code, textColor: #f8f8f2} + pygments-w: {parent: code, textColor: #f8f8f2} + pygments-x: {parent: code, textColor: black} \ No newline at end of file diff --git a/assets/test.style b/assets/test.style new file mode 100644 index 00000000..ef93770b --- /dev/null +++ b/assets/test.style @@ -0,0 +1,586 @@ +# List any fonts you would like to embed in the PDF here + embeddedFonts: [] + + # Default page setup. Can be overridden by including other + # stylesheets with -s + + pageSetup: + size: A4 + width: null + height: null + margin-top: 2cm + margin-bottom: 2cm + margin-left: 2cm + margin-right: 2cm + margin-gutter: 0cm + spacing-header: 5mm + spacing-footer: 5mm + + # The first template is one of the 'pageTemplates" + # (See next section) + + firstTemplate: oneColumn + + # pageTemplates can be accessed with the .. raw:: pdf PageBreak command + + pageTemplates: + coverPage: + frames: [] + [0cm, 0cm, 100%, 100%] + showHeader : false + showFooter : false + + emptyPage: + frames: [] + [0cm, 0cm, 100%, 100%] + showHeader : false + showFooter : false + + oneColumn: + frames: [] + [0cm, 0cm, 100%, 100%] + showHeader : true + showFooter : true + + twoColumn: + frames: [] + [0cm, 0cm, 49%, 100%] + [51%, 0cm, 49%, 100%] + showHeader : true + showFooter : true + + threeColumn: + frames: [] + [2%, 0cm, 29.333%, 100%] + [35.333%, 0cm, 29.333%, 100%] + [68.666%, 0cm, 29.333%, 100%] + showHeader : true + showFooter : true + + cutePage: + frames: [] + [0%, 0%, 100%, 100%] + showHeader : true + showFooter : true + defaultFooter : ###Page### + defaultHeader : ###Section### + + fontsAlias: + stdFont: Helvetica + stdBold: Helvetica-Bold + stdItalic: Helvetica-Oblique + stdBoldItalic: Helvetica-BoldOblique + stdSans: Helvetica + stdSansBold: Helvetica-Bold + stdSansItalic: Helvetica-Oblique + stdSansBoldItalic: Helvetica-BoldOblique + stdMono: Courier + stdMonoItalic: Courier-Oblique + stdMonoBold: Courier-Bold + stdMonoBoldItalic: Courier-BoldOblique + stdSerif: Times-Roman + + linkColor: navy + + styles: + base: + parent: null + fontName: stdFont + fontSize: 10 + leading: 12 + leftIndent: 0 + rightIndent: 0 + firstLineIndent: 0 + alignment: TA_LEFT + spaceBefore: 0 + spaceAfter: 0 + bulletFontName: stdFont + bulletFontSize: 10 + bulletIndent: 0 + textColor: black + backColor: null + wordWrap: null + borderWidth: 0 + borderPadding: 0 + borderColor: null + borderRadius: null + allowWidows: false + allowOrphans: false + hyphenation: false + kerning: false + underline: false + strike: false + commands: [] + + normal: + parent: base + + title-reference: + parent: normal + fontName: stdItalic + + bodytext: + parent: normal + spaceBefore: 6 + alignment: TA_JUSTIFY + hyphenation: true + + toc: + parent: normal + + blockquote: + parent: bodytext + leftIndent: 20 + + lineblock: + parent: bodytext + + line: + parent: lineblock + spaceBefore: 0 + + toc1: + parent: toc + fontName: stdBold + + toc2: + parent: toc + leftIndent: 20 + + toc3: + parent: toc + leftIndent: 40 + + toc4: + parent: toc + leftIndent: 60 + + toc5: + parent: toc + leftIndent: 80 + + toc6: + parent: toc + leftIndent: 100 + + toc7: + parent: toc + leftIndent: 100 + + toc8: + parent: toc + leftIndent: 100 + + toc9: + parent: toc + leftIndent: 100 + + toc10: + parent: toc + leftIndent: 100 + + toc11: + parent: toc + leftIndent: 100 + + toc12: + parent: toc + leftIndent: 100 + + toc13: + parent: toc + leftIndent: 100 + + toc14: + parent: toc + leftIndent: 100 + + toc15: + parent: toc + leftIndent: 100 + + footer: + parent: normal + alignment: TA_CENTER + + header: + parent: normal + alignment: TA_CENTER + + attribution: + parent: bodytext + alignment: TA_RIGHT + + image: + parent: bodytext + alignment: TA_CENTER + + figure: + parent: bodytext + alignment: TA_CENTER + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [ALIGN, [ 0, 0 ], [ -1, -1 ], CENTER ] + colWidths: [100%] + + figure-caption: + parent: bodytext + fontName: stdItalic + alignment: TA_CENTER + + figure-legend: + parent: bodytext + + bullet-list: + parent: bodytext + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [RIGHTPADDING, [ 0, 0 ], [ 1, -1 ], 0 ] + colWidths: ["20", null] + + bullet-list-item: + parent: bodytext + + item-list: + parent: bodytext + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [RIGHTPADDING, [ 0, 0 ], [ 1, -1 ], 0 ] + colWidths: [20pt,null] + + item-list-item: + parent: bodytext + + definition-list-term: + parent: normal + fontName: stdBold + spaceBefore: 4 + spaceAfter: 0 + keepWithNext: false + + definition-list-classifier: + parent: normal + fontName: stdItalic + + definition: + parent: bodytext + firstLineIndent: 0 + bulletIndent: 0 + spaceBefore: 0 + colWidths: [20pt,null] + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [LEFTPADDING, [ 0, 0 ], [ -1, -1 ], 0 ] + [BOTTOMPADDING, [ 0, 0 ], [ -1, -1 ], 0 ] + [RIGHTPADDING, [ 0, 0 ], [ -1, -1 ], 0 ] + + fieldname: + parent: bodytext + alignment: TA_RIGHT + fontName: stdBold + + fieldvalue: + parent: bodytext + + rubric: + parent: bodytext + textColor: darkred + alignment: TA_CENTER + + italic: + parent: bodytext + fontName: stdItalic + + heading: + parent: normal + keepWithNext: true + spaceBefore: 12 + spaceAfter: 6 + + title: + parent: heading + fontName: stdBold + fontSize: 200% + alignment: TA_CENTER + keepWithNext: false + spaceAfter: 10 + + subtitle: + parent: title + spaceBefore: 12 + fontSize: 75% + + heading1: + parent: heading + fontName: stdBold + fontSize: 175% + + heading2: + parent: heading + fontName: stdBold + fontSize: 150% + + heading3: + parent: heading + fontName: stdBoldItalic + fontSize: 125% + + heading4: + parent: heading + fontName: stdBoldItalic + + heading5: + parent: heading + fontName: stdBoldItalic + + heading6: + parent: heading + fontName: stdBoldItalic + + topic-title: + parent: heading3 + + sidebar-title: + parent: heading3 + + sidebar-subtitle: + parent: heading4 + + sidebar: + float: none + width: 100% + parent: normal + backColor: beige + borderColor: darkgray + borderPadding: 8 + borderWidth: 0.5 + + admonition: + parent: normal + spaceBefore: 12 + spaceAfter: 6 + borderPadding: [16,16,16,16] + backColor: beige + borderColor: darkgray + borderWidth: 0.5 + commands:[] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + + attention: + parent: admonition + + caution: + parent: admonition + + danger: + parent: admonition + + error: + parent: admonition + + hint: + parent: admonition + + important: + parent: admonition + + note: + parent: admonition + + tip: + parent: admonition + + warning: + parent: admonition + + admonition-title: + parent: heading3 + + admonition-heading: + parent: heading3 + + attention-heading: + parent: admonition-heading + + caution-heading: + parent: admonition-heading + + danger-heading: + parent: admonition-heading + + error-heading: + parent: admonition-heading + + hint-heading: + parent: admonition-heading + + important-heading: + parent: admonition-heading + + note-heading: + parent: admonition-heading + + tip-heading: + parent: admonition-heading + + warning-heading: + parent: admonition-heading + + literal: + parent: normal + fontName: stdMono + firstLineIndent: 0 + hyphenation: false + wordWrap: null + + aafigure: + parent: literal + + table: + spaceBefore:6 + spaceAfter:0 + alignment: TA_CENTER + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [INNERGRID, [ 0, 0 ], [ -1, -1 ], 0.25, black ] + [ROWBACKGROUNDS, [0, 0], [-1, -1], [white,#E0E0E0]] + [BOX, [ 0, 0 ], [ -1, -1 ], 0.25, black ] + + table-title: + parent : heading4 + keepWithNext: false + alignment : TA_CENTER + + table-heading: + parent : heading + backColor : beige + alignment : TA_CENTER + valign : BOTTOM + borderPadding : 0 + + table-body: + parent : normal + + dedication: + parent : normal + + abstract: + parent : normal + + contents: + parent : normal + + tableofcontents: + parent : normal + + code: + parent: literal + leftIndent: 0 + spaceBefore: 8 + spaceAfter: 8 + backColor: #f0f1f2 + borderColor: darkgray + borderWidth: 0.2 + borderPadding: 6 + + linenumber: + parent: code + + right: + parent: bodytext + alignment: right + + center: + parent: bodytext + alignment: center + + pygments-n: parent: code + pygments-nx: parent: code + pygments-p: parent: code + pygments-hll: {parent: code, backColor: #ffffcc} + pygments-c: {textColor: #008800, parent: code} + pygments-err: {parent: code} + pygments-k: {textColor: #AA22FF, parent: code} + pygments-o: {textColor: #666666, parent: code} + pygments-cm: {textColor: #008800, parent: code} + pygments-cp: {textColor: #008800, parent: code} + pygments-c1: {textColor: #008800, parent: code} + pygments-cs: {textColor: #008800, parent: code} + pygments-gd: {textColor: #A00000, parent: code} + pygments-ge: {parent: code} + pygments-gr: {textColor: #FF0000, parent: code} + pygments-gh: {textColor: #000080, parent: code} + pygments-gi: {textColor: #00A000, parent: code} + pygments-go: {textColor: #808080, parent: code} + pygments-gp: {textColor: #000080, parent: code} + pygments-gs: {parent: code} + pygments-gu: {textColor: #800080, parent: code} + pygments-gt: {textColor: #0040D0, parent: code} + pygments-kc: {textColor: #AA22FF, parent: code} + pygments-kd: {textColor: #AA22FF, parent: code} + pygments-kn: {textColor: #AA22FF, parent: code} + pygments-kp: {textColor: #AA22FF, parent: code} + pygments-kr: {textColor: #AA22FF, parent: code} + pygments-kt: {textColor: #00BB00, parent: code} + pygments-m: {textColor: #666666, parent: code} + pygments-s: {textColor: #BB4444, parent: code} + pygments-na: {textColor: #BB4444, parent: code} + pygments-nb: {textColor: #AA22FF, parent: code} + pygments-nc: {textColor: #0000FF, parent: code} + pygments-no: {textColor: #880000, parent: code} + pygments-nd: {textColor: #AA22FF, parent: code} + pygments-ni: {textColor: #999999, parent: code} + pygments-ne: {textColor: #D2413A, parent: code} + pygments-nf: {textColor: #00A000, parent: code} + pygments-nl: {textColor: #A0A000, parent: code} + pygments-nn: {textColor: #0000FF, parent: code} + pygments-nt: {textColor: #008000, parent: code} + pygments-nv: {textColor: #B8860B, parent: code} + pygments-ow: {textColor: #AA22FF, parent: code} + pygments-w: {textColor: #bbbbbb, parent: code} + pygments-mf: {textColor: #666666, parent: code} + pygments-mh: {textColor: #666666, parent: code} + pygments-mi: {textColor: #666666, parent: code} + pygments-mo: {textColor: #666666, parent: code} + pygments-sb: {textColor: #BB4444, parent: code} + pygments-sc: {textColor: #BB4444, parent: code} + pygments-sd: {textColor: #BB4444, parent: code} + pygments-s2: {textColor: #BB4444, parent: code} + pygments-se: {textColor: #BB6622, parent: code} + pygments-sh: {textColor: #BB4444, parent: code} + pygments-si: {textColor: #BB6688, parent: code} + pygments-sx: {textColor: #008000, parent: code} + pygments-sr: {textColor: #BB6688, parent: code} + pygments-s1: {textColor: #BB4444, parent: code} + pygments-ss: {textColor: #B8860B, parent: code} + pygments-bp: {textColor: #AA22FF, parent: code} + pygments-vc: {textColor: #B8860B, parent: code} + pygments-vg: {textColor: #B8860B, parent: code} + pygments-vi: {textColor: #B8860B, parent: code} + pygments-il: {textColor: #666666, parent: code} + + endnote: + parent: bodytext + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [TOPPADDING, [ 0, 0 ], [ -1, -1 ], 0 ] + [BOTTOMPADDING, [ 0, 0 ], [ -1, -1 ], 0 ] + [RIGHTPADDING, [ 0, 0 ], [ 1, -1 ], 0 ] + colWidths: [3cm, null] + + field-list: + parent: bodytext + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [TOPPADDING, [ 0, 0 ], [ -1, -1 ], 0 ] + colWidths: [3cm, null] + spaceBefore: 6 + + option-list: + commands: [] + [VALIGN, [ 0, 0 ], [ -1, -1 ], TOP ] + [TOPPADDING, [ 0, 0 ], [ -1, -1 ], 0 ] + colWidths: [null,null] + + Verbatim: + backColor: red \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 72633b08..b2ccfb82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,5 @@ Sphinx==1.1.3 sphinxcontrib-httpdomain==1.1.7 werkzeug>=0.8.3 wsgiref==0.1.2 + +rst2pdf \ No newline at end of file