def test_panache_styles_update_1(self): panache_styles = PanacheStyles({}) panache_styles.load(resource_dir) input_yaml = get_input_yaml(sample_markdown_file, {}) style_name = 'html' style = PanacheStyle(style_name, input_yaml[STYLEDEF_][style_name], sample_markdown_file) panache_styles.update(style) self.assertEqual(panache_styles.styles[style_name].metadata['lang'], 'ru')
def test_panache_styles_resolve_1(self): panache_styles = PanacheStyles({}) panache_styles.load(resource_dir) input_yaml = get_input_yaml(sample_markdown_file, {}) style_name = 'html' style = PanacheStyle(style_name, input_yaml[STYLEDEF_][style_name], sample_markdown_file) panache_styles.update(style) result = panache_styles.resolve(style_name) self.assertEqual(result[COMMANDLINE_], {'toc': True}) self.assertEqual(result[FILTER_], []) self.assertEqual(result[METADATA_], {'lang': 'ru'})
def testcompile_command_line_1(self): options, args, _ = parse_cmdline([]) panache_styles = PanacheStyles({}) panache_styles.load(resource_dir) input_yaml = get_input_yaml(sample_markdown_file, {}) style_name = 'html' style = PanacheStyle(style_name, input_yaml[STYLEDEF_][style_name], sample_markdown_file) panache_styles.update(style) parameters = panache_styles.resolve(style_name) result = compile_command_line(sample_markdown_file, 'foo/metadata', parameters, options, args) expected = ['pandoc', sample_markdown_file, 'foo/metadata', '--toc'] self.assertEqual(result, expected)
def testcompile_command_line_2(self): options, args, style_vars = parse_cmdline( ['--style-dir=%s' % resource_dir, '--medium=wiki']) panache_styles = PanacheStyles(style_vars) panache_styles.load(options.style_dir) input_yaml = get_input_yaml(sample_markdown_file, {}) style_name = determine_style(options, input_yaml) self.assertEqual(style_name, 'wikihtml') parameters = panache_styles.resolve(style_name) result = compile_command_line(sample_markdown_file, 'foo/metadata', parameters, options, args) expected = { 'pandoc', sample_markdown_file, 'foo/metadata', '--toc', '--toc-depth=3', '--number-sections', '--highlight-style=tango', '--html-q-tags', '--smart', '--template=%s/template-html.html' % resource_dir } self.assertEqual(set(result), expected)
def test_get_yaml_1(self): result = get_input_yaml(sample_markdown_file, {}) self.assertTrue(result) self.assertTrue(STYLES_ in result) self.assertTrue('wiki' in result[STYLES_]) self.assertEqual(result[STYLES_]['wiki'], 'wikihtml')
def test_determine_style_3(self): options, _, _ = parse_cmdline(['--medium=pdf']) data = get_input_yaml(sample_markdown_file, {}) result = determine_style(options, data) expected = None self.assertEqual(result, expected)