Module Web Rendering Pipeline
Here is a rough outline of the moving pieces that we use to render HTML for our modules:
- The default action for a ModuleView object is to call index_html() (Zope/Plone convetion, the python convention is __call__()). index_html() calls the defualt() method.
- ModuleView::default() calls self.module_render(). See RhaptosModuleStorage/ModuleView.py.
- module_render is not a member of the ModuleView class. Its source is located dynamically by acquisition.
- CNXPloneSite/skins/cnx_overrides/module_render.py
- Add the course parameters to kw[].
- source = context.module_export_template(**kw).
- kw['stylesheet'] = MODULE_XSL (which is content_render.xsl)
- body = context.cnxml_transform(source, **kw)
- CNXMLDocument/skins/CNXMLFile/cnxml_transform.py
- stylesheets = [stylesheet]
- parse the source: doc = XMLService.parseString(source)
- extract a list of document namespaces
- set sensible defaults for params['doctype'] and params['mimetype'] and ns (xhtml namespace)
- use browser specific logic to change the above three parameters so that MathML gets correctly displayed
- if MathML is not supported in the browser, add pmathmlcss.xs to stylesheets[].l
- RAINMAKER: result = XMLService.xsltPipeline(doc, stylesheets, **params)
- set the mimetype and charset for the REQUEST response header
- header = context.xmlheader(params['doctype'])
- return header+'\n'+result
CNXML plus module metadata will be transformed into HTML and placed into result. - RhaptosContent/www/content_render.xsl imports cnxml/style/cnxml_render.xsl.
TBD: The labor breakout bewteen content_render.xsl and cnxml_render.xsl. - cnxml/style/cnxml_render.xsl includes/imports
- CNXMLDocument/www/ident.xsl
- cnxml/style/cnxmll10n.xsl
- mathml2/style/cnxmathmlc2p.xsl (originally from Xerox circa 2001)
- bibtexml/style/bibtexml.xsl
- qml/style/qml.xsl
- cnxml/style/table.xsl
- cnxml/style/media.xsl
cnxmathmlc2p.xsl transforns Content-MathML into Presentation-MathML. The browsers, Firefox and IE with MathPlayer plugin, can display Presentation-MathML; all other browsers can not. No browser can display Content-MathML.
cnxmathmlc2p.xsl was made to run stand alone, but we only wanted one XSLT for converting CNXML, so we included it into our "master" XSLT instead of making it its own stage in the pipeline.
In addition to the HTML served to the browser for a module, other files are served as well.
Images are served from our site as well as others. Images with relative addresses in their links are server from our site with the module's context.
We serve CSS files, which include one for the browser (@media='screen') and one for browser print via Cntl-p (@media='print'). (As an aside hopefully users interested in printing their modules will print via our supplied PDF versus directly via the browser's Cntl-p.)
JavaScript files are also served.
Our web site is designed to support browsers which do not include JavaScript support. We set a cookie when JavaScript is supported, which is passed along with server requests. When rendering a module, some of the portlets surrounding the module content (CNXML) uses JavaScript if available. A reasonable default is substituted when JavaScript is not available.
To see what module_export_template produces, add 'module_export_template' to the URL, e.g.
http://cnx.org/content/m9004/latest/module_export_template

'default' calls 'module_render', a skin script, which is acquired, eventually, from the skins tool. A CNX site gets the over-ride one from CNXPloneSite, but a Rhaptos site will get the one from RhaptosSite.