This module generates code documentation for OpenTeacher automatically based on the actual code. When the server crashes, you can see the error message by adding the 'debug' parameter. (i.e. python openteacher.py -p code-documentation debug).
This module generates the following documentation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2011-2014, 2017, Marten de Vries
#
# This file is part of OpenTeacher.
#
# OpenTeacher is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenTeacher is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
import sys
import os
import builtins
class CodeDocumentationModule:
"""This module generates code documentation for OpenTeacher
automatically based on the actual code. When the server crashes,
you can see the error message by adding the 'debug' parameter.
(i.e. ``python openteacher.py -p code-documentation debug``).
This module generates the following documentation:
- Overview of all modules
- Overview of the methods and properties of the module classes,
including docstrings.
- Source listing (including syntax highlighting)
- The module map (showing all dependencies between modules)
- FIXMEs/TODOs overview
"""
def __init__(self, moduleManager, *args, **kwargs):
super().__init__(*args, **kwargs)
self._mm = moduleManager
self.type = "codeDocumentationShower"
self.requires = (
self._mm.mods(type="metadata"),
self._mm.mods(type="execute"),
self._mm.mods(type="moduleGraphBuilder"),
self._mm.mods(type="devDocs"),
self._mm.mods(type="qtApp"),
)
self.uses = (
self._mm.mods(type="profileDescription"),
)
self.priorities = {
"code-documentation": 0,
"default": -1,
}
self.devMod = True
def run(self):
if os.environ.get("UWSGI"):
builtins.application = self._impl.app
else:
print("Serving at http://0.0.0.0:8080/. Ctrl + C to abort")
self._impl.app.run(host="0.0.0.0", port=8080)
def enable(self):
self._modules = set(self._mm.mods(type="modules")).pop()
self._modules.default(type="execute").startRunning.handle(self.run)
self._impl = self._mm.import_("serverImpl")
try:
import flask
import pygments
import pygments.lexers
import pygments.formatters
import pygments.util
import docutils.core
import pyratemp
from PyQt5 import QtGui
except ImportError:
sys.stderr.write("For this developer module to work, you need to have flask, pygments, pyratemp, PyQt5 and docutils installed. And indirectly, pygraphviz.\n")
return #leave disabled
#enable syntax highlighting
self._mm.import_("rst-directive")
self._impl.flask = flask
self._impl.pygments = pygments
self._impl.docutils = docutils
self._impl.pyratemp = pyratemp
self._impl.QtGui = QtGui
metadata = self._modules.default("active", type="metadata").metadata
class utilsMod:
hue = metadata["mainColorHue"]
templates = {
"modules": self._mm.resourcePath("templ/modules.html"),
"priorities": self._mm.resourcePath("templ/priorities.html"),
"fixmes": self._mm.resourcePath("templ/fixmes.html"),
"module": self._mm.resourcePath("templ/module.html"),
"dev_docs": self._mm.resourcePath("templ/dev_docs.html"),
"resources": self._mm.resourcePath("resources"),
"style": self._mm.resourcePath("templ/style.css"),
"logo": metadata["iconPath"],
}
buildModuleGraph = self._modules.default("active", type="moduleGraphBuilder").buildModuleGraph
devDocsBaseDir = self._modules.default("active", type="devDocs").developerDocumentationBaseDirectory
mm = self._mm
self._impl.utils = utilsMod
self._impl.initialize()
self.active = True
def disable(self):
self.active = False
self._modules.default(type="execute").startRunning.unhandle(self.run)
del self._modules
del self._impl
def init(moduleManager):
return CodeDocumentationModule(moduleManager)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | # -*- coding: utf-8 -*-
# Copyright (c) 2006-2009 by the Pygments team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
The Pygments reStructuredText directive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fragment is a Docutils_ 0.5 directive that renders source code
(to HTML only, currently) via Pygments.
To use it, adjust the options below and copy the code into a module
that you import on initialization. The code then automatically
registers a ``sourcecode`` directive that you can use instead of
normal code blocks like this::
.. sourcecode:: python
My code goes here.
If you want to have different code styles, e.g. one with line numbers
and one without, add formatters with their names in the VARIANTS dict
below. You can invoke them instead of the DEFAULT one by using a
directive option::
.. sourcecode:: python
:linenos:
My code goes here.
Look at the `directive documentation`_ to get all the gory details.
.. _Docutils: http://docutils.sf.net/
.. _directive documentation:
http://docutils.sourceforge.net/docs/howto/rst-directives.html
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# Options
# ~~~~~~~
# Set to True if you want inline CSS styles instead of classes
INLINESTYLES = False
from pygments.formatters import HtmlFormatter
# The default formatter
DEFAULT = HtmlFormatter(noclasses=INLINESTYLES)
# Add name -> formatter pairs for every variant you want to use
VARIANTS = {
# 'linenos': HtmlFormatter(noclasses=INLINESTYLES, linenos=True),
}
from docutils import nodes
from docutils.parsers.rst import directives, Directive
from pygments import highlight
from pygments.lexers import get_lexer_by_name, TextLexer
class Pygments(Directive):
""" Source code syntax hightlighting.
"""
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
option_spec = dict([(key, directives.flag) for key in VARIANTS])
has_content = True
def run(self):
self.assert_has_content()
try:
lexer = get_lexer_by_name(self.arguments[0])
except ValueError:
# no lexer found - use the text one instead of an exception
lexer = TextLexer()
# take an arbitrary option if more than one is given
formatter = self.options and VARIANTS[next(self.options.keys())] or DEFAULT
parsed = highlight(u'\n'.join(self.content), lexer, formatter)
return [nodes.raw('', parsed, format='html')]
directives.register_directive('sourcecode', Pygments)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2011-2013, 2017, Marten de Vries
#
# This file is part of OpenTeacher.
#
# OpenTeacher is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenTeacher is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
import inspect
import os
import types
import re
import tempfile
import builtins
BUILTIN_TYPES = [t for t in builtins.__dict__.values() if isinstance(t, type)]
#handled by main module (but only added after import of this file!):
#import flask
#import pygments
#import pygments.lexers
#import pygments.formatters
#import pygments.util
#import docutils.core
#import pyratemp
#from PyQt5 import QtGui
#import utils #some functions, constants, etc.
def initialize():
global app
app = flask.Flask(__name__)
class EvalPseudoSandbox(pyratemp.EvalPseudoSandbox):
def __init__(self2, *args, **kwargs):
pyratemp.EvalPseudoSandbox.__init__(self2, *args, **kwargs)
self2.register("url_for", flask.url_for)
def formatter(path):
return pygments.formatters.HtmlFormatter(**{
"linenos": "table",
"anchorlinenos": True,
"lineanchors": pathToUrl(path),
})
def pathToUrl(path):
path = os.path.abspath(path)
sourceBase = os.path.abspath(os.path.dirname(__file__))
while not sourceBase.endswith("modules"):
sourceBase = os.path.normpath(os.path.join(sourceBase, ".."))
if sourceBase != os.curdir:
common = os.path.commonprefix([sourceBase, path])
path = path[len(common) +1:]
try:
return flask.url_for('modules', path=path)
except RuntimeError:
return 'modules/' + path
def formatRst(text):
if text:
return docutils.core.publish_parts(
text.replace("\t", "").replace(" ", ""),
writer_name="html",
settings_overrides={"report_level": 5}
)["html_body"]
else:
return text
@app.route("/module_graph.svg")
def module_graph_svg():
try:
fd, path = tempfile.mkstemp(".svg")
os.close(fd)
utils.buildModuleGraph(path)
return flask.send_file(path)
finally:
os.remove(path)
@app.route("/style.css")
def style_css():
t = pyratemp.Template(filename=utils.templates["style"], eval_class=EvalPseudoSandbox)
data = t(**{
"headerBackgroundColor": QtGui.QColor.fromHsv(utils.hue, 41, 250).name(),
"bodyBackgroundColor": QtGui.QColor.fromHsv(utils.hue, 7, 253, 255).name(),
"footerBackgroundColor": QtGui.QColor.fromHsv(utils.hue, 30, 228).name(),
"pygmentsStyle": formatter(".").get_style_defs('.highlight'),
})
resp = flask.make_response(data)
resp.headers["Content-Type"] = "text/css"
return resp
@app.route("/resources/<path:path>")
def resources(path):
if path == "logo":
path = utils.templates["logo"]
else:
#construct the path
path = os.path.normpath(
os.path.join(utils.templates["resources"], path)
)
#check if the path is valid (i.e. is in the resources
#directory.)
if not path.startswith(os.path.normpath(utils.templates["resources"])):
flask.abort(404)
try:
return flask.send_file(path)
except IOError:
flask.abort(404)
@app.route("/")
def index():
t = pyratemp.Template(filename=utils.templates["modules"], eval_class=EvalPseudoSandbox)
return t(**{
"mods": sorted(mods.keys())
})
@app.route("/priorities.html")
def priorities_html():
profileMods = utils.mm.mods("active", type="profileDescription")
profiles = (profileMod.desc["name"] for profileMod in profileMods)
profiles = ["default"] + sorted(profiles)
mods = {}
for mod in utils.mm.mods("priorities"):
mods[pathToUrl(os.path.dirname(mod.__class__.__file__))] = mod
mods = sorted(mods.items())
t = pyratemp.Template(filename=utils.templates["priorities"], eval_class=EvalPseudoSandbox)
return t(**{
"mods": mods,
"profiles": profiles,
})
def fixmePaths():
#get base directory
def upOne(p):
return os.path.normpath(os.path.join(p, ".."))
basePath = os.path.abspath(os.path.dirname(__file__))
while not basePath.endswith("modules"):
basePath = upOne(basePath)
#get all paths
paths = (
os.path.join(root, file)
for root, dirs, files in sorted(os.walk(basePath))
for file in files
)
#and filter them, return the results
return (
p for p in paths
if not (
os.path.splitext(p)[1] in (".png", ".gif", ".bmp", ".ico", ".pyc", ".mo", ".psd", ".gpg", ".pem", ".sqlite3", ".rtf", ".po", ".pot")
or p.endswith("~")
or "jquery" in p
or "admin_files" in p
or "codeDocs" in p
or "ircBot" in p
or "words.txt" in p
or "dev_tools.rst" in p
or "pouchdb.js" in p
)
)
@app.route("/fixmes.html")
def fixmes_html():
rePattern = re.compile("fixme|todo", re.IGNORECASE)
fixmes = []
for fpath in fixmePaths():
with open(fpath, "r", encoding='UTF-8', errors='replace') as f:
lines = f.readlines()
for i, line in enumerate(lines):
match = rePattern.search(line)
if not match:
continue
if i - 2 > 0:
startNumber = i - 2
else:
startNumber = 0
try:
lines[i + 5]
except IndexError:
endNumber = len(lines)
else:
endNumber = i + 5
relevantLines = lines[startNumber:endNumber]
relevantCode = u"".join(relevantLines)
try:
lexer = pygments.lexers.get_lexer_for_filename(fpath)
except pygments.util.ClassNotFound:
lexer = pygments.lexers.TextLexer()
formatter = pygments.formatters.HtmlFormatter()
fixmes.append({
"path": pathToUrl(fpath),
"line_number": i + 1,
"relevant_code": pygments.highlight(relevantCode, lexer, formatter),
})
t = pyratemp.Template(filename=utils.templates["fixmes"], eval_class=EvalPseudoSandbox)
return t(**{
"fixmes": fixmes,
})
def isFunction(mod, x):
try:
obj = getattr(mod.__class__, x)
except AttributeError:
obj = getattr(mod, x)
return isinstance(obj, types.MethodType)
def modsForRequirement(selectors):
for selector in selectors:
selectorResults = set()
requiredMods = set(selector)
for requiredMod in requiredMods:
selectorResults.add((
pathToUrl(os.path.dirname(requiredMod.__class__.__file__)),
requiredMod.__class__.__name__
))
yield selectorResults
def renderRstPage(rstPath):
with open(rstPath, encoding='UTF-8') as f:
parts = docutils.core.publish_parts(
f.read(),
writer_name="html",
settings_overrides={
"report_level": 5,
"initial_header_level": 2
}
)
t = pyratemp.Template(filename=utils.templates["dev_docs"], eval_class=EvalPseudoSandbox)
return t(**{
"page": parts["fragment"],
"title": parts["title"]
})
@app.route("/dev_docs/", defaults={"path": "index.rst"})
@app.route("/dev_docs/<path:path>")
def dev_docs(path):
requestedPath = os.path.normpath(path)
if os.path.isabs(requestedPath) or requestedPath.startswith(os.pardir):
#invalid path
flask.abort(404)
path = os.path.join(utils.devDocsBaseDir, requestedPath)
if not os.path.exists(path):
flask.abort(404)
if path.endswith(".rst"):
return renderRstPage(path)
else:
return flask.send_file(os.path.abspath(path))
#if all else fails
flask.abort(404)
def propertyDocs(property):
#first try if the class attribute has a doc string. This
#catches e.g. @property-decorated function docstrings.
try:
return formatRst(getattr(mod.__class__, property).__doc__)
except:
#all errors aren't important enough to fail for
pass
#then try to get the docstring of the object itself.
try:
propertyObj = getattr(mod, property)
except:
#errors aren't important enough to fail for.
return
if propertyObj.__class__ != type and propertyObj.__class__ in BUILTIN_TYPES:
#docstring is uninteresting
return
try:
return formatRst(propertyObj.__doc__)
except AttributeError:
#no docstring.
return
def fileDataForMod(mod):
for root, dirs, files in os.walk(os.path.dirname(mod.__class__.__file__)):
for f in sorted(files):
ext = os.path.splitext(f)[1]
if ext not in [".html", ".py", ".js", ".css", ".po", ".pot"]:
continue
if "jquery" in f.lower():
continue
path = os.path.join(root, f)
if os.path.getsize(path) > 1.0/4.0 * 1024 * 1024:
#> 0.25MB
continue
with open(path, encoding='UTF-8') as f:
code = f.read()
lexer = pygments.lexers.get_lexer_for_filename(path)
source = pygments.highlight(code, lexer, formatter(path))
commonLength = len(os.path.commonprefix([
path,
os.path.dirname(mod.__class__.__file__)
]))
yield path[commonLength:], source
@app.route("/modules/<path:path>")
def modules(path):
path = path[:-len(".html")]
try:
mod = mods["modules/" + path]
except KeyError:
flask.abort(404)
attrs = set(dir(mod))
methods = set(func for func in attrs if isFunction(mod, func))
properties = attrs - methods
isPublic = lambda x: not x.startswith("_")
methods = set(m for m in methods if isPublic(m))
methodDocs = {}
methodArgs = {}
for method in methods:
methodObj = getattr(mod, method)
methodDocs[method] = formatRst(methodObj.__doc__)
methodArgs[method] = constructSignature(inspect.getargspec(methodObj))
properties = set(p for p in properties if isPublic(p))
#remove special properties
properties -= set(["type", "uses", "requires", "priorities", "filesWithTranslations"])
propertyDocstrings = dict(
(p, propertyDocs(p))
for p in properties
if propertyDocs(p) is not None
)
#uses
uses = modsForRequirement(getattr(mod, "uses", []))
#requires
requires = modsForRequirement(getattr(mod, "requires", []))
fileData = fileDataForMod(mod)
t = pyratemp.Template(filename=utils.templates["module"], eval_class=EvalPseudoSandbox)
return t(**{
"name": mod.__class__.__name__,
"moddoc": formatRst(mod.__doc__),
"type": getattr(mod, "type", None),
"uses": uses,
"requires": requires,
"methods": sorted(methods),
"methodDocs": methodDocs,
"methodArgs": methodArgs,
"properties": sorted(properties),
"propertyDocs": propertyDocstrings,
"files": fileData,
})
def constructSignature(data):
try:
args = reversed(data.args)
except TypeError:
args = []
try:
defaults = list(reversed(data.defaults))
except TypeError:
defaults = []
result = []
for i, arg in enumerate(args):
try:
result.insert(0, "%s=%s" % (arg, defaults[i]))
except IndexError:
result.insert(0, arg)
if data.varargs:
result.append("*" + data.varargs)
if data.keywords:
result.append("**" + data.keywords)
return result
mods = {}
for mod in utils.mm.mods:
#get the path of the module
path = os.path.dirname(mod.__class__.__file__)
#make sure the path is relative to the modules root for easier recognition
mods[pathToUrl(path)] = mod
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | #! Copyright 2012, 2017, Marten de Vries
#!
#! This file is part of OpenTeacher.
#!
#! OpenTeacher is free software: you can redistribute it and/or modify
#! it under the terms of the GNU General Public License as published by
#! the Free Software Foundation, either version 3 of the License, or
#! (at your option) any later version.
#!
#! OpenTeacher is distributed in the hope that it will be useful,
#! but WITHOUT ANY WARRANTY; without even the implied warranty of
#! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#! GNU General Public License for more details.
#!
#! You should have received a copy of the GNU General Public License
#! along with OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
#!
<!--(set_escape)-->
html
<!--(end)-->
<!doctype html>
<html>
<head>
<title>Module: @!name!@</title>
<link rel='stylesheet' type='text/css' href='@!url_for("style_css")!@' />
<link rel="shortcut icon" type="image/png" href="@!url_for('resources', path='logo')!@">
<script src='@!url_for("resources", path="jquery.js")!@' type='text/javascript'></script>
<script type='text/javascript'>
$(function() {
$('.source').hide();
//If a line number needs to be shown, show the file
//of which it's part.
var name = window.location.hash.substring(1);
var element = $('[name="' + name + '"]');
var parent = element.parents('.source')
parent.show();
//Connect the toggle links
$('.toggle').click(function() {
var parent = $(this).parent()
var source = $(".source", parent);
source.toggle('slow');
return false;
});
});
</script>
<style type='text/css'>
#source a {
text-decoration: none;
}
</style>
</head>
<body>
<div id='header'>
<img id='logo' src='@!url_for("resources", path="logo")!@' />
<h1>Module: @!name!@</h1>
<a id='nav' href='@!url_for("index")!@'>< Back to index</a><br />
</div>
<div id='page'>
<!--(if moddoc)-->
<p>
$!moddoc!$
</p>
<!--(end)-->
<table id='modInfoTable'>
<tbody>
<!--(if type)-->
<tr>
<td>Type:</td>
<td>@!type!@</td>
</tr>
<!--(end)-->
<!--(if uses)-->
<tr>
<td>Uses (at least one of):</td>
<td>
<!--(for selector in uses)-->
<!--(for url, name in selector)-->
<a href='@!url!@.html'>@!name!@ ></a>
<!--(end)-->
<br />
<!--(end)-->
</td>
</tr>
<!--(end)-->
<!--(if requires)-->
<tr>
<td>Requires (at least one of):</td>
<td>
<!--(for selector in requires)-->
<!--(for url, name in selector)-->
<a href='@!url!@.html'>@!name!@ ></a>
<!--(end)-->
<br />
<!--(end)-->
</td>
</tr>
<!--(end)-->
</tbody>
</table>
<!--(if methods)-->
<h2>Methods:</h2>
<ul>
<!--(for method in methods)-->
<li>
<strong>@!method!@(@!", ".join(methodArgs[method])!@)</strong>
<!--(if methodDocs[method])-->
<br />
$!methodDocs[method]!$
<!--(end)-->
</li>
<!--(end)-->
</ul>
<!--(end)-->
<!--(if properties)-->
<h2>Properties:</h2>
<ul>
<!--(for property in properties)-->
<li>
<strong>@!property!@</strong>
<!--(if property in propertyDocs and propertyDocs[property])-->
<br />
$!propertyDocs[property]!$
<!--(end)-->
</li>
<!--(end)-->
</ul>
<!--(end)-->
<!--(if files)-->
<h2>Files</h2>
<ul>
<!--(for path, source in files)-->
<li>
<a href='#' class='toggle'>@!path!@</a>
<div class='source'>$!source!$</div>
</li>
<!--(end)-->
</ul>
<!--(end)-->
</div>
<div id='footer'>
<a href='@!url_for("index")!@'>< Back to index</a><br />
<em>OpenTeacher code documentation</em>
</div>
</body>
</html>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | #! Copyright 2012-2013, 2017, Marten de Vries
#!
#! This file is part of OpenTeacher.
#!
#! OpenTeacher is free software: you can redistribute it and/or modify
#! it under the terms of the GNU General Public License as published by
#! the Free Software Foundation, either version 3 of the License, or
#! (at your option) any later version.
#!
#! OpenTeacher is distributed in the hope that it will be useful,
#! but WITHOUT ANY WARRANTY; without even the implied warranty of
#! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#! GNU General Public License for more details.
#!
#! You should have received a copy of the GNU General Public License
#! along with OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
#!
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
text-decoration: none;
}
#header {
background-color:@!headerBackgroundColor!@;
margin:0;
padding:0.5em;
height:72px;
}
#logo {
height:64px;
float:left;
padding-right:1em;
}
#nav, #nav2 {
float:right;
}
#nav2 {
line-height: 115%;
}
#header h1 {
margin:0;
}
#modInfoTable td {
vertical-align: text-top;
padding-bottom: 0.5em;
}
body {
margin:0 auto;
width: 960px;
font-family: Verdana, sans-serif;
background-color:@!bodyBackgroundColor!@;
}
#page {
padding:0.5em;
}
#footer {
background-color:@!footerBackgroundColor!@;
width:100%;
font-size:smaller;
text-align:right;
padding:0.5em;
float:right;
}
a {
color:#000;
}
table {
border-collapse:collapse;
}
.tablesorter {
width:100%;
}
.tablesorter th {
text-align:left;
background-color:#ccc;
}
.tablesorter, .tablesorter th, .tablesorter td {
border: 1px solid #000;
}
.tablesorter thead tr .header {
background-image: url("@!url_for('resources', path='tablesorter/bg.gif')!@");
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
.tablesorter thead tr .headerSortUp {
background-image: url("@!url_for('resources', path='tablesorter/asc.gif')!@");
}
.tablesorter thead tr .headerSortDown {
background-image: url("@!url_for('resources', path='tablesorter/desc.gif')!@");
}
.odd {
background-color:#eee;
}
.align-left {
float:left;
}
.align-right {
float:right;
}
.figure {
padding: 0.5em;
}
$!pygmentsStyle!$
|