Skip to content

Commit f6b65e7

Browse files
committed
Setting up generation of documentation files
1 parent f93a05f commit f6b65e7

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

doc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/**

doc/01_index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Building an API server with expressjs
2+
This document provides an introduction on how to build an (RESTful) API server with Node.js and expressjs.
3+

doc/Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.PHONY: all
2+
all: clean simple
3+
4+
pretty: merge
5+
grip dist/doc.md --export dist/doc.html
6+
rm dist/*.md
7+
8+
simple: merge
9+
pandoc dist/doc.md -s -o dist/doc.html
10+
11+
merge: dist toc
12+
pandoc dist/*.md -o dist/doc.md
13+
rm dist/0*.md
14+
dist:
15+
mkdir dist
16+
cp 0*.md dist
17+
18+
toc: headings references
19+
paste -d '' dist/headings.md dist/references.md >> dist/01_index.md
20+
rm dist/headings.md
21+
rm dist/references.md
22+
23+
headings:
24+
cat 0*.md | grep -v "#\!" | grep -e "\s#\|^#" | sed -E "s/#/ /g" | sed -e 's/ //' |perl -pe 's|(\w[\w ]+)|\* [\1\]|' > dist/headings.md
25+
26+
references:
27+
cat 0*.md | grep -v "#\!" | grep -e "\s#\|^#" | sed s/#//g | awk '{$$1=$$1};1' | tr '[:upper:]' '[:lower:]' | sed -e "s/\s/-/g" | sed -e "s/\(.*\)/\(#\1\)/" > dist/references.md
28+
29+
clean:
30+
rm -rf dist

doc/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Documentation
2+
This folder contains documentation on how to build an API server with expressjs.
3+
4+
## Building
5+
You can build the documentation from the source Markdown files with `make`.
6+
7+
`make` builds a simple HTML version of the documentation.
8+
`make pretty` builds a nicer HTML version of the documentation.
9+
10+
### Dependencies
11+
* [pandoc](https://github.com/jgm/pandoc)
12+
* coreutils (cat, rm, cp, paste, ...)
13+
* grep
14+
* awk
15+
* perl
16+
* sed
17+
* [grip](https://github.com/joeyespo/grip) (for pretty output only)

0 commit comments

Comments
 (0)