⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scanrst.py

📁 C++的一个好库。。。现在很流行
💻 PY
字号:
# Copyright David Abrahams 2004. Use, modification and distribution is
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

# This script accepts a list of .rst files to be processed and
# generates Makefile dependencies for .html and .rst files to stdout.
import os,sys
import re

include = re.compile(r' *\.\. +(include|image):: +(.*)', re.MULTILINE)

def deps(path, found):
    dir = os.path.split(path)[0]
    for m in re.findall(include, open(path).read()):

        dependency = os.path.normpath(os.path.join(dir,m[1]))
        if dependency not in found:
            found[dependency] = 1

            if m[0] == 'include':
                deps(dependency, found)
                
    return found
                
for file in sys.argv[1:]:
    found = deps(file, {})
    if found:
        base = os.path.splitext(os.path.basename(file))[0]
        print '%s.tex %s.html: %s' % (base, base, ' '.join(found.keys()))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -