How to use pypandoc - 10 common examples

To help you get started, we’ve selected a few pypandoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bebraw / pypandoc / tests.py View on Github external
def test_get_pandoc_version(self):
        assert "HOME" in os.environ, "No HOME set, this will error..."
        version = pypandoc.get_pandoc_version()
        self.assertTrue(isinstance(version, pypandoc.string_types))
        major = int(version.split(".")[0])
        # according to http://pandoc.org/releases.html there were only two versions 0.x ...
        self.assertTrue(major in [0, 1, 2])
github hammerlab / seltest / setup.py View on Github external
from setuptools import setup, find_packages

try:
   import pypandoc
   description = pypandoc.convert('README.md', to='rst', format='md')
except (IOError, ImportError):
   description = ''


setup(name='seltest',
      version='1.0.1',
      description='A perceptual difference testing framework for writing the easiest, most comprehensive tests you can run.',
      long_description=description,
      author='Isaac Hodes',
      author_email='isaachodes@gmail.com',
      url='https://github.com/ihodes/seltest/',
      packages=['seltest'],
      include_package_data=True,
      install_requires=['selenium',
                        'docopt',
                        'Pillow',
github pytest-dev / pytest / scripts / publish-gh-release-notes.py View on Github external
def convert_rst_to_md(text):
    return pypandoc.convert_text(text, "md", format="rst")
github bebraw / pypandoc / tests.py View on Github external
def test_converts_valid_format(self):
        self.assertEqualExceptForNewlineEnd(pypandoc.convert_text("ok", format='md', to='rest'), 'ok')
github bebraw / pypandoc / tests.py View on Github external
def test_convert_with_custom_writer(self):
        lua_file_content = self.create_sample_lua()
        with closed_tempfile('.md', text='# title\n') as file_name:
            with closed_tempfile('.lua', text=lua_file_content, dir_name="foo-bar+baz",
                                 check_case=True) as lua_file_name:
                expected = u'<h1 id="title">title</h1>{0}'.format(os.linesep)
                received = pypandoc.convert_file(file_name, lua_file_name)
                self.assertEqualExceptForNewlineEnd(expected, received)
github bebraw / pypandoc / tests.py View on Github external
def test_basic_conversion_from_file_with_format(self):
        with closed_tempfile('.md', text='# some title\n') as file_name:
            expected = u'some title{0}=========={0}{0}'.format(os.linesep)
            received = pypandoc.convert_file(file_name, 'rst', format='md')
            self.assertEqualExceptForNewlineEnd(expected, received)

            received = pypandoc.convert_file(file_name, 'rst', format='md')
            self.assertEqualExceptForNewlineEnd(expected, received)
github bebraw / pypandoc / tests.py View on Github external
def test_basic_conversion_from_file(self):
        with closed_tempfile('.md', text='# some title\n') as file_name:
            expected = u'some title{0}=========={0}{0}'.format(os.linesep)
            received = pypandoc.convert_file(file_name, 'rst')
            self.assertEqualExceptForNewlineEnd(expected, received)
github podoc / podoc / podoc / testing.py View on Github external
def has_pandoc():  # pragma: no cover
    try:
        import pypandoc
        pypandoc.get_pandoc_version()
        return True
    except ImportError:
        logger.debug("pypandoc is not installed.")
    except FileNotFoundError:
        logger.debug("pandoc is not installed.")
    return False
github ajk8 / hatchery / tests / test_project.py View on Github external
def _pandoc_installed():
    try:
        pypandoc.get_pandoc_path()
    except OSError:
        return False
    return True
github bebraw / pypandoc / tests.py View on Github external
def test_get_pandoc_path(self):
        result = pypandoc.get_pandoc_path()
        assert "pandoc" in result