Replace documentation with Sphinx-based documentation.

This commit is contained in:
Frank Smit 2015-07-12 23:42:28 +02:00
parent dbfc1fe077
commit f99e20c23d
20 changed files with 1007 additions and 1433 deletions

View File

@ -1,2 +1,192 @@
all:
elyse ./ _build/
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Misaka.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Misaka.qhc"
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Misaka"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Misaka"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

28
docs/_static/customizations.css vendored Normal file
View File

@ -0,0 +1,28 @@
body {
font-family: 'Liberation Sans', 'Nimbus Sans L', FreeSans,
'Helvetica Neue', Helvetica, Arial, sans-serif;
}
div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
font-family: 'PT Serif', 'Droid Serif', 'DejaVu Serif', serif;
}
ul, div.sphinxsidebar ul ul, div.sphinxsidebar ul.want-points {
list-style-type: none;
margin-left: 1em;
}
ul li:before {
content: '-';
position: relative;
left: -5px;
}
ul li {
text-indent: -5px;
}
pre {
padding: 7px 10px;
}
pre, code {
font-family: 'M+ 1m', 'Droid Sans Mono', 'DejaVu Sans Mono', monospace;
}

2
docs/_templates/layout.html vendored Normal file
View File

@ -0,0 +1,2 @@
{% extends "!layout.html" %}
{% set css_files = css_files + ['_static/customizations.css'] %}

View File

@ -1,136 +0,0 @@
/*---------------------------------------------------
LESS Elements 0.6
---------------------------------------------------
A set of useful LESS mixins by Dmitry Fadeyev
Special thanks for mixin suggestions to:
Kris Van Herzeele,
Benoit Adam,
Portenart Emile-Victor,
Ryan Faerman
More info at: http://lesselements.com
-----------------------------------------------------*/
.gradient(@color: #F5F5F5, @start: #EEE, @stop: #FFF) {
background: @color;
background: -webkit-gradient(linear,
left bottom,
left top,
color-stop(0, @start),
color-stop(1, @stop));
background: -ms-linear-gradient(bottom,
@start,
@stop);
background: -moz-linear-gradient(center bottom,
@start 0%,
@stop 100%);
}
.bw-gradient(@color: #F5F5F5, @start: 0, @stop: 255) {
background: @color;
background: -webkit-gradient(linear,
left bottom,
left top,
color-stop(0, rgb(@start,@start,@start)),
color-stop(1, rgb(@stop,@stop,@stop)));
background: -ms-linear-gradient(bottom,
rgb(@start,@start,@start) 0%,
rgb(@start,@start,@start) 100%);
background: -moz-linear-gradient(center bottom,
rgb(@start,@start,@start) 0%,
rgb(@stop,@stop,@stop) 100%);
}
.bordered(@top-color: #EEE, @right-color: #EEE, @bottom-color: #EEE, @left-color: #EEE) {
border-top: solid 1px @top-color;
border-left: solid 1px @left-color;
border-right: solid 1px @right-color;
border-bottom: solid 1px @bottom-color;
}
.drop-shadow(@x-axis: 0, @y-axis: 1px, @blur: 2px, @alpha: 0.1) {
-webkit-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
-moz-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
}
.rounded(@radius: 2px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
}
.border-radius(@topright: 0, @bottomright: 0, @bottomleft: 0, @topleft: 0) {
-webkit-border-top-right-radius: @topright;
-webkit-border-bottom-right-radius: @bottomright;
-webkit-border-bottom-left-radius: @bottomleft;
-webkit-border-top-left-radius: @topleft;
-moz-border-radius-topright: @topright;
-moz-border-radius-bottomright: @bottomright;
-moz-border-radius-bottomleft: @bottomleft;
-moz-border-radius-topleft: @topleft;
border-top-right-radius: @topright;
border-bottom-right-radius: @bottomright;
border-bottom-left-radius: @bottomleft;
border-top-left-radius: @topleft;
-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
}
.opacity(@opacity: 0.5) {
-moz-opacity: @opacity;
-khtml-opacity: @opacity;
-webkit-opacity: @opacity;
opacity: @opacity;
}
.transition-duration(@duration: 0.2s) {
-moz-transition-duration: @duration;
-webkit-transition-duration: @duration;
transition-duration: @duration;
}
.rotation(@deg:5deg){
-webkit-transform: rotate(@deg);
-moz-transform: rotate(@deg);
transform: rotate(@deg);
}
.scale(@ratio:1.5){
-webkit-transform:scale(@ratio);
-moz-transform:scale(@ratio);
transform:scale(@ratio);
}
.transition(@duration:0.2s, @ease:ease-out) {
-webkit-transition: all @duration @ease;
-moz-transition: all @duration @ease;
transition: all @duration @ease;
}
.inner-shadow(@horizontal:0, @vertical:1px, @blur:2px, @alpha: 0.4) {
-webkit-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
-moz-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
}
.box-shadow(@arguments) {
-webkit-box-shadow: @arguments;
-moz-box-shadow: @arguments;
box-shadow: @arguments;
}
.columns(@colwidth: 250px, @colcount: 0, @colgap: 50px, @columnRuleColor: #EEE, @columnRuleStyle: solid, @columnRuleWidth: 1px) {
-moz-column-width: @colwidth;
-moz-column-count: @colcount;
-moz-column-gap: @colgap;
-moz-column-rule-color: @columnRuleColor;
-moz-column-rule-style: @columnRuleStyle;
-moz-column-rule-width: @columnRuleWidth;
-webkit-column-width: @colwidth;
-webkit-column-count: @colcount;
-webkit-column-gap: @colgap;
-webkit-column-rule-color: @columnRuleColor;
-webkit-column-rule-style: @columnRuleStyle;
-webkit-column-rule-width: @columnRuleWidth;
column-width: @colwidth;
column-count: @colcount;
column-gap: @colgap;
column-rule-color: @columnRuleColor;
column-rule-style: @columnRuleStyle;
column-rule-width: @columnRuleWidth;
}
.translate(@x:0, @y:0) {
-moz-transform: translate(@x, @y);
-webkit-transform: translate(@x, @y);
-o-transform: translate(@x, @y);
-ms-transform: translate(@x, @y);
transform: translate(@x, @y);
}

View File

