This repository has been archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
new.sh
151 lines (116 loc) · 2.67 KB
/
new.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
skel(){
cp -R Skel Source/
}
create(){
echo "What is the title of your book?"
read TITLE
mkdir -p "Source/$TITLE/"
cat > "Source/$TITLE/$TITLE-Amazon.md" << EOF
---
layout: $TITLE/amazon
---
EOF
cat > "Source/$TITLE/$TITLE-epub.md" << EOF
---
layout: $TITLE/epub
---
EOF
cat > "Source/$TITLE/$TITLE-pdf.md" << EOF
---
layout: $TITLE/pdf
---
EOF
cat > "Source/$TITLE/$TITLE-Smashwords.md" << EOF
---
layout: $TITLE/epub
---
EOF
mkdir -p "Source/_layouts/$TITLE"
cat > "Source/_layouts/$TITLE/amazon.md" << EOF
{% include $TITLE/amazon.md %}
{% include magnet_tah.md %}
{% include bio.md %}
{% include bibliography.md %}
{% include license.md %}
EOF
cat > "Source/_layouts/$TITLE/epub.md" << EOF
{% include $TITLE/chapters.md %}
{% include magnet_tah.md %}
{% include bio.md %}
{% include bibliography.md %}
{% include license.md %}
EOF
cat > "Source/_layouts/$TITLE/pdf.md" << EOF
{% include $TITLE/chapters.md %}
EOF
mkdir -p "Source/_includes/$TITLE"
cat > "Source/_includes/$TITLE/chapters.md" << EOF
---
title: $TITLE
subtitle:
author:
website:
type: [GENRE]
lang: en-US
date: YYYY-MM-DD
year: YYYY
cover-image: Source/images/XXXXX.jpg
publisher:
rights: This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License.
paperback-isbn:
hardcover-isbn:
epub-isbn:
dedication: Dedicated to my readers.
toc: false
top-margin:
bottom-margin:
inner-margin:
outer-margin:
identifier:
- scheme: UUID
text: [Grab a free Version4 UUID from here: https://www.uuidgenerator.net/version4]
contributors:
- designer:
artist:
editor:
book1:
- title: Any book you've written
link: http://www.amazon.com/dp/XXXXXXXX
book2:
- title: These books get added to the title page
link: and for Amazon, they use the links you provide here
book3:
- title: You can add up to 5 books
link:
review:
- amazon: https://www.amazon.com/review/create-review?asin=XXXXXXX
---
# Chapter Title
Paste your manuscript here.
EOF
cat > "Source/_includes/$TITLE/amazon.md" << EOF
{% include $TITLE/chapters.md %}
{% include amazon_review.md %}
EOF
cat > "Source/_includes/$TITLE/amazon_review.md" << EOF
\\
\\
##### If you enjoyed this book please consider leaving a [review](https://www.amazon.com/review/create-review?asin=XXXXXXXXXX) on Amazon.
EOF
echo ""
echo "Paste your manuscript into Source/_includes/$TITLE/chapters.md and then run bind.sh all"
echo ""
}
destroy(){
echo "What is the title of your book?"
read TITLE
rm -rf "Source/$TITLE"
rm -rf "Source/_layouts/$TITLE"
rm -rf "Source/_includes/$TITLE"
}
usage(){
echo "run new.sh create or new.sh destroy"
}
if [[ -z "$1" ]]; then usage; fi
$1