How to use the pandoc.core function in pandoc

To help you get started, weโ€™ve selected a few pandoc 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 jpadilla / mandrill-inbound-python / setup.py View on Github external
# -*- coding: utf-8 -*

import os
from setuptools import setup, find_packages

readme_md = os.path.join(os.path.dirname(__file__), 'README.md')

try:
    import pandoc
    pandoc.core.PANDOC_PATH = '/usr/local/bin/pandoc'
    doc = pandoc.Document()
    doc.markdown = open(readme_md).read()
    long_description = doc.rst
except (IOError, ImportError):
    long_description = open(readme_md).read()

setup(
    name='python-mandrill-inbound',
    version='0.0.4',
    packages=find_packages(),
    author='Josรฉ Padilla',
    author_email='jpadilla@webapplicate.com',
    description='Python wrapper for Mandrill Inbound',
    long_description=long_description,
    license='MIT License',
    url='https://github.com/jpadilla/mandrill-inbound-python',
github rhiever / TwitterFollowBot / setup.py View on Github external
def get_long_description():
    readme_file = 'README.md'
    if not os.path.isfile(readme_file):
        return ''
    # Try to transform the README from Markdown to reStructuredText.
    try:
        easy_install.main(['-U', 'pyandoc==0.0.1'])
        import pandoc
        pandoc.core.PANDOC_PATH = 'pandoc'
        doc = pandoc.Document()
        doc.markdown = open(readme_file).read()
        description = doc.rst
    except Exception:
        description = open(readme_file).read()
    return description
github fangpenlin / gluttony / gen_rst.py View on Github external
import os
import re

import pandoc

pandoc.core.PANDOC_PATH = os.environ['PANDOC_PATH']

doc = pandoc.Document()
with open('README.md', 'rt') as md:
    doc.markdown = md.read()
    with open('README.txt', 'wt') as rst:
        rst_txt = doc.rst
        rst_txt = rst_txt.replace('\r\n', '\n')
        rst_txt = re.sub(r':alt: (.*)\n(\s+)(.*)', r':alt: \1\n', rst_txt)
        rst.write(rst_txt)

print 'done'
github astrorafael / twisted-mqtt / setup.py View on Github external
try:
    import subprocess
    import pandoc
 
    process = subprocess.Popen(
        ['which pandoc'],
        shell=True,
        stdout=subprocess.PIPE,
        universal_newlines=True
    )
 
    pandoc_path = process.communicate()[0]
    pandoc_path = pandoc_path.strip('\n')
 
    pandoc.core.PANDOC_PATH = pandoc_path
 
    doc = pandoc.Document()
    doc.markdown = long_description
 
    long_description = doc.rst
 
except:
    pass
   


classifiers = [
    'Intended Audience :: Developers',
    'License :: OSI Approved :: MIT License',
    'Programming Language :: Python :: 2.7',
    'Programming Language :: Python :: 3.4',
github MSeal / agglom_cluster / setup.py View on Github external
def pandoc_read_md(fname):
    if 'PANDOC_PATH' not in os.environ:
        raise ImportError("No pandoc path to use")
    import pandoc
    pandoc.core.PANDOC_PATH = os.environ['PANDOC_PATH']
    doc = pandoc.Document()
    doc.markdown = read(fname)
    return doc.rst
github csu / pyquora / gen_rst_readme.py View on Github external
import pandoc
import os
import re

pandoc.core.PANDOC_PATH = '/usr/bin/pandoc'

def convert_md_to_rst():
    doc = pandoc.Document()
    doc.markdown = open('README.md').read()

    filtered = str(doc.rst)
    filtered = re.sub('Table of Contents\n~~~~~~~~~~~~~~~~~.*Installation\n------------', 'Installation\n------------', filtered, flags=re.DOTALL)
    filtered = re.sub('\n`\|Build Status\| `_ `\|Latest\nVersion\| `_\n', '', filtered, flags=re.DOTALL)
    filtered = re.sub('`\|Gitter\|.*>`_', '', filtered, flags=re.DOTALL)
    filtered = re.sub('`\|HuBoard\|.*`_', '', filtered, flags=re.DOTALL)
    filtered = re.sub('Contribute\n----------.*', '', filtered, flags=re.DOTALL)

    f = open('README', 'w+')
    f.write(filtered)
    f.close()
github quantopian / qdb / setup.py View on Github external
LONG_DESCRIPTION = None
README_MARKDOWN = None

with open('README.md') as markdown_source:
    README_MARKDOWN = markdown_source.read()

if 'upload' in sys.argv:
    # Converts the README.md file to ReST, since PyPI uses ReST for formatting,
    # This allows to have one canonical README file, being the README.md
    # The conversion only needs to be done on upload.
    # Otherwise, the pandoc import and errors that are thrown when
    # pandoc are both overhead and a source of confusion for general
    # usage/installation.
    import pandoc
    pandoc.core.PANDOC_PATH = 'pandoc'
    doc = pandoc.Document()
    doc.markdown = README_MARKDOWN
    LONG_DESCRIPTION = doc.rst
else:
    # If pandoc isn't installed, e.g. when downloading from pip,
    # just use the regular README.
    LONG_DESCRIPTION = README_MARKDOWN

setup(
    name='qdb',
    version='0.1.0',
    description='Quantopian Remote Debugger for Python',
    author='Quantopian Inc.',
    author_email='opensource@quantopian.com',
    packages=find_packages(),
    scripts=['client/qdb-cli'],
github cwacek / python-jsonschema-objects / register.py View on Github external
def markdown_to_rst(src):
    pandoc.core.PANDOC_PATH = "/usr/local/bin/pandoc"
    if not os.path.exists(pandoc.core.PANDOC_PATH):
        raise Exception("Pandoc not available")

    doc = pandoc.Document()
    doc.markdown = open("README.md").read()
    return doc.rst
github digidotcom / epoxy / setup.py View on Github external
def get_long_description():
    long_description = open('README.md').read()
    try:
        import subprocess
        import pandoc

        process = subprocess.Popen(
            ['which pandoc'],
            shell=True,
            stdout=subprocess.PIPE,
            universal_newlines=True)

        pandoc_path = process.communicate()[0]
        pandoc_path = pandoc_path.strip('\n')

        pandoc.core.PANDOC_PATH = pandoc_path

        doc = pandoc.Document()
        doc.markdown = long_description
        long_description = doc.rst
    except:
        print("Could not find pandoc or convert properly")
        print("  make sure you have pandoc (system) and pyandoc (python module) installed")

    return long_description
github digidotcom / python-devicecloud / setup.py View on Github external
def get_long_description():
    long_description = open('README.md').read()
    try:
        import subprocess
        import pandoc

        process = subprocess.Popen(
            ['which pandoc'],
            shell=True,
            stdout=subprocess.PIPE,
            universal_newlines=True)

        pandoc_path = process.communicate()[0]
        pandoc_path = pandoc_path.strip('\n')

        pandoc.core.PANDOC_PATH = pandoc_path

        doc = pandoc.Document()
        doc.markdown = long_description
        long_description = doc.rst
        open("README.rst", "w").write(doc.rst)
    except:
        if os.path.exists("README.rst"):
            long_description = open("README.rst").read()
        else:
            print("Could not find pandoc or convert properly")
            print("  make sure you have pandoc (system) and pyandoc (python module) installed")

    return long_description

pandoc

Pandoc Documents for Python

MIT
Latest version published 1 year ago

Package Health Score

53 / 100
Full package analysis