25 lines
1.2 KiB
Bash
Executable File
25 lines
1.2 KiB
Bash
Executable File
#!/bin/zsh
|
|
# dumb script to inject epub noteref label and download buttons....
|
|
# needs overhaul
|
|
|
|
ebookfile="Le Français par la Méthode Nature.epub"
|
|
|
|
cd ../epub
|
|
unzip -u "$ebookfile" -d ebook
|
|
# rm "$ebookfile"
|
|
|
|
cd ..
|
|
|
|
sed -i 's/<sup class="footnote-reference"><a href="#\([^"]*\)"/<sup class="footnote-reference"><a epub:type="noteref" id="footnote_source_\1" href="#footnote_\1" class/g' html/*.html epub/**/*.html
|
|
sed -i 's/<sup class="footnote-definition-label">\([^<]*\)<\/sup>/<sup class="footnote-definition-label"><a href="#footnote_source_\1" id="footnote_\1">\1<\/a>/g' html/*.html epub/**/*.html
|
|
sed -i 's/<div class="right-buttons">/<div class="right-buttons"> <a href=".\/Le Français par la Méthode Nature.epub" title="télécharger epub" aria-label="télécharger epub"> <i id="download-button" class="fa fa-book"><\/i>epub <\/a>/g' html/*.html
|
|
sed -i 's/<div class="right-buttons">/<div class="right-buttons"> <a href=".\/Le Français par la Méthode Nature.mobi" title="télécharger mobi" aria-label="télécharger mobi"> <i id="download-button" class="fa fa-book"><\/i>mobi <\/a>/g' html/*.html
|
|
|
|
|
|
cd epub/ebook
|
|
zip -rX "../../html/$ebookfile" *
|
|
cd ../
|
|
rm -r ebook
|
|
cd ../html
|
|
ebook-convert "$ebookfile" "${ebookfile%.*}.mobi"
|