User:Manetta/Booklet-with-pagedjs.sh: Difference between revisions
(Created page with " <syntaxhighlight lang="bash"> # --- # store wiki page in variable WIKIPAGE=$1 # --- # download paged.js polyfill as JS file curl https://unpkg.com/pagedjs@0.4.3/dist/paged.polyfill.js -o paged-js.polyfill.js.tmp echo "<script>" > paged-js.polyfill.js cat paged-js.polyfill.js.tmp >> paged-js.polyfill.js echo "</script>" >> paged-js.polyfill.js rm paged-js.polyfill.js.tmp # --- # download paged.js's interface.css curl https://gitlab.coko.foundation/pagedjs/interface-p...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Variation of [[User:Manetta/Booklet.sh]], using Paged.js (instead of Weasyprint). | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 7: | Line 8: | ||
# --- | # --- | ||
# download paged.js polyfill as JS file | # download paged.js polyfill as JS file | ||
curl https://unpkg.com/pagedjs@0.4.3/dist/paged.polyfill.js -o | curl https://unpkg.com/pagedjs@0.4.3/dist/paged.polyfill.js -o pagedjs.polyfill.js.tmp | ||
echo "<script>" > | echo "<script>" > pagedjs.polyfill.js | ||
cat | cat pagedyjs.polyfill.js.tmp >> pagedjs.polyfill.js | ||
echo "</script>" >> | echo "</script>" >> pagedjs.polyfill.js | ||
rm | rm pagedjs.polyfill.js.tmp | ||
# --- | # --- | ||
# download paged.js's interface.css | # download paged.js's interface.css | ||
curl https://gitlab.coko.foundation/pagedjs/interface-polyfill/-/raw/master/interface.css -o | curl https://gitlab.coko.foundation/pagedjs/interface-polyfill/-/raw/master/interface.css -o pagedjs.interface.css | ||
# --- | # --- | ||
# create a local CSS stylesheet, in case it's not there yet | # create a local CSS stylesheet, in case it's not there yet | ||
touch stylesheet.css | touch booklet-stylesheet.css | ||
# --- | # --- | ||
Line 38: | Line 39: | ||
pandoc \ | pandoc \ | ||
--standalone \ | --standalone \ | ||
--css pagedjs.interface.css \ | |||
--css stylesheet.css \ | --css booklet-stylesheet.css \ | ||
--include-in-header= | --include-in-header=pagedjs.polyfill.js \ | ||
$WIKIPAGE.html \ | $WIKIPAGE.html \ | ||
--output $WIKIPAGE.html | --output $WIKIPAGE.html |
Latest revision as of 15:42, 6 February 2024
Variation of User:Manetta/Booklet.sh, using Paged.js (instead of Weasyprint).
# ---
# store wiki page in variable
WIKIPAGE=$1
# ---
# download paged.js polyfill as JS file
curl https://unpkg.com/pagedjs@0.4.3/dist/paged.polyfill.js -o pagedjs.polyfill.js.tmp
echo "<script>" > pagedjs.polyfill.js
cat pagedyjs.polyfill.js.tmp >> pagedjs.polyfill.js
echo "</script>" >> pagedjs.polyfill.js
rm pagedjs.polyfill.js.tmp
# ---
# download paged.js's interface.css
curl https://gitlab.coko.foundation/pagedjs/interface-polyfill/-/raw/master/interface.css -o pagedjs.interface.css
# ---
# create a local CSS stylesheet, in case it's not there yet
touch booklet-stylesheet.css
# ---
# download wiki page as HTML
curl https://pzwiki.wdka.nl/mediadesign/$WIKIPAGE?action=render -o $WIKIPAGE.html
# ---
# replace the image src links in the HTML page
# - from links that start with: /mw-mediadesign\/
# - to links that start with: https://pzwiki.wdka.nl/mw-mediadesign/
sed -i 's/\/mw-mediadesign\//https:\/\/pzwiki.wdka.nl\/mw-mediadesign\//g' $WIKIPAGE.html
# ---
# rewrite the HTML file to a standalone page
# that includes the JS and CSS files
pandoc \
--standalone \
--css pagedjs.interface.css \
--css booklet-stylesheet.css \
--include-in-header=pagedjs.polyfill.js \
$WIKIPAGE.html \
--output $WIKIPAGE.html
# ---
# (this step is only required when working locally from your own computer)
# run a local server
# access your paged.js preview page at localhost:8000/wikipage.html
# echo ">>> Go to the page at: http://localhost:8000/$WIKIPAGE.html"
# python3 -m http.server