本文整理汇总了Python中pelican.generators.PagesGenerator.pages方法的典型用法代码示例。如果您正苦于以下问题:Python PagesGenerator.pages方法的具体用法?Python PagesGenerator.pages怎么用?Python PagesGenerator.pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pelican.generators.PagesGenerator
的用法示例。
在下文中一共展示了PagesGenerator.pages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_replace_delicious_tags
# 需要导入模块: from pelican.generators import PagesGenerator [as 别名]
# 或者: from pelican.generators.PagesGenerator import pages [as 别名]
def test_replace_delicious_tags(self):
settings = get_settings(filenames={})
settings['DEFAULT_CATEGORY'] = 'Default'
settings['DEFAULT_DATE'] = (1970, 1, 1)
settings['READERS'] = {'asc': None}
generator = PagesGenerator(
context=settings.copy(), settings=settings,
path="/tmp", theme=settings['THEME'], output_path=None)
generator.generate_context()
d = {'DELICIOUS_TEMPLATE': delicious_default_template,
'DELICIOUS_BOOKMARKS': set([self.b1, self.b2, self.b3])}
generator.context.update(d)
p1 = Page("a [delicious tag1] z")
e1 = """a <div class="delicious">
<dl>
<dt>Title</dt>
<dd>desc2</dd>
<dt>Description</dt>
<dd>ext2</dd>
<dt>URL</dt>
<dd><a href="url2">url2</a></dd>
</dl>
<dl>
<dt>Title</dt>
<dd>desc1</dd>
<dt>Description</dt>
<dd>ext1</dd>
<dt>URL</dt>
<dd><a href="url1">url1</a></dd>
</dl>
</div> z"""
p2 = Page("a [delicious tag1 tag2] z")
e2 = e1
p3 = Page("a [delicious tag3] z")
e3 = """a <div class="delicious">
<dl>
<dt>Title</dt>
<dd>desc3</dd>
<dt>Description</dt>
<dd>ext3</dd>
<dt>URL</dt>
<dd><a href="url3">url3</a></dd>
</dl>
</div> z"""
generator.pages = [p1, p2, p3]
replace_delicious_tags(generator)
self.assertEqual(generator.pages[0]._content, e1)
self.assertEqual(generator.pages[1]._content, e2)
self.assertEqual(generator.pages[2]._content, e3)