forked from changkun/modern-cpp-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve changkun#6, 使用 Pandoc 根据 Markdown 生成 PDF
- Loading branch information
Showing
18 changed files
with
331 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 第三章 语言运行期的强化 | ||
# 第 3 章 语言运行期的强化 | ||
|
||
> 内容修订中 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 第四章 对标准库的扩充:新增容器 | ||
# 第 4 章 对标准库的扩充:新增容器 | ||
|
||
> 内容修订中 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 第五章 对标准库的扩充:引用计数与智能指针 | ||
# 第 5 章 对标准库的扩充:引用计数与智能指针 | ||
|
||
> 内容修订中 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# 第八章 标准库: 文件系统 | ||
# 第 8 章 标准库: 文件系统 | ||
|
||
> TODO: 这部分内容为 C++17 新增 | ||
> TODO: 这部分内容为 C++17 新增 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 第九章 其他杂项 | ||
# 第 9 章 其他杂项 | ||
|
||
> 内容修订中 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 第九章 展望: C++20 简介 | ||
# 第 10 章 展望: C++20 简介 | ||
|
||
> 内容修订中, 目前内容为第一版中对 C++17 的展望 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
title = '高速上手 C++11/14/17' | ||
filename = 'modern-cpp-tutorial' | ||
outputname='modern-cpp-tutorial' | ||
|
||
all: pdf | ||
|
||
pdf: markdown | ||
@echo "Compiling PDF file..." | ||
@pandoc -s $(filename).md -o $(filename).pdf \ | ||
--title-prefix $(title) \ | ||
--listings -H meta/cpp-listings.tex \ | ||
--template=meta/template.tex \ | ||
--normalize \ | ||
--smart \ | ||
--latex-engine=`which xelatex` | ||
@echo "Done." | ||
@rm *.md | ||
|
||
markdown: | ||
@echo "Copy markdown files..." | ||
@cp -r ../book/* . | ||
@echo "Aggregating markdown files..." | ||
@python3 aggregator.py | ||
|
||
clean: | ||
rm -rf *.md *.pdf | ||
|
||
.PHONY: markdown pdf clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# !/usr/bin/env python3 | ||
# author: changkun<hi@changkun.us> | ||
|
||
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', 'appendix.md'] | ||
|
||
ignores = ['TOC', '返回目录', '许可', 'license'] | ||
|
||
with open('modern-cpp-tutorial.md', 'w') as outfile: | ||
outfile.write("""--- | ||
title: "高速上手 C++11/14/17" | ||
author: 欧长坤 <hi@changkun.us> | ||
copyright: cc-by-nc-nd 4.0 | ||
--- | ||
""") | ||
for chapter in chapters: | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
\usepackage{xcolor} | ||
|
||
\definecolor{keyword}{HTML}{BA2CA3} | ||
\definecolor{string}{HTML}{D12F1B} | ||
\definecolor{comment}{HTML}{008400} | ||
|
||
\lstset{ | ||
basicstyle={\small\ttfamily}, | ||
keywordstyle={\color[rgb]{0.13,0.29,0.53}\bfseries}, | ||
breaklines=true, | ||
emphstyle={\bfseries\color{Rhodamine}}, | ||
commentstyle={\color[rgb]{0.56,0.35,0.01}\itshape}, | ||
stringstyle={\color[rgb]{0.31,0.60,0.02}}, | ||
showstringspaces=false, | ||
frame=shadowbox, | ||
breakatwhitespace=false, | ||
captionpos=b, | ||
extendedchars=true, | ||
keepspaces=true, | ||
numbers=left, | ||
numberstyle=\tiny, | ||
rulecolor=\color{black}, | ||
rulesepcolor={\color{blue!20!white}}, | ||
showspaces=false, | ||
} |
Oops, something went wrong.