forked from ReSwift/ReSwift
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_docs.sh
executable file
·66 lines (53 loc) · 2.4 KB
/
generate_docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# ----- Configuration
ORGANISATION=ReSwift
NAME=ReSwift
BRANCH=master
TMP=Docs/tmp
if [ "$OUTPUT_PATH" == "" ]; then
OUTPUT_PATH=doc_output
fi
# ----- Setup and generate docs
GITHUB=https://github.com/$ORGANISATION/$NAME
URL=http://$ORGANISATION.github.io/$NAME
# Clean $TMP folder
if [ -d "$TMP" ]; then rm -rf "$TMP"; fi
mkdir -p $TMP/{compile,docs,api}
cp Docs/*.md $TMP/api/
# Split the README into sections
./docpreproc README.md "$TMP/docs/About ReSwift.md" --section "About ReSwift" --title "About ReSwift"
./docpreproc README.md "$TMP/docs/Why ReSwift.md" --section "Why ReSwift?" --title "Why ReSwift?"
./docpreproc README.md "$TMP/docs/Installation.md" --section "Installation" --title "Installation"
./docpreproc README.md "$TMP/docs/Checking out Source Code.md" --section "Checking out Source Code" --title "Checking out Source Code"
./docpreproc README.md "$TMP/docs/Demo.md" --section "Demo" --title "Demo"
./docpreproc README.md "$TMP/docs/Extensions.md" --section "Extensions" --title "Extensions"
./docpreproc README.md "$TMP/docs/Example Projects.md" --section "Example Projects" --title "Example Projects"
./docpreproc README.md "$TMP/docs/Credits.md" --section "Credits" --title "Credits"
./docpreproc README.md "$TMP/docs/Get in touch.md" --section "Get in touch" --title "Get in touch"
./docpreproc README.md "$TMP/compile/intro.md" --section "Introduction"
# Copy remaining root docs
./docpreproc CONTRIBUTING.md "$TMP/docs/Contributing.md"
./docpreproc CHANGELOG.md "$TMP/docs/Changelog.md" --title "Changelog"
./docpreproc LICENSE.md "$TMP/docs/License.md" --title "License"
# Copy over the Getting started guide
./docpreproc "Docs/Getting Started Guide.md" "$TMP/docs/Getting Started Guide.md"
# Create the documentation landing page by combining:
#
# - Docs/templates/heading.md
# - README.md#introduction
# - Docs/templates/toc.md
#
cat Docs/templates/heading.md $TMP/compile/intro.md Docs/templates/toc.md > $TMP/compile/readme-raw.md
./docpreproc "$TMP/compile/readme-raw.md" "$TMP/compile/README.md"
cp $TMP/compile/README.md $TMP/api/Documentation.md
# Compile our Docs/tmp + generate API docs using jazzy
jazzy \
--config .jazzy.json \
--clean \
--output "$OUTPUT_PATH" \
--module-version "$BRANCH" \
--dash_url "$URL/$BRANCH/docsets/$NAME.xml" \
--root-url "$URL/$BRANCH/" \
--github_url "$GITHUB" \
--github-file-prefix "$GITHUB/tree/$BRANCH"
cp Docs/img/* $OUTPUT_PATH/img/