示例#1
0
 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')
示例#2
0
 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'})
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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')
示例#6
0
 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)