Package mopowg :: Module mopowg
[hide private]
[frames] | no frames]

Module mopowg

source code

mopowg is an easy to install, cross-platform doc generator which is based on docutils.

mopowg could generate full documents with figures, styles, and syntax highlighting blocks.

fredlin 2007, gasolin+mopowg@gmail.com


doc processing

Diagram:

 ___________
 |         |
 |  files  |
 |         |
\|_________|/
 \         /
   Scanner  -> file_list
     |||
  Generator - Formater -> contents
     |||
  Processor   -> files (content, presentation)
     \|/
 ___________
 |         |
 |   docs  |
 |         |
 |_________|

doc hosting[1]

Runner is the build in server which host the documents;

Plugins:

Interpreter is the crunchy interpreter that allow you to execute the demo codes on doc;

Commenter is append fields for comment

Diagram:

  ___________
  |         |
  |  files  |
  |         |
  |_________|
       |
----------------
|doc processing|
----------------
       |
     Runner - plugins
                 |
                 |- Interpreter
                 |
                 |_ Commenter

doc collaborative [1]

Diagram:

  ___________
  |         |
  |  files  |--hg repository
  |         |
  |_________|
       |
----------------
|doc processing|
----------------
       |
----------------
| doc hosting  |
----------------
       |
     wikier

[1]: not implemented yet


This is the MIT license: http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2007 Fred Lin and contributors. Mopowg is a trademark of Fred Lin.

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.

Functions [hide private]
 
proc_dir(file_list, dirName, files)
The callback function of os.path.walk() to get the list of scanned files.
source code
 
scanner(path=None)
scan a folder
source code
 
css_writer(output, style, filename='style.css')
write css
source code
 
saver(path, content, output, style='', nostyle=False, ext='.html')
save content to file
source code
 
templater(input, content, template)
generate with genshi template
source code
 
processor(input, content, output, template, style, preview=False)
process the content
source code
 
pygments_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
register the docutils highlight function
source code
 
convertor(path, *arg, **kw)
Convert file to target format, include syntax highlight function
source code
 
generator(input, filter=['.rst', '.txt'], output=None, rich=True, wikiword=True, template='\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//..., style='body {\n margin: 0;\n padding: 0;\n font-family: Ver..., preview=False)
generate docs
source code
 
cmdtool() source code
Variables [hide private]
  default_style = 'body {\n margin: 0;\n padding: 0;\n ...
  default_template = '\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...
  wikiwords = re.compile(r'\b([A-Z]\w+[A-Z]+\w+)')
Function Details [hide private]

scanner(path=None)

source code 

scan a folder

scanner is a preprocess class to collect files

scanner currently allow single layer only

css_writer(output, style, filename='style.css')

source code 

write css

output:
output path
style:
custom style string
filename:
output filename

saver(path, content, output, style='', nostyle=False, ext='.html')

source code 

save content to file

output: dir

saver is the processor which is used to store contents to actual files;

nostyle:
not generate the css style
ext:
the file extension. default value is '.html'.

convertor(path, *arg, **kw)

source code 

Convert file to target format, include syntax highlight function

input: path output: content

support features: rich(rich content), wikiword, wikipattern

generator(input, filter=['.rst', '.txt'], output=None, rich=True, wikiword=True, template='\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//..., style='body {\n margin: 0;\n padding: 0;\n font-family: Ver..., preview=False)

source code 

generate docs

generator is used to generate docs;


Variables Details [hide private]

default_style

Value:
'''body {
    margin: 0;
    padding: 0;
    font-family: Verdana, "Lucida Grande", sans-serif;
    text-align: left; 
    /*text-align: center;*/
    line-height: 1.3em;
    color: #333;
...

default_template

Value:
'''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti\
onal.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
<head>
...