View Single Post
Old 09-03-2021, 08:07 PM   #24
adamaymas
Junior Member
adamaymas doesn't litteradamaymas doesn't litter
 
Posts: 5
Karma: 108
Join Date: Sep 2011
Device: SONY PRS-350
Save the file to somewhere on your computer and name it html2azw3.sh (or whatever). You then have to open a terminal window and run the script from there. Like this:

User$ html2azw3.sh name_of_file

The script will use Calibre to generate an azw3 file that should display vertically on the kindle. You probably want to read up a bit on how to use bash scripts, though. It's not difficult once you get the hang of it. There are lots of tutorials online. Here's an example:
https://ryanstutorials.net/bash-scri...ash-script.php

I noticed something in the old scripts that I fixed (the old one should work fine but probably throws up some annoying messages). Here is the cleaned-up version:

Code:
#!/bin/bash
name=${1%%.html}
ebook-convert "$name".html "$name"

echo -en "\n\
body {\n\
\t writing-mode: vertical-rl;\n\
\t line-break: normal;\n\
\t -epub-writing-mode: vertical-rl;\n\
\t -webkit-writing-mode: vertical-rl;\n\
\t -epub-line-break: normal;\n\
\t -webkit-line-break: normal;\n\
\t line-height: 150%;\n\
\t padding: 1em 1em;\n\
\t font-family: serif, sans-serif\n\
}\n"\
>>"$name"/page_styles.css

sed -i -e 's:</metadata>:<meta\ name="primary-writing-mode"\ content="vertical-rl"/>\n</metadata>:' "$name"/content.opf

sed -i -e 's:<spine.*:<spine\ toc="ncx"\ page-progression-direction="rtl">:' "$name"/content.opf

sed -i -e 's/<dc:language>.*/<dc:language>jpn<\/dc:language>/' "$name"/content.opf

zip "$name".zip -j "$name"/*

ebook-convert "$name".zip "$name".azw3

rm -Rf "$name"
rm -f "$name".zip
adamaymas is offline   Reply With Quote