跳转到主要内容

Grok源渲染器

项目描述

Grok源渲染器

首次尝试从Grok模板中提供zope.app.render类。

  • RestructuredText:扩展名为“.rst”的模板文件

    渲染完整的HTML页面,包括嵌入式样式表(默认)或可配置的外部样式表

安装

将“megrok.rendersource”添加到包“setup.py”中的“install_requires”列表。再次运行buildout。仅开发者模式下可提供模板重新加载:将“devmode on”添加到您的“buildout.cfg”中的“zope.conf =”行

配置

要配置与模板一起使用的样式表,请向您的视图类添加一个名为“namespace”的方法

class Overview(grok.View):

    def namespace(self):
        # compute the stylesheet path to the file inside the 'static' folder,
        # eg. 'grok.css'
        stylesheet=self.static['grok.css']()
        # enable absolut URL handling, disable embedding
        return {'settings_overrides': {'stylesheet': stylesheet,
                                       'stylesheet_path': None,
                                       'embed_stylesheet': 0,
                                       'input_encoding': 'utf-8',
                                       'output_encoding': 'utf-8',
                                       }}

可以添加到“settings_overrides”字典中的其他docutils相关选项。有关namespace方法的更多信息,请参阅grok_overview.txt。

变更

0.5.1 (2010-03-10)

  • 添加了长描述…

0.5 (2010-03-10)

  • 升级到grok版本1.1rc1

  • 将项目命名空间从d2m.rendersource更改为megrok.rendersource

支持者