module jinja24doc link | top
Module dependences:
os
,
re
,
sys
def keywords(api, api_url='', types=('module', 'class', 'method', 'variable', 'function', 'h1', 'h2', 'h3')) link | top
Fill internal api_url variable from names of modules, classes, functions,
methods, variables or h1, h2 and h3 sections. With this, wiki can create
links to this functions or classes.
{% set api = load_module('module') %} {# create api rexex for from module where api will be on module_api.html #} {% do keywords(api, 'module_api.html') %} {# create api rexex for from module where api will be on same page #} {% do keywords(api) %} {# another way how to call keywords function without do keyword #} {{ keywords(api) }} {# keywords function return empty string #}Nice to have: there could be nice, if will be arguments in title, so mouseover event show some little detail of functions, methods or variables.
def load_module(module) link | top
get documentation of function, variables and classes from module
{% set api = load_module('module') %} {% for type, name, args, doc = api[0] %} ...
def load_text(textfile) link | top
Load file and create docs list of headers and texts.
textfile - string, text file name (manual.txt)
{% set sections = load_text('file.txt') %} {% type, name, _none_, text = sections[0] %}
def local_name(name) link | top
Returns striped name from its parent (module or class).
{{ local_name('MyClass.__init__') }} {# put __init__ to document #}
def wiki(doc) link | top
Call some regular expressions on doc, and return it with html
interpretation of wiki formating. If you want to create links to know
api for your module, just call keywords function after gets full api
documentation list.
This is some text, which could be little bit long. Never mind if text is on next line.
{{ wiki(string) }} {{ wiki('= header 1 =') }} {# <h1> header 1 </h1> #} {{ wiki('= header 2 =') }} {# <h2> header 2 </h2> #} {{ wiki('= header 3 =') }} {# <h3> header 3 </h3> #} {{ wiki('= header 4 =') }} {# <h4> header 4 </h4> #} {{ wiki('* bold text *') }} {# <b> bold text </b> #} {{ wiki('/ italic text /') }} {# <i> iatlic text </i> #} {{ wiki('{ code text }') }} {# <code> code text </code> #}Formated pre code type could be python (/default if not set/), jinja, ini or text. Text type stops highlighting. Code type must be on first line with hashbang prefix like in example:
#!python # simple python example from poorwsgi import * @app.route('/') # uri / def root(req): return 'Hello world %s' % 1234 # return textLooks that:
# simple python example from poorwsgi import * @app.route('/') # uri / def root(req): return 'Hello world %s' % 1234 # return textParameters padding:
This is some text, which could be little bit long. Never mind if text is on next line. parameter - some text for parameter parameter - some text for parameterLooks that:
This is some text, which could be little bit long. Never mind if text is on next line.
parameter
- some text for parameterparameter
- some text for parameter