本文整理汇总了Python中mkdocs.build.post_process_html函数的典型用法代码示例。如果您正苦于以下问题:Python post_process_html函数的具体用法?Python post_process_html怎么用?Python post_process_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了post_process_html函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_not_use_directory_urls
def test_not_use_directory_urls(self):
md_text = 'An [internal link](internal.md) to another document.'
expected = '<p>An <a href="internal/index.html">internal link</a> to another document.</p>'
pages = [
('internal.md',)
]
site_navigation = nav.SiteNavigation(pages, use_directory_urls=False)
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html, site_navigation)
self.assertEqual(html.strip(), expected.strip())
开发者ID:alihalabyah,项目名称:mkdocs,代码行数:10,代码来源:test.py
示例2: test_anchor_only_link
def test_anchor_only_link(self):
pages = [
('index.md',),
('internal.md',),
('sub/internal.md')
]
site_navigation = nav.SiteNavigation(pages)
for page in site_navigation.walk_pages():
html = '<p><a href="#test"> </a></p>'
result = build.post_process_html(html, site_navigation)
self.assertEqual(result, html)
开发者ID:Flyclops,项目名称:mkdocs,代码行数:14,代码来源:test.py
示例3: test_convert_internal_media
def test_convert_internal_media(self):
pages = [
('index.md',),
('internal.md',),
('sub/internal.md')
]
site_navigation = nav.SiteNavigation(pages)
expected_results = (
'<p><img alt="The initial MkDocs layout" src="./img/initial-layout.png" /></p>',
'<p><img alt="The initial MkDocs layout" src="../img/initial-layout.png" /></p>',
'<p><img alt="The initial MkDocs layout" src="../../img/initial-layout.png" /></p>',
)
for (page, expected) in zip(site_navigation.walk_pages(), expected_results):
html = '<p><img alt="The initial MkDocs layout" src="img/initial-layout.png" /></p>'
html = build.post_process_html(html, site_navigation)
self.assertEqual(html, expected)
开发者ID:alihalabyah,项目名称:mkdocs,代码行数:19,代码来源:test.py
示例4: test_ignore_external_link
def test_ignore_external_link(self):
md_text = 'An [external link](http://example.com/external.md).'
expected = '<p>An <a href="http://example.com/external.md">external link</a>.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())
开发者ID:alihalabyah,项目名称:mkdocs,代码行数:6,代码来源:test.py
示例5: test_convert_internal_link_with_anchor
def test_convert_internal_link_with_anchor(self):
md_text = 'An [internal link](internal.md#section1.1) to another document.'
expected = '<p>An <a href="internal/#section1.1">internal link</a> to another document.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())
开发者ID:alihalabyah,项目名称:mkdocs,代码行数:6,代码来源:test.py
示例6: test_convert_internal_link_differing_directory
def test_convert_internal_link_differing_directory(self):
md_text = 'An [internal link](../internal.md) to another document.'
expected = '<p>An <a href="../internal/">internal link</a> to another document.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())
开发者ID:alihalabyah,项目名称:mkdocs,代码行数:6,代码来源:test.py
示例7: test_convert_multiple_internal_links
def test_convert_multiple_internal_links(self):
md_text = '[First link](first.md) [second link](second.md).'
expected = '<p><a href="first/">First link</a> <a href="second/">second link</a>.</p>'
html, toc, meta = build.convert_markdown(md_text)
html = build.post_process_html(html)
self.assertEqual(html.strip(), expected.strip())
开发者ID:alihalabyah,项目名称:mkdocs,代码行数:6,代码来源:test.py
注:本文中的mkdocs.build.post_process_html函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论