Esempio n. 1
0
 def test_parse_cmdline_3(self):
     _, _, style_vars = parse_cmdline(
         ['--style-var=foo:bar', '--style-var=x:1', '--style-var=x:2'])
     self.assertTrue('foo' in style_vars)
     self.assertTrue('x' in style_vars)
     self.assertEqual(style_vars['foo'], 'bar')
     self.assertEqual(style_vars['x'], ['1', '2'])
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
0
 def test_parse_cmdline_1(self):
     _, _, style_vars = parse_cmdline(['--style-var=foo:bar'])
     self.assertTrue('foo' in style_vars)
     self.assertEqual(style_vars['foo'], 'bar')
Esempio n. 5
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)
Esempio n. 6
0
 def test_parse_cmdline_4(self):
     _, args, _ = parse_cmdline(['--style-var=foo:bar'])
     self.assertFalse(args)