当前位置: 首页>>代码示例>>Python>>正文


Python pandoc.Document方法代码示例

本文整理汇总了Python中pandoc.Document方法的典型用法代码示例。如果您正苦于以下问题:Python pandoc.Document方法的具体用法?Python pandoc.Document怎么用?Python pandoc.Document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandoc的用法示例。


在下文中一共展示了pandoc.Document方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_long_description

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
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 
开发者ID:digidotcom,项目名称:epoxy,代码行数:27,代码来源:setup.py

示例2: md_to_rst

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
def md_to_rst(md):
    import six
    import pandoc

    # pandoc.core.PANDOC_PATH = '/path/to/pandoc'

    if isinstance(md, six.text_type):
        md = md.encode('utf-8')

    doc = pandoc.Document()
    doc.markdown = md
    result = doc.rst
    if isinstance(result, bytes):
        result = result.decode('utf-8')
    return result 
开发者ID:hassa,项目名称:BeatCop,代码行数:17,代码来源:register.py

示例3: get_long_description

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
def get_long_description():
    long_description = open('README.md').read()
    try:
        import subprocess
        import pandoc
        doc = pandoc.Document()
        doc.markdown = long_description.encode('utf-8')
        open("README.rst", "wb").write(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 
开发者ID:digidotcom,项目名称:python-devicecloud,代码行数:15,代码来源:setup.py

示例4: get_long_description

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
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 
开发者ID:digidotcom,项目名称:python-suitcase,代码行数:31,代码来源:setup.py

示例5: get_description

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
def get_description():
    with open('README.md') as f:
        desc = f.read()
    short = desc.split('===\n')[1].strip().split('\n')[0]
    if pandoc:
        doc = pandoc.Document()
        doc.markdown = desc.encode('utf-8')
        desc = doc.rst.decode('utf-8')
    return short, desc 
开发者ID:imbolc,项目名称:aiohttp-login,代码行数:11,代码来源:setup.py

示例6: markdown_to_rst

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
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 
开发者ID:cwacek,项目名称:python-jsonschema-objects,代码行数:10,代码来源:register.py

示例7: include_readme

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
def include_readme():
    try:
        import pandoc
    except ImportError:
        return ''
    pandoc.core.PANDOC_PATH = find_executable('pandoc')
    readme_file = os.path.join(os.path.dirname(__file__), 'README.md')
    doc = pandoc.Document()
    with open(readme_file, 'r') as rf:
        doc.markdown = rf.read()
        return doc.rst 
开发者ID:merll,项目名称:docker-fabric,代码行数:13,代码来源:setup.py

示例8: include_readme

# 需要导入模块: import pandoc [as 别名]
# 或者: from pandoc import Document [as 别名]
def include_readme():
    try:
        import pandoc
    except ImportError:
        return b''
    pandoc.core.PANDOC_PATH = find_executable('pandoc')
    readme_file = os.path.join(os.path.dirname(__file__), 'README.md')
    doc = pandoc.Document()
    with open(readme_file, 'r') as rf:
        doc.markdown = rf.read()
        return doc.rst.decode('utf-8') 
开发者ID:merll,项目名称:docker-map,代码行数:13,代码来源:setup.py


注:本文中的pandoc.Document方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。