Added some docs.

This commit is contained in:
Frank
2011-05-17 23:35:35 +02:00
parent 70eb1982ef
commit d68f804af2
6 changed files with 386 additions and 3 deletions

View File

@@ -44,7 +44,6 @@ In combination with `functools.partial`.
Or generate a table of contents.
pantyshot.toc('''
# Header one
Some text here.
@@ -52,7 +51,6 @@ Or generate a table of contents.
## Header two
Some more text
''')
@@ -72,7 +70,6 @@ Extensions:
Render flags:
HTML_GITHUB_BLOCKCODE
HTML_SMARTYPANTS
HTML_SKIP_HTML
HTML_SKIP_STYLE
HTML_HARD_WRAP

153
docs/documentation.md Normal file
View File

@@ -0,0 +1,153 @@
## Installation
Download Pantyshot from [Github][1] and run the following command. Keep in mind
that Pantyshot has only been tested with Python 2.7.
python setup.py install
And you're done.
[1]: https://github.com/FSX/pantyshot
## Usage
Example:
import pantyshot
pantyshot.html('Hello, world!')
With extensions and render flags:
import pantyshot as p
p.html(
'Hello, world!',
p.EXT_AUTOLINK | p.EXT_TABLES,
p.HTML_EXPAND_TABS
)
In combination with functools.partial:
import functools
import pantyshot as p
markdown = functools.partial(
p.html,
extensions=p.EXT_AUTOLINK | p.EXT_TABLES,
render_flags=p.HTML_EXPAND_TABS
)
markdown('Awesome!')
Or generate a table of contents:
pantyshot.toc('''
# Header one
Some text here.
## Header two
Some more text
''')
## API
All of the following functions and constants are from the `pantyshot` module.
### pantyshot.html
The `html` function converts the Markdown text to HTML. It accepts the following arguments.
* `text`: The Markdown source text.
* `extensions`: One or more extension constants (optional).
* `render_flags`: One or more render flag constants (optional).
### pantyshot.toc
The `toc` function generates a table of contents and accepts the following argument.
* `text`: The Markdown source text.
### Extensions
The functionality of the following constants is explained at *Markdown Extensions*.
EXT_AUTOLINK
EXT_LAX_HTML_BLOCKS
EXT_TABLES
EXT_NO_INTRA_EMPHASIS
EXT_STRIKETHROUGH
EXT_FENCED_CODE
EXT_SPACE_HEADERS
### Render Flags
The functionality of the following constants is explained at *Render Flags*.
HTML_GITHUB_BLOCKCODE
HTML_SKIP_HTML
HTML_SKIP_STYLE
HTML_HARD_WRAP
HTML_TOC
HTML_SKIP_LINKS
HTML_SAFELINK
HTML_SKIP_IMAGES
HTML_EXPAND_TABS
HTML_USE_XHTML
HTML_SMARTYPANTS
## Changelog
### 0.2.0 (2011-05-??)
* 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-16:
https://github.com/tanoku/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.
## License
Copyright (C) 2011 by Frank Smit <frank@61924.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

19
docs/generate.py Normal file
View File

@@ -0,0 +1,19 @@
import pantyshot as p
if __name__ == '__main__':
with open('./documentation.md', 'r') as fd:
src = fd.read().strip()
html = p.html(
src, p.EXT_AUTOLINK, p.HTML_TOC
)
toc = p.toc(src)
with open('template.html', 'r') as fd:
tpl = fd.read().strip()
tpl = tpl.replace('{{ navigation }}', toc, 1)
tpl = tpl.replace('{{ content }}', html, 1)
with open('index.html', 'w') as fd:
fd.write(tpl)

183
docs/style.css Normal file
View File

@@ -0,0 +1,183 @@
/* --- html5doctor.com Reset Stylesheet v1.4.1, 2010-03-01
--- Author: Richard Clark - http://richclarkdesign.com
--------------------------------------------------------------------*/
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, 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 }
body {
line-height: 1em }
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary {
display: block }
nav ul { list-style: none }
blockquote, q { quotes: none }
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none }
a {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent }
ins {
background-color: #ff9;
color: #000;
text-decoration: none }
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 #000;
cursor: help }
table {
border-collapse: collapse;
border-spacing: 0 }
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #cccccc;
margin: 1em 0;
padding: 0 }
input, select { vertical-align: middle }
p, ul { margin: 1.5em 0 }
img { margin: 0;padding: 0;max-width: 740px }
/* --- Content styling
--------------------------------------------------------------------*/
html, body { height: 100% }
body {
color: #444;
font-size: 1em;
font-family: 'DejaVu Sans', 'Helvetica Neue', 'Helvetica', Arial, sans-serif;
line-height: 1.6em }
h1 { font-family: 'Sorts Mill Goudy', Georgia, 'DejaVu Serif', 'Bitstream Vera Serif', serif }
h1, h2, h3, h4, h5, h6 {
font-weight: normal }
h1 { margin: 0.5em 0;font-size: 4.5em }
h2 {
margin: 0.75em 0;
font-size: 1.5em;
line-height: 1.2em;
padding-top: 1em;
border-top: 4px solid #E0E0E0 }
h3 {
margin: 2em 0 1em;
font-size: 1.1em;
line-height: 1em }
h4 {
margin: 1.25em 0;
font-size: 1.4em;
line-height: 1.25 }
h5 { margin: 1.5em 0;font-size: 1.2em; }
h6 { font-size: 1.2em }
a:link, a:visited { color: #333 }
a:hover, a:active { color: #c00 }
a img { border: 4px solid #ddd }
a:hover img { border-color: #C4D7FF }
ul, ol {
margin: 0 0.5em 1.5em;
padding-left: 2.5em }
li ul, li ol {
margin: 0;
padding-left: 1.5em }
table, th, td {
border-color: #bbb;
border-style: solid }
table {
border-collapse: separate;
border-spacing: 0;
border-width: 0 0 1px 1px }
th, td {
padding: 0.3em 1em;
border-width: 1px;
border-left-color: #f1f1f1;
text-align: left }
th {
background: #eee;
border-bottom-color: #ddd;
font-weight: bold }
td {
border-bottom-color: #efefef;
font-weight: normal }
code {
padding: 1px 3px;
background: #eee;
color: #555 }
pre {
margin: 1.5em 0 1.5em;
padding: 0.5em 0 0.5em 1.5em;
color: #222 }
pre, code {
font-family: Inconsolata, 'DejaVu Sans Mono', Consolas, 'Lucida Console', monospace }
pre code {
display: block;
padding: 0 0 0.2em;
overflow-x: auto;
white-space: pre;
background: inherit;
color: inherit }
#wrapper {
margin: 0 auto;
width: 65% }
#header, #content { margin: 0 25% }
#content { padding-bottom: 1.5em }
#sidebar {
float: left;
width: 21%;
font-size: .9em;
text-align: right;
line-height: 2em; }
#sidebar ul {
margin: 0;
padding: 0 }
#sidebar a { text-decoration: none }
#sidebar li ul li ul {
padding-right: 1.8em }

31
docs/template.html Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<title>Pantyshot, a Python binding for Upskirt!</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="style.css" />
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div id="wrapper">
<header id="header">
<h1>Pantyshot</h1>
<p>A Python binding for <a href="https://github.com/tanoku/upskirt">Upskirt</a>.</p>
</header>
<nav id="sidebar">
{{ navigation }}
</nav>
<section id="content">
{{ content }}
</section>
</div>
</body>
</html>