當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。