diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..65bd884
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,5 @@
+html/*
+chapters/*
+vendor
+*.epub
+*.html
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 381e71f..40c394c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
vendor/
-*.epub
html/*
chapters/*
*.html
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..3cbf444
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,23 @@
+FROM debian:bullseye-slim
+
+LABEL maintainer="ebooks@captnemo.in"
+
+ARG DEBIAN_FRONTEND="noninteractive"
+
+WORKDIR /src
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ pandoc \
+ ruby \
+ wget \
+ zlib1g-dev bundler \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/*
+
+COPY . /src/
+
+RUN bundle install
+
+ENTRYPOINT ["/src/generate.sh"]
+
+VOLUME ["/output"]
diff --git a/README.md b/README.md
index 587b644..a30dccb 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,7 @@ Your generated ebook should be available at never-say-you-cant-survive.epub
Embrace Uncertainty: The Joy of Making a Giant Mess
Everything Is Broken! What Should I Write About?
+
Section II - What’s A Story, and How Do You Find One?
- Don’t Be Afraid to Go on Lots of First Dates With Story Ideas
- The Secret to Storytelling? Just One Good Scene, and Then Another, and Another.
@@ -41,6 +42,7 @@ Your generated ebook should be available at never-say-you-cant-survive.epub
- How to Tell a Thrilling Story Without Breaking Your Own Heart
- The Ending Is The Beginning
+
Section III - Your Feelings are Valid—and Powerful
- Hold On To Your Anger. It’s a Storytelling Goldmine
- People Are Only as Interesting as Their Relationships
@@ -48,12 +50,16 @@ Your generated ebook should be available at never-say-you-cant-survive.epub
- Revision Is the Process of Turning Fake Emotion Into Real Emotion
- Twelve Ways to Keep the Fun of Writing Alive
+
Section IV - What We Write About When We Write About Spaceships
- How to Write a Political Story Without Falling on Your Face
- Good Worldbuilding Shows How Things Could Be Different
- The Unexamined Story Is Not Worth Writing
- Weirdness Gives Me the Strength To Keep Going
- When Is It Okay To Write About Someone Else’s Culture or Experience?
+
+
+Section V: How to Use Writerly Tricks to Gain Unstoppable Powers
- Find Your Voice and Make It LOUD
diff --git a/generate.rb b/generate.rb
index a2cac57..78c1c27 100644
--- a/generate.rb
+++ b/generate.rb
@@ -52,7 +52,9 @@ for i in Dir.glob('html/*.html')
end
end
fn = File.basename(i)
- File.write("chapters/#{fn}", html)
+ File.open("chapters/#{fn}", "w:UTF-8") do |f|
+ f.write html
+ end
end
html = ""
@@ -61,8 +63,7 @@ File.open("urls.txt").each_with_index do |url, index|
unless section_headers[index].nil?
html += "#{section_headers[index]}
\n\n"
end
- html += File.read("chapters/#{title}.html")
- html += "\n\n"
+ html += File.open("chapters/#{title}.html", "r:UTF-8", &:read)
end
File.write("never-say-you-cant-survive.html", html)
diff --git a/generate.sh b/generate.sh
index 826b610..6ed8e6c 100755
--- a/generate.sh
+++ b/generate.sh
@@ -19,4 +19,8 @@ do
wget --no-clobber --no-verbose --output-document="html/$FILENAME.html" --timeout=10 "$line"
done < "$INPUT_FILE"
-bundle exec ruby generate.rb
\ No newline at end of file
+bundle exec ruby generate.rb
+
+if [ -f /.dockerenv ]; then
+ cp never-say-you-cant-survive.epub /output
+fi
\ No newline at end of file