I was tasked with trying to get both Hebrew and Greek to be readable with Asciidoc, primarily for epub and PDF, but I also wanted to try with HTML too. Both HTML and epub worked great, but I had troubles with getting it to work with PDFs.
Installation
I’m on OpenBSD, but there are similar steps. In fact, I also did this on Linux and the steps were pretty similar. First I had asciidoctor installed on my computer:
pkg_add asciidoc asciidoctor
This also installed ruby, but if not for you, install that so you can get the gem package manager. Here is how I installed asciidoctor-pdf and asciidoctor-epub
gem32 install --user asciidoctor-pdf
On OpenBSD I have to specify gem32.
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem32 install --user asciidoctor-epub3
That’s all is needed to make HTML, PDF, and epub.
HTML Output
HTML output didn’t need any work. I just had my source content which contained English, Hebrew, and Greek.
asciidoctor myfile.adoc
Done. I now had a single HTML page.
EPUB Output
This one contains some extra metadata in the document to make it work
:doctype: book
:author: Author Name Here
:copyright: CC0
:epub-chapter-level: 2
:toc:
:media: print
Then I ran the command to get an ebook
asciidoctor-epub332 myfile.adoc
That generated the epub file, looks great, renders all languages great.
PDF Output
This one was tricky. I guess the HTML uses FontAwesome, maybe the epub tool does too, but the PDF tool handles it differently. I was suggested to get Society of Bible Literature’s TTF font file. I had to modify the theme to make it use this font. In the working directory where my adoc file is, I created this yaml file:
extends: default
font:
catalog:
merge: false
SBL BibLit:
normal: /path/to/Documents/mypdf/fonts/SBL_BLit.ttf
bold: /path/to/Documents/mypdf/fonts/SBL_BLit.ttf
base:
font-family: SBL BibLit
I called the file mytheme-theme.yml
.
I also created a fonts directory and placed the downloaded ttf file there.
Note
|
These fonts do not support italics, so it is vital to avoid styling that will put Greek/Hebrew texts in italics, such as quote blocks with ---- . Use ____ (4 underscores) instead.
|
The header metadata is also very similar to the epub
:doctype: book
:author: Author Name Here
:copyright: CC0
:epub-chapter-level: 2
:toc:
:media: print
:pdf-page-margin: [0.5in, 0.25in]
You should be able to run this command now to generate the PDF:
asciidoctor-pdf32 --theme mytheme-theme.yml -a pdf-fontsdir=/path/to/Documents/mypdf/fonts test.adoc
#100DaysToOffload #Post6