Commit f388a32a authored by notklaatu's avatar notklaatu

allow setting paper size in builder.sh

parent c572aac3
......@@ -12,18 +12,21 @@ BLD=${BLD:-build}
DEST=${DEST:-print}
RES=${RES:-600}
XARGLIKE=parallel
PAPER=`grep -v '^$\|^\s*\#' /etc/papersize`
if [ X"$PAPER" = "X" ]; then
PAPER=${PAPER:-A4}
fi
help() {
echo "builder.sh [build|deck|docs|merge|clean] /path/to/dir" | $VILE
echo "build Dark oCCult for printing" | $VILE
echo " "
echo "./builder.sh build . -> build printable deck and docs from current directory."
echo "Advanced methods:"
echo "Paper size defaults to A4. Change it with:"
echo "./builder.sh --paper letter build ."
echo "./builder.sh --paper a4 build ."
echo " "
echo "Output dir defaults to build. Set it with:"
echo "BLD=build-letter ./builder.sh --paper letter build ."
echo " "
echo "Individual stages:"
echo "builder.sh deck /path/to/dark/oCCult/dir -> build card set for printing" | $VILE
echo "builder.sh deck merge /path/to/dark/oCCult/dir -> build to one PDF file" | $VILE
echo "builder.sh docs /path/to/dark/oCCult/dir -> build docs for printing" | $VILE
......@@ -92,10 +95,10 @@ cd "${CWD}"/"${BLD}"/"${DEST}"
#layout
echo "Using $PDFNUP to build card layout."
ls *svg.png | "${XARGLIKE}" --max-args=9 "${PDFNUP}" --no-tidy --nup 3x3 --suffix '3x3'
ls *svg.png | "${XARGLIKE}" --max-args=9 "${PDFNUP}" --papersize \'\{$W,$H\}\' --no-tidy --nup 3x3 --suffix '3x3'
echo "Creating optional player cards."
ls opend6*ng | "${XARGLIKE}" --max-args=9 "${PDFNUP}" --nup 3x3 --suffix '3x3'
ls opend6*ng | "${XARGLIKE}" --max-args=9 "${PDFNUP}" --papersize \'\{$W,$H\}\' --nup 3x3 --suffix '3x3'
#rename
n=1
......@@ -110,7 +113,7 @@ cat "${CWD}"/deck/system/back.png > "${CWD}"/"${BLD}"/"${DEST}"/back.png
"${MOGRIFY}" -verbose -rotate 90 "${CWD}"/"${BLD}"/"${DEST}"/back.png
# gen back
"${PDFNUP}" --nup 3x3 --suffix '3x3' \
"${PDFNUP}" --nup 3x3 --papersize \{$W,$H\} --suffix '3x3' \
back.png back.png back.png \
back.png back.png back.png \
back.png back.png back.png
......@@ -142,8 +145,8 @@ doc() {
# pdf
xsltproc --output source/tmp.fo \
--stringparam paper.type "${PAPER}" \
--stringparam page.width 8in \
--stringparam page.height 10in \
--stringparam page.width $W \
--stringparam page.height $H \
--stringparam redist.text "no" \
--stringparam column.count.titlepage 1 \
--stringparam column.count.lot 1 \
......@@ -172,18 +175,18 @@ doc() {
mkdir build/html
xmlto --skip-validation -o build/html html-nochunks source/docbook.xml
mv build/html ../build/html-guide
mv build/ ../build/print/docs
mkdir ../build/html-guide/images
cp source/images/*svg ../build/html-guide/images
sed -i 's_../images_./images_g' ../build/html-guide/docbook.html
sed -i 's_jpeg_svg_g' ../build/html-guide/docbook.html
mv ../build/html-guide/docbook.html ../build/html-guide/index.html
mv build/html ../"${BLD}"/html-guide
mv build/ ../"${BLD}"/print/docs
mkdir ../"${BLD}"/html-guide/images
cp source/images/*svg ../"${BLD}"/html-guide/images
sed -i 's_../images_./images_g' ../"${BLD}"/html-guide/docbook.html
sed -i 's_jpeg_svg_g' ../"${BLD}"/html-guide/docbook.html
mv ../"${BLD}"/html-guide/docbook.html ../"${BLD}"/html-guide/index.html
}
clean() {
/bin/rm -r "${CWD}/build"
/bin/rm -r "${CWD}"/"${BLD}"
/bin/rm -f "${CWD}/doc/build"
/bin/rm "${CWD}"/doc/source/images/*.jpeg 2>/dev/null
echo "Everything is clean, and tidy, and back to normal." | $VILE
......@@ -209,6 +212,10 @@ elif [ "$1" = "merge" -o "$1" = "--merge" ]; then
elif [ "$1" = "--no-tidy" ]; then
TIDY=0
shift 1
elif [ "$1" = "--paper" ]; then
PAPER=`echo $2 | tr [:upper:] [:lower:]`
echo $PAPER
shift 2
elif [ "$1" = "evil" -o "$1" = "--vile" -o "$1" = "666" -o "$1" = "redrum" ]; then
EVIL=1
shift 1
......@@ -241,6 +248,18 @@ if [ X"$CLEAN" = X"1" ]; then
clean "${CWD}"
fi
if [ X"$PAPER" = "X" ]; then
PAPER=${PAPER:-a4}
fi
if [ X"$PAPER" = X"letter" ]; then
W="8.5in"
H="11in"
elif [ X"$PAPER" = X"a4" ]; then
W="210mm"
H="297mm"
fi
if [ X"$EVIL" = X"1" ]; then
# find out if we're evil
echo "Something beckons you from the comfort of your home, out into the night..."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment