sairate 4108f6c42d docs(book): 添加现代 C++教程及相关代码
- 新增现代 C++ 教程的 Preface 章节,包括英文和中文版本
- 添加 C++ Primer 练习代码
- 新增 Learn C++ 教程的 C++ 开发简介章节
- 添加头文件解析文档
- 更新 mkdocs.yml,包含新教程的目录结构
- 修改项目设置,使用 Python 3.10环境
2025-07-06 16:14:43 +08:00

27 lines
951 B
Python

# !/usr/bin/env python3
# author: changkun<hi[at]changkun.de>
import os, io
chapters = ['00-preface.md', '01-intro.md', '02-usability.md', '03-runtime.md', '04-containers.md', '05-pointers.md', '06-regex.md', '07-thread.md', '08-filesystem.md', '09-others.md', '10-cpp20.md', 'appendix1.md', 'appendix2.md']
ignores = ['TOC', '返回目录', '许可', 'license']
head = """---
title: "现代 C++ 教程:高速上手 C++11/14/17/20"
author: 欧长坤 <hi[at]changkun.de>
copyright: cc-by-nc-nd 4.0
---
"""
with io.open('modern-cpp-tutorial.md', 'w', encoding='utf8') as outfile:
outfile.write(head)
for chapter in chapters:
if os.path.isfile(chapter):
with open(chapter) as ch:
outfile.write('\n')
for line in ch:
if any(keyword in line for keyword in ignores):
continue
else:
outfile.write(line)