$def with (app)
$# , understory_version, applications)
$var title: System
$app.name
$# Theme
$#
Routes
$def render_parent_controllers(location, controllers):
$for route, controller in controllers:
-
$ parts = re.split(r"\(\?P<(.+?)>(.+?)\)", route)
$if len(parts) == 1:
/$controller.__web__[0]
$else:
/$controller.__web__[0]
$ project_mod = "/".join(controller.handler.__module__.split("."))
$ project = getsourcefile(controller.handler).removeprefix(str(tx.host.working_dir)).lstrip("/").partition("/")[0]
$controller.handler.__name__
$:render_parent_controllers("before", app.controllers)
$for prefix, subapp in sorted(app.mounts):
$if subapp.controllers:
-
$if len(subapp.controllers) > 1:
/$prefix
$ root = subapp.controllers[0]
$if root[0] == "":
$ project_mod = "/".join(root[1].handler.__module__.split("."))
$ project = getsourcefile(root[1].handler).removeprefix(str(tx.host.working_dir)).lstrip("/").partition("/")[0]
$root[1].handler.__name__
$:str(mkdn((root[1].__doc__.strip() + "\n").splitlines()[0])).removeprefix("").removesuffix("
")
$if len(subapp.controllers) > 1:
$for route, controller in subapp.controllers[1:]:
$ parts = re.split(r"\(\?P<(.+?)>(.+?)\)", route)
- \
$if len(parts) == 1:
$if parts[0]:
/$parts[0]\
$else:
/\
$for a, b, c in zip(parts[0::3], parts[1::3], parts[2::3]):
$:a.replace("(", '')\
{$b}\
$:parts[-1].replace(")?", "")
$ project_mod = "/".join(controller.handler.__module__.split("."))
$ project = getsourcefile(controller.handler).removeprefix(str(tx.host.working_dir)).lstrip("/").partition("/")[0]
$controller.handler.__name__
$:str(mkdn((controller.__doc__.strip() + "\n").splitlines()[0])).removeprefix("").removesuffix("
")
$:render_parent_controllers("after", app.after_controllers)
Wrappers
$for wrapper in app.wrappers:
- $wrapper.__name__
$wrapper.__module__
$def aside():
$#
$#
$# $for application in applications:
$# - $application.project_name
$# $application.version
$#
$#
$var aside = aside
$# XXX
$# XXX $for prefix, subapp in app.mounts:
$# XXX $if subapp.wrappers:
$# XXX $for wrapper in subapp.wrappers:
$# XXX - $wrapper
$# XXX