本文整理汇总了Python中markdown.__main__.parse_options函数的典型用法代码示例。如果您正苦于以下问题:Python parse_options函数的具体用法?Python parse_options怎么用?Python parse_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMultipleExtensionOptions
def testMultipleExtensionOptions(self):
options, logging_level = parse_options([
'-x', 'markdown.extensions.footnotes',
'-x', 'markdown.extensions.smarty'
])
self.default_options['extensions'] = [
'markdown.extensions.footnotes',
'markdown.extensions.smarty'
]
self.assertEqual(options, self.default_options)
示例2: textBoolExtensionConfigOption
def textBoolExtensionConfigOption(self):
config = {
'markdown.extensions.toc': {
'title': 'Some Title',
'anchorlink': True,
'permalink': True
}
}
self.create_config_file(config)
options, logging_level = parse_options(['-c', self.tempfile])
self.default_options['extension_configs'] = config
self.assertEqual(options, self.default_options)
示例3: testExtensionConfigOption
def testExtensionConfigOption(self):
config = {
'markdown.extensions.wikilinks': {
'base_url': 'http://example.com/',
'end_url': '.html',
'html_class': 'test',
},
'markdown.extensions.footnotes:FootnotesExtension': {
'PLACE_MARKER': '~~~footnotes~~~'
}
}
self.create_config_file(config)
options, logging_level = parse_options(['-c', self.tempfile])
self.default_options['extension_configs'] = config
self.assertEqual(options, self.default_options)
示例4: testExtensonConfigOptionAsJSON
def testExtensonConfigOptionAsJSON(self):
config = {
'wikilinks': {
'base_url': 'http://example.com/',
'end_url': '.html',
'html_class': 'test',
},
'footnotes': {
'PLACE_MARKER': '~~~footnotes~~~'
}
}
import json
self.create_config_file(json.dumps(config))
options, logging_level = parse_options(['-c', self.tempfile])
self.default_options['extension_configs'] = config
self.assertEqual(options, self.default_options)
示例5: testNoLazyOlOption
def testNoLazyOlOption(self):
options, logging_level = parse_options(['-n'])
self.default_options['lazy_ol'] = False
self.assertEqual(options, self.default_options)
示例6: testOutputFormatOption
def testOutputFormatOption(self):
options, logging_level = parse_options(['-o', 'html5'])
self.default_options['output_format'] = 'html5'
self.assertEqual(options, self.default_options)
示例7: testSafeModeOption
def testSafeModeOption(self):
options, logging_level = parse_options(['-s', 'escape'])
self.default_options['safe_mode'] = 'escape'
self.assertEqual(options, self.default_options)
示例8: testEncodingOption
def testEncodingOption(self):
options, logging_level = parse_options(['-e', 'utf-8'])
self.default_options['encoding'] = 'utf-8'
self.assertEqual(options, self.default_options)
示例9: testInputAndOutputFileOptions
def testInputAndOutputFileOptions(self):
options, logging_level = parse_options(['-f', 'foo.html', 'foo.txt'])
self.default_options['output'] = 'foo.html'
self.default_options['input'] = 'foo.txt'
self.assertEqual(options, self.default_options)
示例10: testInputFileOption
def testInputFileOption(self):
options, logging_level = parse_options(['foo.txt'])
self.default_options['input'] = 'foo.txt'
self.assertEqual(options, self.default_options)
示例11: testNoisyOption
def testNoisyOption(self):
options, logging_level = parse_options(['--noisy'])
self.assertEqual(logging_level, DEBUG)
示例12: testVerboseOption
def testVerboseOption(self):
options, logging_level = parse_options(['-v'])
self.assertEqual(logging_level, WARNING)
示例13: testQuietOption
def testQuietOption(self):
options, logging_level = parse_options(['-q'])
self.assertTrue(logging_level > CRITICAL)
示例14: testNoOptions
def testNoOptions(self):
options, logging_level = parse_options([])
self.assertEqual(options, self.default_options)
self.assertEqual(logging_level, CRITICAL)
示例15: testExtensionOption
def testExtensionOption(self):
options, logging_level = parse_options(['-x', 'footnotes'])
self.default_options['extensions'] = ['footnotes']
self.assertEqual(options, self.default_options)