-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#!/bin/sh | ||
|
||
DIR=`dirname $0` | ||
INPUT_DIR="$DIR/src" | ||
OUTPUT_DIR="$DIR/target" | ||
MINIFIED_DIR="$OUTPUT_DIR/minified" | ||
ARTIFACT_NAME="The Rigel Black Chronicles" | ||
EPUB_ARTIFACT="$OUTPUT_DIR/$ARTIFACT_NAME.epub" | ||
|
||
clean () { | ||
rm -r "$OUTPUT_DIR" | ||
mkdir "$OUTPUT_DIR" | ||
} | ||
|
||
minify_resources () { | ||
echo "Minifying resources..." | ||
mkdir -p "$MINIFIED_DIR" | ||
cp -r "$INPUT_DIR/." "$MINIFIED_DIR/" | ||
for file in `find $INPUT_DIR | grep -E '\.(xhtml|css|ncx|opf|xml)$'`; do | ||
# collapse whitespace for efficiency | ||
sed 's|\s\s\s*| |g' "$file" | tr -d '\n' > `echo $file | sed "s|$INPUT_DIR/|$MINIFIED_DIR/|"` | ||
done | ||
} | ||
|
||
make_epub () { | ||
echo "Generating ePub..." | ||
SRC_DIR="$1" | ||
if [ $# -lt 2 ]; then | ||
DEST_FILE="$EPUB_ARTIFACT" | ||
else | ||
DEST_FILE="$2" | ||
fi | ||
# we need to force a non-relative path here | ||
CANONICAL_DEST_FILE="$(cd "$(dirname "$DEST_FILE")"; pwd)/$(basename "$DEST_FILE")" | ||
(cd $SRC_DIR && zip -q -X0 "$CANONICAL_DEST_FILE" mimetype && zip -q -r "$CANONICAL_DEST_FILE" META-INF OEBPS) | ||
} | ||
|
||
make_epub_if_needed () { | ||
if [ ! -e "$EPUB_ARTIFACT" ]; then | ||
make_epub "$INPUT_DIR" "$EPUB_ARTIFACT" | ||
fi | ||
} | ||
|
||
check_epub () { | ||
if (which epubcheck 2>/dev/null); then | ||
epubcheck "$OUTPUT_DIR/$ARTIFACT" || return 1 | ||
fi | ||
} | ||
|
||
to_mobi () { | ||
if (which ebook-convert >/dev/null 2>&1); then | ||
echo "Converting to MOBI using Calibre ebook-convert..." | ||
ebook-convert "$EPUB_ARTIFACT" "$OUTPUT_DIR/$ARTIFACT_NAME.mobi" --output-profile kindle_pw3 > /dev/null | ||
else | ||
echo "No MOBI converter found. Consider installing Calibre." | ||
return 1 | ||
fi | ||
} | ||
|
||
to_pdf () { | ||
if (which ebook-convert >/dev/null 2>&1); then | ||
echo "Converting to PDF using Calibre ebook-convert..." | ||
# try to use a Garamond font, otherwise just a Serif font | ||
SERIF_FONT=$(fc-list : family |grep "Garamond" |cut -d , -f 1 |head -1) | ||
if [ -z "$SERIF_FONT" ]; then | ||
SERIF_FONT=Serif | ||
fi | ||
ebook-convert "$EPUB_ARTIFACT" "$OUTPUT_DIR/$ARTIFACT_NAME.pdf" --paper-size a4 --pdf-page-numbers --pdf-serif-family "$SERIF_FONT" --pdf-standard-font serif > /dev/null | ||
elif (which mutool >/dev/null 2>&1); then | ||
echo "Converting to PDF using Mutool..." | ||
mutool convert -o "$OUTPUT_DIR/$ARTIFACT_NAME.pdf" "$EPUB_ARTIFACT" > /dev/null | ||
else | ||
echo "No PDF converter found. Consider installing Calibre or MuPDF Tools." | ||
return 1 | ||
fi | ||
} | ||
|
||
make_target () { | ||
BUILD_TARGET=$1 | ||
case $BUILD_TARGET in | ||
all) | ||
clean | ||
minify_resources | ||
make_epub "$MINIFIED_DIR" | ||
to_mobi | ||
to_pdf | ||
;; | ||
mobi) | ||
make_epub_if_needed | ||
to_mobi | ||
;; | ||
pdf) | ||
make_epub_if_needed | ||
to_pdf | ||
;; | ||
epub) | ||
minify_resources | ||
make_epub "$MINIFIED_DIR" | ||
;; | ||
uncompressed_epub) | ||
make_epub "$INPUT_DIR" "$EPUB_ARTIFACT" | ||
;; | ||
check) | ||
make_epub_if_needed | ||
check_epub || exit 1 | ||
;; | ||
clean) | ||
clean | ||
;; | ||
*) | ||
echo "Unrecognised build target: $BUILD_TARGET" | ||
esac | ||
echo "Done" | ||
} | ||
|
||
mkdir -p "$OUTPUT_DIR" | ||
if [ $# -eq 0 ]; then | ||
make_target all | ||
else | ||
for target in $@; do | ||
make_target "$target" | ||
done | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> | ||
<rootfiles> | ||
<rootfile full-path="OEBPS/book.opf" media-type="application/oebps-package+xml" /> | ||
</rootfiles> | ||
</container> |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>The Futile Facade</title> | ||
<link href="style.css" rel="stylesheet" type="text/css"/> | ||
</head> | ||
<body> | ||
<h2>Epilogue</h2> | ||
<div class="storytext"> | ||
<div class="storyparagraph"> | ||
<p>The rain that dashed itself against the windows didn't stir him. The wind howling at the shutters couldn't move him. He was calm. Focused. He had to be, or the Divination was all but useless.</p> | ||
<p>Severus bent low over a large map, intention in every fiber as he drew his magic through the array with ruthless control. At the center of the runes, a cluster of fluorescent green spheres glowed softly, perfectly imbued far beyond the natural life of such things. Retaining the magical signature of the one who imbued them years before.</p> | ||
<p>The crystal beneath his right hand grew scalding as it absorbed the magic in the array. At the last possible moment, when it was so hot he risked third-degree burns across his palm, he released it. The crystal lurched into the air and hung suspended over the map in quivering uncertainty. Slowly, as he began to strain with the effort of keeping the array active, the crystal lilted, tilted, and slid sideways to hover unerringly over south-east England.</p> | ||
<p>Severus released the magic with a gasp, vindicated. The boy hadn't left the country.</p> | ||
<p>His scrying was not accurate enough to geolocate his wayward pupil, but he was nonetheless satisfied. Let the offended imbeciles scour the continent for him. Severus would find the teen in his own time. Straightening, he fixed his sights on the pristine apron in the corner. It hung limp, abandoned, with no evidence it had ever been worn at all.</p> | ||
<p>A potioneer like Rigel couldn't hide his talents forever.</p> | ||
</div> | ||
|
||
<div class="storyparagraph"> | ||
<p>The boy had ruined everything. The legislation needed to save the magical world in tatters, votes evaporated in the boil of public outrage.</p> | ||
<p>To add insult to injury, he'd managed to hamstring his right-hand man on the way out. Lucius and all his resources—useless.</p> | ||
<p>Anger simmered into incredulity, and the dregs of that congealed to insatiable curiosity and he had to know. <em>How</em> could the boy have done this? And who <em>was</em> he?</p> | ||
<p>His spies at the Ministry reported the boy was European: French, possibly. Speculation put him the bastard of an old line, and naturally so—his magic was too great to be otherwise explained.</p> | ||
<p>Parseltongue was not a trait that ran in European lines, however. He should know. He had traced the line extensively, perhaps further than anyone else. If not a Black, he could only be the by-blow of another family intermingled with the Peverell brothers.</p> | ||
<p>He would find the boy.</p> | ||
<p>The door to his study creaked open, and Jacob Owens strode though it with a sour expression.</p> | ||
<p>Speaking of long-lost Slytherin heirs…</p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |