Skip to content

Commit

Permalink
revise the makefile to generate proper docs with mdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrchen committed Nov 13, 2019
1 parent d6abf12 commit f1b198b
Show file tree
Hide file tree
Showing 11 changed files with 251 additions and 279 deletions.
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PANDOC=pandoc --lua-filter templates/pagebreak.lua -t html5 --mathjax --template=templates/github.wechat --tab-stop 2 --highlight-style pygments --standalone --section-divs

MDOC=mdoc

TRANSFORM=tools/transform.js
GEN_SUMMARY=tools/gen_summary.js

Expand Down Expand Up @@ -33,12 +35,11 @@ show:

install:
@echo "Install software required for this repo..."
@brew install pandoc
@mix local.rebar --force
@npm install -g chrome-headless-render-pdf

dep:
@echo "Install dependencies required for this repo..."
@npm install -g chrome-headless-render-pdf
@yarn

pre-build: dep
@echo "Running scripts before the build..."
Expand Down Expand Up @@ -81,7 +82,7 @@ run:
@http-server $(OUTPUT) -p 8000 -c-1

$(BOOK_HTML):$(PUB_RDOCS)
@$(PANDOC) $(PUB_RDOCS) -o $(BOOK_HTML)
@$(MDOC) $(PUB_RDOCS) -o $(BOOK_HTML)

$(DIRECTORIES):$(OUTPUT)/%:$(SRC)

Expand All @@ -91,11 +92,11 @@ $(RDOCS):$(OUTPUT)/%.md:$(SRC)/%.md

$(HTMLS):$(OUTPUT)/%.html:$(SRC)/%.md
@echo "Creating doc $@ with file $<."
-@$(PANDOC) $< -o $@
-@$(MDOC) $< -o $@

$(RESOURCES):$(OUTPUT)/%.html:$(RES)/%.md
@echo "Creating doc $@ with file $<."
-@$(PANDOC) $< -o $@
-@$(MDOC) $< -o $@

gen-summary: $(PUB_DOCS)
@echo "Creating summary page"
Expand Down
227 changes: 0 additions & 227 deletions package-lock.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/0-intro-pub.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: '序言'
title: "序言"
author: [程序君]
keywords: [intro]
---
Expand All @@ -19,6 +19,6 @@ keywords: [intro]

![](cover.jpg)

\newpage
<div class="page-break" />

# 前言
1 change: 0 additions & 1 deletion src/1-summary-pub.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ title: '目录'
- [Wireguard:简约之美](2019/w45/1-wireguard-pub.html)
- [长日无痕(5): 天叔奇谈](2019/w45/2-no-title-5-pub.html)

\newpage
6 changes: 3 additions & 3 deletions src/2019/w45/1-wireguard-pub.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ keywords: [tech, security, wireguard]
WG 仅有 4k 的内核代码实现!精巧得简直不能再精巧!虽然这么说有些不敬,但对比下来,仿佛 OpenVPN 或者 StrongSwan 是按行收费的印度外包公司的产品,而 WG 是真正的程序员的杰作!Linus 本尊对 WG 赞不绝口,他在 18 年 8 月 2 日的 [一封邮件](https://lists.openwall.net/netdev/2018/08/02/124) 这么写到:

> Btw, on an unrelated issue: I see that Jason actually made the pull request to have wireguard included in the kernel.
>
>
> Can I just once again state my love for it and hope it gets merged soon? Maybe the code isn't perfect, but I've skimmed it, and compared to the horrors that are OpenVPN and IPSec, it's a work of art.
>
>
> Linus
要知道,Linus 平日来评论代码的画风是这样的(Mauro 是一个 Kernel maintainer):

> "It's a bug alright -- in the kernel. How long have you been a maintainer? And you _still_ haven't learnt the first rule of kernel maintenance?
>
>
> "Shut up, Mauro. And I don't _ever_ want to hear that kind of obvious garbage and idiocy from a kernel maintainer again. Seriously.
所以能让 Linus "state my love" 比登天还难。所以让我们怀着朝圣的心情,跪着学习 WG 是怎么做到的 —— 这样做产品写代码的思路值得我们潜心研习!
Expand Down
8 changes: 0 additions & 8 deletions src/2019/w45/2-no-title-5-pub.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,14 @@ keywords: [life, study]

在这个过程中,我渐渐发现,按照年龄划分数学学习的内容可能是不明智的,各种数学方法之间是连续的,不是断代的 —— 我们没法谈算术的时候就完全不碰数论,讲几何的时候不涉及代数,讲初等代数的时候刨除排列组合,讲任何话题的时候避开微积分。数学课堂上的小心翼翼是不必要的,代数放在初中教授,微积分放在高中和大学学习,并不意味着代数和微积分的思想就不能出现在一个小孩子的头脑里。



## 贤者时刻

> It is not worth an intelligent man's time to be in the majority. By definition, there are already enough people to do that.
>
> - G. H. Hardy


有天周六,小宝上完溜冰课,妈妈带她来我公司休息,准备参加半小时之后的在我公司附近的舞蹈课。在我办公室的白板上,小宝画了一个数轴:

![](assets/lnumber.jpg)

她说:爸爸,你看,这是一个数轴。$\sqrt{2}$ 在这里,π 在这里,我要发明一个数叫 Lindsey,我告诉你它的值:6.5657,你要把这个数记好,因为它跟 π 一样重要。




4 changes: 0 additions & 4 deletions src/2019/w46/1-noise-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ Noise Protocol Framework(以下简称 Noise)是一个用于构建安全协

诸君也许会问:既然有了 TLS,我们为何还需要创建自己的安全协议?

```mermaid
```

```
START <----+
Send ClientHello | | Recv HelloRetryRequest
Expand Down
4 changes: 1 addition & 3 deletions templates/new.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title:
cover: 'assets/.jpg'
cover: "assets/.jpg"
header-includes: |
\usepackage{fancyhdr}
\pagestyle{fancy}
Expand All @@ -13,5 +13,3 @@ keywords: []
---

## 贤者时刻

\newpage

0 comments on commit f1b198b

Please sign in to comment.