@ -1,380 +0,0 @@
@import "elements.less";
// @font-sans: 'Droid Sans', 'DejaVu Sans', 'Helvetica Neue', 'Helvetica', Arial, sans-serif;
// @font-serif: 'Droid Serif', Georgia, 'Bitstream Charter', 'Times New Roman', serif;
// @font-mono: 'Droid Sans Mono', monospace;
@font-sans: "Liberation Sans", "Nimbus Sans L", "FreeSans", "Helvetica Neue", Helvetica, Arial, sans-serif;
@font-serif: "Gentium Book Basic", "Cambo", "Bitstream Charter", "URW Palladio L", Palatino, "Palatino Linotype", "Book Antiqua", serif;
@font-mono: 'Envy Code R', 'Droid Sans Mono', 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Inconsolata, Consolas, monospace;
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
::-moz-selection { background: #000;color: #fff;text-shadow: none }
::selection { background: #000;color: #fff;text-shadow: none }
pre ::-webkit-scrollbar {
width: 12px;
}
pre ::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
.rounded(10px);
}
pre ::-webkit-scrollbar-thumb {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
.rounded(10px);
}
html {
-webkit-font-smoothing: subpixel-antialiased;
}
body {
// [style], [variant], [weight], size[/line-height], family
font: 1em/1.5em @font-sans;
padding: 50px;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
nav ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
sup {
font-size: xx-small;
vertical-align: super;
}
a {
margin: 0;
padding: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
&:link, &:visited { color: #556270 }
&:hover, &:active { color: #C44D58 }
}
/* change colours to suit your needs */
ins {
background-color: #ff9;
color: #000;
text-decoration: none;
}
/* change colours to suit your needs */
mark {
background-color: #ff9;
color: #000;
font-style: italic;
font-weight: bold;
}
del {
text-decoration: line-through;
}
abbr[title], dfn[title] {
border-bottom: 1px dotted;
cursor: help;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
th, td {
padding: .5em 1em;
}
th {
text-align: left;
font-weight: bold;
border-bottom: 2px solid #999;
}
td {
border-bottom: 1px solid #ddd;
}
/* change border colour to suit your needs */
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #cccccc;
margin: 1em 0;
padding: 0;
}
input, select {
vertical-align: middle;
}
h1, h2, h3, h4, h5, h6 {
font-family: @font-serif;
}
p {
margin: 1.5em 0;
img {
max-width: 100%;
}
}
ol, ul {
margin: 1.5em 0;
padding-left: 2em;
ol, ul {
margin-top: 0;
margin-bottom: 0;
padding-left: 1.3em;
}
p { margin-top: 0 }
}
ul {
list-style: none;
padding-left: .5em;
ul { padding-left: .3em }
li { padding-left: 1em }
li:before {
content: "\00BB \0020";
margin-left: -.9em;
float: left;
}
}
code {
background-color: #fee9cc;
color: rgba(0,0,0,0.75);
padding: 1px 3px;
font-size: .9em;
.rounded(3px);
}
pre {
margin: 1.5em 0 1.5em;
padding: .5em .7em;
font-size: .9em;
.rounded(4px);
}
pre, code {
font-family: @font-mono;
}
pre code {
display: block;
padding: 0 0 .3em;
overflow-x: auto;
background: transparent;
color: inherit;
font-size: 1em;
}
#navigation {
h1 {
font-size: 2em;
margin: 0 0 1em;
}
a {
// display: block;
padding: .5em;
color: #444;
text-decoration: none;
// .transition(0.1s, linear);
&:hover, &:active {
background: #eee;
color: #333;
}
}
}
#index-section #nav-index,
#changelog-section #nav-changelog,
#manual-section #nav-manual,
#api-section #nav-api,
#development-section #nav-development {
background: #eee;
color: #333;
}
#content {
margin: 4em 0 0;
h1 {
margin: 0 0 .3em;
font-size: 1.8em;
a:link, a:visited {
color: #000;
text-decoration: none;
}
a:hover, a:active {
color: #C44D58;
text-decoration: underline;
}
}
h2 { font-size: 1.5em }
h3 { font-size: 1.2em }
h2, h3, h4, h5, h6 {
margin-top: 2em;
}
&:after{
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
font-size: 0;
}
}
.toc {
float: left;
font-size: .9em;
padding-right: 50px;
ul:first-child {
margin-top: .1em;
margin-bottom: 5em;
}
a {
text-decoration: none;
}
}
.page {
max-width: 600px;
float: left;
}
#bottom {
clear: both;
color: #555;
font-size: .8em;
a { color: #555 }
}
/* --- Pygments: https://github.com/uraimo/pygments-vimstyles/blob/master/wombat.css --- */
.highlight { background: #242424; color: #f6f3e8}
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #99968b; font-style: italic} /* Comment */
.highlight .err { color: #f6f3e8} /* Error */
.highlight .g { color: #f6f3e8} /* Generic */
.highlight .k { color: #8ac6f2} /* Keyword */
.highlight .l { color: #f6f3e8} /* Literal */
.highlight .n { color: #f6f3e8} /* Name */
.highlight .o { color: #f6f3e8} /* Operator */
.highlight .x { color: #f6f3e8} /* Other */
.highlight .p { color: #f6f3e8} /* Punctuation */
.highlight .cm { color: #99968b; font-style: italic} /* Comment.Multiline */
.highlight .cp { color: #e5786d} /* Comment.Preproc */
.highlight .c1 { color: #99968b; font-style: italic} /* Comment.Single */
.highlight .cs { color: #99968b; font-style: italic} /* Comment.Special */
.highlight .gd { color: #f6f3e8} /* Generic.Deleted */
.highlight .ge { color: #f6f3e8} /* Generic.Emph */
.highlight .gr { color: #f6f3e8} /* Generic.Error */
.highlight .gh { color: #f6f3e8; font-weight: bold} /* Generic.Heading */
.highlight .gi { color: #f6f3e8} /* Generic.Inserted */
.highlight .go { color: #808080; background-color: #303030 } /* Generic.Output */
.highlight .gp { color: #f6f3e8} /* Generic.Prompt */
.highlight .gs { color: #f6f3e8} /* Generic.Strong */
.highlight .gu { color: #f6f3e8; font-weight: bold} /* Generic.Subheading */
.highlight .gt { color: #f6f3e8} /* Generic.Traceback */
.highlight .kc { color: #8ac6f2} /* Keyword.Constant */
.highlight .kd { color: #8ac6f2} /* Keyword.Declaration */
.highlight .kn { color: #8ac6f2} /* Keyword.Namespace */
.highlight .kp { color: #8ac6f2} /* Keyword.Pseudo */
.highlight .kr { color: #8ac6f2} /* Keyword.Reserved */
.highlight .kt { color: #cae682} /* Keyword.Type */
.highlight .ld { color: #f6f3e8} /* Literal.Date */
.highlight .m { color: #e5786d} /* Literal.Number */
.highlight .s { color: #95e454; font-style: italic} /* Literal.String */
.highlight .na { color: #cae682} /* Name.Attribute */
.highlight .nb { color: #f6f3e8} /* Name.Builtin */
.highlight .nc { color: #f6f3e8} /* Name.Class */
.highlight .no { color: #e5786d} /* Name.Constant */
.highlight .nd { color: #f6f3e8} /* Name.Decorator */
.highlight .ni { color: #e7f6da} /* Name.Entity */
.highlight .ne { color: #f6f3e8} /* Name.Exception */
.highlight .nf { color: #cae682} /* Name.Function */
.highlight .nl { color: #f6f3e8} /* Name.Label */
.highlight .nn { color: #f6f3e8} /* Name.Namespace */
.highlight .nx { color: #f6f3e8} /* Name.Other */
.highlight .py { color: #f6f3e8} /* Name.Property */
.highlight .nt { color: #8ac6f2} /* Name.Tag */
.highlight .nv { color: #cae682} /* Name.Variable */
.highlight .ow { color: #f6f3e8} /* Operator.Word */
.highlight .w { color: #f6f3e8} /* Text.Whitespace */
.highlight .mf { color: #e5786d} /* Literal.Number.Float */
.highlight .mh { color: #e5786d} /* Literal.Number.Hex */
.highlight .mi { color: #e5786d} /* Literal.Number.Integer */
.highlight .mo { color: #e5786d} /* Literal.Number.Oct */
.highlight .sb { color: #95e454; font-style: italic} /* Literal.String.Backtick */
.highlight .sc { color: #95e454; font-style: italic} /* Literal.String.Char */
.highlight .sd { color: #95e454; font-style: italic} /* Literal.String.Doc */
.highlight .s2 { color: #95e454; font-style: italic} /* Literal.String.Double */
.highlight .se { color: #95e454; font-style: italic} /* Literal.String.Escape */
.highlight .sh { color: #95e454; font-style: italic} /* Literal.String.Heredoc */
.highlight .si { color: #95e454; font-style: italic} /* Literal.String.Interpol */
.highlight .sx { color: #95e454; font-style: italic} /* Literal.String.Other */
.highlight .sr { color: #95e454; font-style: italic} /* Literal.String.Regex */
.highlight .s1 { color: #95e454; font-style: italic} /* Literal.String.Single */
.highlight .ss { color: #95e454; font-style: italic} /* Literal.String.Symbol */
.highlight .bp { color: #f6f3e8} /* Name.Builtin.Pseudo */
.highlight .vc { color: #cae682} /* Name.Variable.Class */
.highlight .vg { color: #cae682} /* Name.Variable.Global */
.highlight .vi { color: #cae682} /* Name.Variable.Instance */
.highlight .il { color: #e5786d} /* Literal.Number.Integer.Long */

156
docs/changelog.rst Normal file
View File

@ -0,0 +1,156 @@
Changelog
=========
Date format is year-month-day.
2.0.0 (2015-07-??)
^^^^^^^^^^^^^^^^^^
- Rewrite. CFFI_ and Hoedown_ instead of Cython_ and Sundown_.
- Remove pre- and postprocessor support.
- Smartypants is a normal function instead of a postprocessor.
.. _Hoedown: https://github.com/hoedown/hoedown
.. _Sundown: https://github.com/vmg/sundown
.. _CFFI: https://cffi.readthedocs.org
.. _Cython: http://cython.org/
1.0.3 (not released)
^^^^^^^^^^^^^^^^^^^^
- ``scripts/misaka``: Read stdin when no file is specified. (`#22`_)
- SmartyPants is now a preprocessor. This fixes `#19`_.
- Updated Sundown files; See commits from Mar 29, 2012 to Oct 19, 2012.
.. _#19: https://github.com/FSX/misaka/issues/19
.. _#22: https://github.com/FSX/misaka/pull/22
1.0.2 (2012-04-09)
^^^^^^^^^^^^^^^^^^
- Added ``clean``, ``compile_cython`` and ``update_vendor`` commands to ``setup.py``.
See ``setup.py --help-commands`` for more information.
- Removed the ``--cython`` install option.
- Sundown is now a Git submodule.
- Exceptions that are raised in render methods are now shown on STDOUT. The
script execution will not stop. Only the render method will stop and return
nothing.
- Removed trailing forward slashes from ``MANIFEST.in``. These cause trouble on
Windows. (`#12`_/`#13]`_)
- Input text now be a byte or unicode string. Callback method arguments are
always unicode. The returned text in a callback method can be a byte or unicode
string.
- In Python 3 render callbacks couldn't be seen, because the variable that was
used to lookup the methods was a byte string. And Python 3 doesn't see
byte string and normalstrings as equal.
- Added unit tests.
- Updated Sundown files; See commits from Feb 05, 2012 to Mar 29, 2012.
This includes fixes for Visual Studio on Windows.
.. _#12: https://github.com/FSX/misaka/pull/12
.. _#13: https://github.com/FSX/misaka/pull/13
1.0.1 (2012-02-07)
^^^^^^^^^^^^^^^^^^
- ``PyInt_FromLong`` was renamed to ``PyLong_FromLong`` in Python 3. A macro
has been added to fix this. (`#7`_)
- Included the C file generated by Cython again and made Cython an optional
dependency. The ``.pyx`` file can be compiled with the ``--cython`` option.
(`#6`_, `#8`_)
.. _#6: https://github.com/FSX/misaka/issues/6
.. _#7: https://github.com/FSX/misaka/issues/7
.. _#8: https://github.com/FSX/misaka/issues/8
1.0.0 (2012-02-04)
^^^^^^^^^^^^^^^^^^
- Reimplemented existing functionality in Cython.
- Added renderer classes for customized Markdown rendering (like Redcarpet has).
- Updated Sundown files; See commits from Aug 20, 2011 to Jan 27, 2012.
0.4.2 (2011-08-25)
^^^^^^^^^^^^^^^^^^
- Updated Sundown files; See commits from 2011-08-03 to 2011-08-09.
0.4.1 (2011-08-01)
^^^^^^^^^^^^^^^^^^
- Fixed buffer management. It was broken and leaked memory. (tanoku)
- Updated Sundown files; See commits from 2011-07-29 to 2011-08-01.
0.4.0 (2011-07-25)
^^^^^^^^^^^^^^^^^^
- API change: ``misaka.toc`` has been removed. Instead ``HTML_TOC_TREE`` has to be
passed with ``misaka.html`` to get a TOC tree. When ``HTML_TOC`` is used the
text will be rendered as usual, but the header HTML will be adjusted for the
TOC.
- Updated Sundown files; See commits from 2011-07-22 to 2011-07-24.
- Added support for the Superscript extension.
0.3.3 (2011-07-22)
^^^^^^^^^^^^^^^^^^
- Fix a typo in ``README.txt``. (heintz)
- Fix non-NULL-terminated ``kwlist`` in ``misaka_html``. (heintz)
- Rename module to misaka in benchmark.py. (honza)
- Renamed Upskirt to Sundown and updated the source files from 2011-07-04.
0.3.2 (2011-07-03)
^^^^^^^^^^^^^^^^^^
- Fixed minor error in ``setup.py``.
0.3.1 (2011-07-03)
^^^^^^^^^^^^^^^^^^
- Renamed project to Misaka.
- Updated Upskirt files; See commits from 2011-06-06 to 2011-06-23.
0.3.0 (2011-06-16)
^^^^^^^^^^^^^^^^^^
- Added Python 3 support.
- Updated Upskirt files; See commits from 2011-06-05 to 2011-06-09.
0.2.1 (2011-06-05)
^^^^^^^^^^^^^^^^^^
- Updated Upskirt files; See commits from 2011-05-18 to 2011-06-02.
0.2.0 (2011-05-17)
^^^^^^^^^^^^^^^^^^
- Added Smartypants render flag.
- Added a ``toc`` function that outputs a table of contents.
- Renamed ``markdown`` function to ``html``.
- Updated Upskirt files; See commits from 2011-05-02 to 2011-05-17.
0.1.1 (2011-05-01)
^^^^^^^^^^^^^^^^^^
- Updated Upskirt files; a HTML escaping bug in the XHTML renderer was fixed.
0.1.0 (2011-05-01)
^^^^^^^^^^^^^^^^^^
- Initial release.

286
docs/conf.py Normal file
View File

@ -0,0 +1,286 @@
# -*- coding: utf-8 -*-
#
# Misaka documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 12 11:37:42 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# 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.autodoc',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Misaka'
copyright = u'2015, Frank Smit'
author = u'Frank Smit'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.0.0'
# The full version, including alpha/beta/rc tags.
release = '2.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'Misakadoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Misaka.tex', u'Misaka Documentation',
u'Frank Smit', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'misaka', u'Misaka Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Misaka', u'Misaka Documentation',
author, 'Misaka', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

View File

@ -1,28 +0,0 @@
# base_url: http://misaka.61924.nl
base_url: http://0.0.0.0:8080
links:
- ['', 'index']
- ['changelog', 'changelog']
- ['manual', 'manual']
- ['api', 'api']
- ['development', 'development']
root:
- index
- '404'
post_scripts:
- process_assets.sh
misaka_extensions:
- no_intra_emphasis
- tables
- fenced_code
- autolink
- strikethrough
- superscript
# Javascript dependencies:
#
# - LESS

80
docs/index.rst Normal file
View File

@ -0,0 +1,80 @@
Misaka
======
Misaka is a CFFI-based binding for Hoedown_, a fast markdown processing library
written in C. It features a fast HTML renderer and functionality to make custom
renderers (e.g. man pages or LaTeX).
Changelog
---------
**2.0.0 (2015-07-??)**
- Rewrite. CFFI_ and Hoedown_ instead of Cython_ and Sundown_.
- Remove pre- and postprocessor support.
- Smartypants is a normal function instead of a postprocessor.
See the full changelog at :doc:`/changelog`.
.. _Hoedown: https://github.com/hoedown/hoedown
.. _Sundown: https://github.com/vmg/sundown
.. _CFFI: https://cffi.readthedocs.org
.. _Cython: http://cython.org/
Installation
------------
Misaka has been tested on CPython 2.7, 3.2, 3.3, 3.4 and PyPy 2.6. It needs
CFFI 1.0 or newer, because of this it will not work on PyPy 2.5 and older.
With pip::
pip install misaka
Or manually::
python setup.py install
Usage
-----
Very simple example::
from misaka import Markdown, HtmlRenderer
rndr = HtmlRenderer()
md = Markdown(rndr)
print md.render('some text')
Or::
import misaka as m
print m.html('some other text')
Testing
-------
Run one of the following commands::
python setup.py test # or...
python tests/runner.py
API
---
TODO
Indices and tables
------------------
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

263
docs/make.bat Normal file
View File

@ -0,0 +1,263 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 2> nul
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Misaka.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Misaka.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end

View File

@ -1,9 +0,0 @@
{% extends 'layout.html' %}
{% block title %}404{% end %}
{% block content %}
<p>It appears that the page you're looking for does not exist. Or not anymore.</p>
<p><a href="{{ url() }}">Index</a>.</p>
{% end %}

View File

@ -1,185 +0,0 @@
---
layout: page.html
location: api
title: API
toc: true
---
Listings and descriptions of all constants, functions, classes and methods. This
page only describes the public objects, see the manual for usage examples.
If there is no list of arguments/parameters or no description of what the function
or method returns it does not accept or return anything.
## Markdown Extensions
- **EXT_NO_INTRA_EMPHASIS** --- Do not parse emphasis inside of words. Strings
such as `foo_bar_baz` will not generate `<em>` tags.
- **EXT_TABLES** --- Parse [PHP-Markdown tables][].
- **EXT_FENCED_CODE** --- Parse fenced code blocks, PHP-Markdown style. Blocks
delimited with 3 or more `~` or backticks will be considered as code, without
the need to be indented. An optional language name may be added at the end of
the opening fence for the code block.
- **EXT_AUTOLINK** --- Parse links even when they are not enclosed in `<>` characters.
Autolinks for the http, https and ftp protocols will be automatically detected.
Email addresses are also handled, and http links without protocol, but starting
with `www`.
- **EXT_STRIKETHROUGH** --- Parse strikethrough, PHP-Markdown style Two `~`
characters mark the start of a strikethrough, e.g. `this is ~~good~~ bad`.
- **EXT_SPACE_HEADERS** --- A space is always required between the hash at the
beginning of a header and its name, e.g. `#this is my header` would not be a
valid header.
- **EXT_SUPERSCRIPT** --- Parse superscripts after the `^` character; contiguous
superscripts are nested together, and complex values can be enclosed in
parenthesis, e.g. `this is the 2^(nd) time`.
- **EXT_LAX_SPACING** --- ???
[PHP-Markdown tables]: http://michelf.com/projects/php-markdown/extra/#table
## HTML Render Flags
- **HTML_SKIP_HTML** --- Do not allow any user-inputted HTML in the output.
- **HTML_SKIP_STYLE** --- Do not generate any `<style>` tags.
- **HTML_SKIP_IMAGES** --- Do not generate any `<img>` tags.
- **HTML_SKIP_LINKS** --- Do not generate any `<a>` tags.
- **HTML_EXPAND_TABS** --- Unused.
- **HTML_SAFELINK** --- Only generate links for protocols which are considered safe.
- **HTML_TOC** --- Add HTML anchors to each header in the output HTML, to allow
linking to each section.
- **HTML_HARD_WRAP** --- Insert HTML `<br>` tags inside on paragraphs where the
origin Markdown document had newlines (by default, Markdown ignores these newlines).
- **HTML_USE_XHTML** --- Output XHTML-conformant tags.
- **HTML_ESCAPE** --- `HTML_ESCAPE` overrides `SKIP_HTML`, `SKIP_STYLE`, `SKIP_LINKS`
and `SKIP_IMAGES`. It doens't see if there are any valid tags, just escape all of them.
The following two flags are only for `misaka.html`.
- **HTML_SMARTYPANTS** --- Post-process rendered markdown text with [SmartyPants][].
[SmartyPants]: http://daringfireball.net/projects/smartypants/
- **HTML_TOC_TREE** --- Render a table of contents.
## Render Flags
Constants that can be used in custom renderers.
- **TABLE_ALIGN_L**
- **TABLE_ALIGN_R**
- **TABLE_ALIGN_C**
- **TABLE_ALIGNMASK**
- **TABLE_HEADER**
## html
Convert markdown text to (X)HTML.
Returns a unicode string.
- **text** --- A byte or unicode string.
- **extensions** --- Enable additional Markdown extensions with the `EXT_*` constants.
- **render_flags** --- Adjust HTML rendering behaviour with the `HTML_*` constants.
## Smartypants
Smartypants is a post-processor for (X)HTML renderers and can be used standalone
or as a mixin. It adds a methode named `postprocess` to the renderer.
Source | Result
---------------------------------|----------
`'s` (s, t, m, d, re, ll, ve) ^1 | &rsquo;s
`--` | &mdash;
`-` | &ndash;
`...` | &hellip;
`. . .` | &hellip;
`(c)` | &copy;
`(r)` | &reg;
`(tm)` | &trade;
`3/4` | &frac34;
`1/2` | &frac12;
`1/4` | &frac14;
1. A `'` followed by a `s`, `t`, `m`, `d`, `re`, `ll` or `ve` will be turned
into `&rsquo;s`, `&rsquo;t`, and so on.
### postprocess
Process the input text.
Returns a unicode string.
- **text** --- A byte or unicode string.
## BaseRenderer
The `BaseRenderer` is boilerplate code for creating your own renderers by
sublassing `BaseRenderer`. It takes care of setting the callbacks and flags.
- **flags** --- Available as a read-only, integer type attribute named `self.flags`.
### setup
A method that can be overridden by the renderer that sublasses `BaseRenderer`.
It's called everytime an instance of a renderer is created.
## HtmlRenderer
The HTML renderer that's included in Sundown.
Do you override the `setup` method when subclassing `HtmlRenderer`. If you do
make sure to call parent class' `setup` method first.
- **flags** --- Adjust HTML rendering behaviour with the `HTML_*` constants.
## HtmlTocRenderer
The HTML table of contents renderer that's included in Sundown.
Do you override the `setup` method when subclassing `HtmlTocRenderer`. If you do
make sure to call parent class' `setup` method first.
- **flags** --- Adjust HTML rendering behaviour with the `HTML_*` constants.
## Markdown
The Markdown parser.
- **renderer** --- An instance of `BaseRenderer`.
- **extensions** --- Enable additional Markdown extensions with the `EXT_*` constants.
### render
Render the Markdon text.
Returns a unicode string.
- **text** --- A byte or unicode string.

View File

@ -1,139 +0,0 @@
---
layout: page.html
location: changelog
title: Changelog
toc: True
---
## 1.0.3 (2012-11-??)
- `scripts/misaka`: Read stdin when no file is specified. ([#22][])
- SmartyPants is now a preprocessor. This fixes [#19][].
- Updated Sundown files; See commits from Mar 29, 2012 to Oct 19, 2012:
https://github.com/FSX/sundown/commits/master/
[#19]: https://github.com/FSX/misaka/issues/19
[#22]: https://github.com/FSX/misaka/pull/22
## 1.0.2 (2012-04-09)
- Added `clean`, `compile_cython` and `update_vendor` commands to `setup.py`.
See `setup.py --help-commands` for more information.
- Removed the `--cython` install option.
- Sundown is now added as a Git submodule.
- Exceptions that are raised in render methods are now shown on STDOUT. The
script execution will not stop. Only the render method will stop and return
nothing.
- Removed trailing forward slashes from MANIFEST.in. These cause trouble on Windows.
([#12][]/[#13][])
- Input text now be a byte or unicode string. Callback method arguments are
always unicode. The returned text in a callback method can be a byte or unicode string.
- In Python 3 render callbacks couldn't be seen, because the variable that was
used to lookup the methods was a byte string. And Python 3 doesn't see
byte string and normal strings as equal.
- Added unit tests.
- Updated Sundown files; See commits from Feb 05, 2012 to Mar 29, 2012.
This includes fixes for Visual Studio on Windows:
https://github.com/vmg/sundown/commits/master/
[#12]: https://github.com/FSX/misaka/pull/12
[#13]: https://github.com/FSX/misaka/pull/13
## 1.0.1 (2012-02-07)
- `PyInt_FromLong` was renamed to `PyLong_FromLong` in Python 3. A macro
has been added to fix this. ([#7][])
- Included the C file generated by Cython again and made Cython an optional
dependency. The `.pyx` file can be compiled with the `--cython` option.
([#6][], [#8][])
[#6]: https://github.com/FSX/misaka/issues/6
[#7]: https://github.com/FSX/misaka/issues/7
[#8]: https://github.com/FSX/misaka/issues/8
## 1.0.0 (2012-02-04)
- Reimplemented existing functionality in Cython.
- Added renderer classes for customized Markdown rendering (like Redcarpet has).
- Updated Sundown files; See commits from Aug 20, 2011 to Jan 27, 2012:
https://github.com/vmg/sundown/commits/master/
## 0.4.2 (2011-08-25)
- Updated Sundown files; See commits from 2011-08-03 to 2011-08-09:
https://github.com/vmg/sundown/commits/master/
## 0.4.1 (2011-08-01)
- Fixed buffer management. It was broken and leaked memory. (vmg)
- Updated Sundown files; See commits from 2011-07-29 to 2011-08-01:
https://github.com/vmg/sundown/commits/master/
## 0.4.0 (2011-07-25)
- API change: `misaka.toc` has been removed. Instead `HTML_TOC_TREE` has to be
passed with `misaka.html` to get a TOC tree. When `HTML_TOC` is used the
text will be rendered as usual, but the header HTML will be adjusted for the
TOC.
- Updated Sundown files; See commits from 2011-07-22 to 2011-07-24:
https://github.com/vmg/sundown/commits/master/
- Added support for the Superscript extension.
## 0.3.3 (2011-07-22)
- Fix a typo in `README.txt`. (heintz)
- Fix non-NULL-terminated `kwlist` in `misaka_html`. (heintz)
- Rename pantyshot to misaka in benchmark.py. (honza)
- Renamed Upskirt to Sundown and updated the source files from 2011-07-04
to 2011-07-19: https://github.com/vmg/sundown/commits/master
## 0.3.2 (2011-07-03)
- Fixed minor error in `setup.py`.
## 0.3.1 (2011-07-03)
- Renamed Pantyshot to Misaka.
- Updated Upskirt files; See commits from 2011-06-06 to 2011-06-23:
https://github.com/vmg/upskirt/commits/master/
## 0.3.0 (2011-06-16)
- Added Python 3 support.
- Updated Upskirt files; See commits from 2011-06-05 to 2011-06-09:
https://github.com/vmg/upskirt/commits/master/
## 0.2.1 (2011-06-05)
- Updated Upskirt files; See commits from 2011-05-18 to 2011-06-02:
https://github.com/vmg/upskirt/commits/master/
## 0.2.0 (2011-05-17)
- Added Smartypants render flag.
- Added a `toc` function that outputs a table of contents.
- Renamed `markdown` function to `html`.
- Updated Upskirt files; See commits from 2011-05-02 to 2011-05-17:
https://github.com/vmg/upskirt/commits/master/
## 0.1.1 (2011-05-01)
- Updated Upskirt files; a HTML escaping bug in the XHTML renderer was fixed.
## 0.1.0 (2011-05-01)
- Initial release.

View File

@ -1,146 +0,0 @@
---
layout: page.html
location: development
title: Development
toc: true
---
An overview of the information needed for development on Misaka and related things
like documentation, testing and dependencies.
## Code
The code can be cloned, forked or downloaded from https://github.com/FSX/misaka.
And issues can be reported on the [Issues][] page.
The only two dependencies for development are [Sundown][] and [Cython][]. Sundown
is already included, but can be updated with:
git submodule init
git submodule update
git submodule foreach git pull origin master
python setup.py update_vendor
Cython can be installed with pip, easy_install or other methods described in the
Cython documentation:
pip install Cython
The file organization is as follows (directories end for a forward slash, `/`):
- `benchmark/` --- A simple benchmark between different Python-based Markdown parsers.
- `docs/` --- Documentation in Markdown format.
- `scripts/` --- Command-line script that are installed to `/usr/bin` or `/usr/local/bin`
on Linux for example.
- `src/` --- All source files.
- `sundown/` --- The Sundown files that are copied from `vendor/sundown/`.
These files should not be changed, because they come from the Sundown Git
repository.
- `misaka.pyx` --- Cython source file.
- `misaka.c` --- C file that's generated by Cython. This file should not be edited.
Changes need to be made to `misaka.pyx` and `python setup.py compile_cython`
is used to update this file.
- `wrapper.h`, `wrapper.c` --- All callbacks for custom renderers.
- `*.pxd` --- Header files for Cython to import variables and function from
C files.
- `tests/` --- Unit tests.
- `vendor/` --- Submodules of dependencies (e.g. Sundown).
- `.travis.yml` --- Configuration files for [Travis CI][].
- `setup.py` --- Python setup file.
Files that are nor critical for development or speak for themselves have been omitted.
[Sundown]: https://github.com/FSX/sundown
[Cython]: http://cython.org/
[Travis CI]: http://about.travis-ci.org/docs/user/languages/python/
[Issues]: https://github.com/FSX/misaka/issues
## Unit tests
The unit tests require two dependencies: [HTML Tidy][] and minitest. The latter
one is already included, but HTML Tidy needs to be installed.
~~~bash
pacman -S tidyhtml # on Arch Linux
apt-get install tidy # on Ubuntu
~~~
To run the unit tests one simply goes into the `test/` directory and runs:
python misaka_tests.py
A list of tests and results will appear and the end result. When a test fails, the
test condition or a diff will be shown under the failed test.
The unit testing library, `minitest`, is used instead of Python's `unittest`,
because it does not require documentation. It's code is simple enough to figure
out what it does. And `minitest` does everything that is required in this project.
Additional functionality can be added as needed.
[HTML Tidy]: http://tidy.sourceforge.net/
## Documentation
The documentation uses some more dependencies. It requires [LESS][], [Elyse][]
and Misaka itself. Because LESS is needed, [Node.js][] and [npm][] are also needed.
Node.js has installers for Windows and Macintosh and most Linux distributions provide
a package that can be installed with the package manager. npm [isn't hard to install][npm-install].
Elyse is a simple static website generator. It pulls in the following dependencies:
PyYAML, Tornado, Houdini.py, Misaka, Pygments and Unidecode. If you would like to
use your own modified version of Misaka just install it manually.
The conversion of the LESS files depend on a Bash script. That probably doesn't work
Windows without installing a Bash environment first.
Elyse can be installed with:
pip -e git+git://github.com/FSX/elyse.git#egg=elyse
That's quite a lot. If you don't like it you can just read the plain text files
in the `docs/` directory or visit the online documentation at
[misaka.61924.nl](http://misaka.61924.nl/).
Building the documentation (generating HTML files) is easy. Move into the `docs/`
directory and run one of the following commands.
~~~bash
make
# Or...
elyse ./ _build/
# Or for more information...
elyse --help
~~~
The actual contents are located inside `docs/pages/`. These are Markdown files
with some metadata at the top of the file. In addition to the Markdown and YAML
you can use [Tornado template][tornado-template] tags.
~~~yaml
layout: page.html # A file in the `docs/templates/` directory
location: development # Used in the body ID
title: Development # Title of the page
toc: true # Show table of contents? Optional.
~~~
To preview the documentation you can serve the output directory with a simple
webserver like [darkhttp][], but before you do you need to change the `base_url`
in `docs/config.yml` to the local URL. Like the following for example.
base_url: http://0.0.0.0:8080
It should be changed back when local testing is done. It's a bit cumbersome, but
improvements are on the to do list.
[LESS]: http://lesscss.org/
[Elyse]: https://github.com/FSX/elyse
[Node.js]: http://nodejs.org/
[npm]: http://npmjs.org/
[npm-install]: http://npmjs.org/doc/README.html
[tornado-template]: http://www.tornadoweb.org/documentation/template.html
[darkhttp]: http://unix4lyfe.org/darkhttpd/

View File

@ -1,25 +0,0 @@
---
layout: index.html
location: index
title: Misaka
---
A Python 2 and 3 binding for [Sundown][], a really fast [Markdown][] parser
implemented in C. Misaka is written in [Cython][] and C. And it features a set
of Markdown extensions and customizable renderers. Just like the Sundown binding
for Ruby, [Redcarpet][].
[Sundown]: https://github.com/FSX/sundown
[Markdown]: http://en.wikipedia.org/wiki/Markdown
[Cython]: http://cython.org/
[Redcarpet]: https://github.com/vmg/redcarpet
Projects that use Misaka:
- [Jasy](https://github.com/zynga/jasy)
- [mynt](https://github.com/Anomareh/mynt)
- [Composer](https://github.com/shazow/composer)
- [Socrates](https://github.com/honza/socrates)
- [Pagewise](https://bitbucket.org/ainm/pagewise/overview)
- [StrangeCase](https://github.com/colinta/StrangeCase)

View File

@ -1,292 +0,0 @@
---
layout: page.html
location: manual
title: Manual
toc: true
---
Some usage examples of Misaka. Everything about the examples is explained here.
What's possible, how it works and what you get.
## Installation
Installation from [PyPi][]:
~~~ console
% pip install misaka
~~~
Or get the most recent version from [Github][]:
~~~ console
% git clone git://github.com/FSX/misaka.git
% cd misaka
% python setup.py install
~~~
Visual Studio's support for C is not optimal and most VS compilers are missing
`stdint.h`, which is needed to compile Misaka. This file can be downloaded
from [msinttypes][] and put into `C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include`
for example.
`setup.py` has been extended with some extra commands:
clean - cleanup directories created by packaging and build processes
compile_cython - compile Cython files(s) into C file(s)
update_vendor - update Sundown files. Use `git submodule init`,
`git submodule update` and `git submodule foreach git pull
origin master` to the most recent files
For example:
~~~ console
% python setup.py compile_cython
running cython
compiling /home/frank/Code/misaka/src/misaka.pyx
~~~
For the `compile_cython` command you need to have Cython installed. And [Git][] needs to
be installed to make the `update_vendor` command effective.
You have to run the following commands before running the `update_vendor` command
so the most recent files are downloaded first. Beware that the C API of Sundown
can be changed in newer version. Don't run this command unless you know what you're
doing.
git submodule init
git submodule update
git submodule foreach git pull origin master
python setup.py update_vendor
To run the unit tests [HTML Tidy][] must be installed first.
pacman -S tidyhtml # on Arch Linux
apt-get install tidy # on Ubuntu
And then:
cd tests
python misaka_test.py
[PyPi]: http://pypi.python.org/pypi/misaka
[Github]: https://github.com/FSX/misaka
[Git]: http://git-scm.com/
[msinttypes]: http://msinttypes.googlecode.com/svn/trunk/stdint.h
[HTML Tidy]: http://tidy.sourceforge.net/
## Basic Usage
You can make it yourself really easy by using `misaka.html`.
~~~ python
import misaka as m
print m.html('A ~~complex~~ simple example.',
extensions=m.EXT_STRIKETHROUGH)
# <p>A <del>complex</del> simple example.</p>
~~~
Add another extension has been added by using the [bitwise][] OR operator.
~~~ python
print m.html('The 2^(nd) ~~complex~~ simple example.',
extensions=m.EXT_STRIKETHROUGH | m.EXT_SUPERSCRIPT)
# <p>The 2<sup>nd</sup> <del>complex</del> simple example.</p>
~~~
Adding render flags works in the same way as adding extensions. See the [API][]
documentation for a listing of Markdown extensions and HTML render flags.
~~~ python
print m.html('The 3^(nd) ~~complex~~ <i>simple</i> example.',
extensions=m.EXT_STRIKETHROUGH | m.EXT_SUPERSCRIPT,
render_flags=m.HTML_SKIP_HTML)
# <p>The 3<sup>nd</sup> <del>complex</del> simple example.</p>
~~~
The `<i>`'s from `<i>simple</i>` are not in the output.
[bitwise]: http://docs.python.org/library/stdtypes.html#bitwise-operations-on-integer-types
[API]: {{ url('api') }}
## Custom Renderers
If you would like to influence the rendering or make a new renderer yourself,
don't wait and subclass `BaseRenderer` and start implementing your render
methods.
Here is a list of methods that can be implemented in a renderer. All method
arguments are prefixed with their type. A `bool` is a boolean, `int` an integer
and `str` a string or unicode string in Python 2. Remember that these methods are
going to be implemented in a class. So the first argument is always `self`. The
data that's returned from a render method should always be a byte or unicode string.
When an exception is raised in a render method a stacktrace will be shown in
STDOUT, but the rendering process will not stop. Instead the render method just
returns nothing.
**Block-level**:
~~~
block_code(str code, str language)
block_quote(str quote)
block_html(str raw_html)
header(str text, int level)
hrule()
list(str contents, bool is_ordered)
list_item(str text, bool is_ordered)
paragraph(str text)
table(str header, str body)
table_row(str content)
table_cell(str content, int flags)
~~~
The `flags` argument of the `table_cell` method can be compared with one of the
`TABLE_*` render flags. For example:
~~~ python
# Table cell is a header?
if flags & m.TABLE_HEADER:
print 'This is a header cell'
else:
print 'This is not a header cell'
# Alignment of the cell?
alignment = flags & m.TABLE_ALIGNMASK
if alignment == m.TABLE_ALIGN_C:
print 'Center'
elif alignment == m.TABLE_ALIGN_L:
print 'Left'
elif alignment == m.TABLE_ALIGN_R:
print 'Right'
else:
print 'Not aligned'
~~~
**Span-level**:
~~~
autolink(str link, bool is_email)
codespan(str code)
double_emphasis(str text)
emphasis(str text)
image(str link, str title, str alt_text)
linebreak()
link(str link, str title, str content)
raw_html(str raw_html)
triple_emphasis(str text)
strikethrough(str text)
superscript(str text)
~~~
**Low-level**:
~~~
entity(str text)
normal_text(str text)
~~~
**Header and footer of the document**:
~~~
doc_header()
doc_footer()
~~~
**Pre- and post-processing**:
~~~
preprocess(str full_document)
postprocess(str full_document)
~~~
### Code Highlighting
A simple code highlighting example with [Pygments][] and [Houdini.py][].
~~~ python
import houdini as h
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
# Create a custom renderer
class BleepRenderer(m.HtmlRenderer, m.SmartyPants):
def block_code(self, text, lang):
if not lang:
return '\n<pre><code>%s</code></pre>\n' % \
h.escape_html(text.strip())
lexer = get_lexer_by_name(lang, stripall=True)
formatter = HtmlFormatter()
return highlight(text, lexer, formatter)
# And use the renderer
renderer = BleepRenderer()
md = m.Markdown(renderer,
extensions=m.EXT_FENCED_CODE | m.EXT_NO_INTRA_EMPHASIS)
print md.render('Some Markdown text.')
~~~
[Pygments]: http://pygments.org/
[Houdini.py]: http://python-houdini.61924.nl/
## Pre- & Postprocessors
Pre- and postprocessors are classes that implement `preprocess` and/or `postprocess`
methods. Both accept one argument. The source text is passed to `preprocess` and
the rendered text (e.g. HTML) is passed to `postprocess`.
Pre- and postprocessors are intended to be used as mixins as you can see in the
code highlighting example. `HtmlRenderer` and `SmartyPants` are both subclassed
by `BleepRenderer` and `SmartyPants` is mixin.
Here's a useless example:
~~~ python
class ExamplePreprocessor(object):
def preprocess(self, text):
return text.replace(' ', '_')
class BleepRenderer(HtmlRenderer, ExamplePreprocessor):
pass
~~~
But you can also add a `preprocess` and/or `postprocess` to the renderer instead
of using a mixin class.
~~~ python
class BleepRenderer(HtmlRenderer):
def preprocess(self, text):
return text.replace(' ', '_')
~~~
### Smartypants
Smartypants is a post-processor for (X)HTML renderers and can be used standalone
or as a mixin. It adds a method named `preprocess` to the renderer. It converts
the charachter sequences in the left column to the sequences in the right column.
Source | Result
---------------------------------|----------
`'s` (s, t, m, d, re, ll, ve) ^1 | &rsquo;s
`--` | &mdash;
`-` | &ndash;
`...` | &hellip;
`. . .` | &hellip;
`(c)` | &copy;
`(r)` | &reg;
`(tm)` | &trade;
`3/4` | &frac34;
`1/2` | &frac12;
`1/4` | &frac14;
1. A `'` followed by a `s`, `t`, `m`, `d`, `re`, `ll` or `ve` will be turned
into `&rsquo;s`, `&rsquo;t`, and so on.

View File

@ -1,5 +0,0 @@
#/usr/bin/env bash
# Compile lesscss into CSS and compress it
lessc -x assets/screen.less assets/all.css
rm -r assets/*.less

View File

@ -1,33 +0,0 @@
{% extends 'layout.html' %}
{% block title %}{{ escape(page.title) }}{% end %}
{% block location %}{{ page.location }}-section{% end %}
{% block head %}
<script type="text/javascript">
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
</script>
{% end %}
{% block content %}
<article class="page">
{{ page.content }}
<p>How about a Flattr?</p>
<p>
<a class="FlattrButton" style="display:none;" href="http://misaka.61924.nl/"></a>
<noscript>
<a href="http://flattr.com/thing/683782/Misaka" target="_blank">
<img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" />
</a>
</noscript>
</p>
</article>
{% end %}

View File

@ -1,33 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}None{% end %} — Misaka</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="{{ asset('/all.css') }}">
{% block head %}{% end %}
</head>
<body id="{% block location %}index-section{% end %}">
<nav id="navigation">
<h1>Misaka</h1>
<div>
{% for link, name in site.links %}
<a id="nav-{{ name }}" href="{{ url(link) }}">{{ name }}</a>
{% end %}
</div>
</nav>
<section id="content">
{% block content %}{% end %}
</section>
<footer id="bottom">
<p>&copy; 2011-2012. <a href="https://github.com/FSX">Frank Smit</a>.</p>
</footer>
</body>
</html>

View File

@ -1,20 +0,0 @@
{% extends 'layout.html' %}
{% block title %}{{ escape(page.title) }}{% end %}
{% block location %}{{ page.location }}-section{% end %}
{% block content %}
{% if page.toc %}
<section class="toc">
{{ page.toc }}
</section>
{% end %}
<article class="page">
<header>
<h1>{{ escape(page.title) }}</h1>
</header>
{{ page.content }}
</article>
{% end %}