aboutsummaryrefslogtreecommitdiff
path: root/documentation/tools/asciidoctor.sh
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/tools/asciidoctor.sh')
-rwxr-xr-xdocumentation/tools/asciidoctor.sh41
1 files changed, 37 insertions, 4 deletions
diff --git a/documentation/tools/asciidoctor.sh b/documentation/tools/asciidoctor.sh
index a834b2e532..1bf1e61554 100755
--- a/documentation/tools/asciidoctor.sh
+++ b/documentation/tools/asciidoctor.sh
@@ -27,8 +27,15 @@
LOCALBASE="/usr/local"
-ASCIIDOCTORPDF_CMD="${LOCALBASE}/bin/asciidoctor-pdf"
-ASCIIDOCTOREPUB_CMD="${LOCALBASE}/bin/asciidoctor-epub3"
+
+if [ "$USE_RUBYGEMS" = "YES" ]; then
+ GEMBASE="${GEM_PATH}"
+else
+ GEMBASE="${LOCALBASE}"
+fi
+
+ASCIIDOCTORPDF_CMD="${GEMBASE}/bin/asciidoctor-pdf"
+ASCIIDOCTOREPUB3_CMD="${GEMBASE}/bin/asciidoctor-epub3"
build_pdf() {
if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]; then
@@ -42,6 +49,8 @@ build_pdf() {
local cur_dir_source="content/$doc_lang/$doc_type/$doc_name/"
local cur_dir_output="public/$doc_lang/$doc_type/$doc_name/"
+ local theme_font=""
+
if [ ! -d "$cur_dir_output" ]; then
mkdir -p "$cur_dir_output"
fi
@@ -61,6 +70,27 @@ build_pdf() {
local asciidoctor_file_name="_index.adoc"
fi
+ # Check non default fonts
+ case "$doc_lang" in
+ zh-cn)
+ if [ ! -f "$LOCALBASE/share/docproj-fonts-cjk/NotoSansSC-Medium.otf" ]; then
+ echo " font not found, skipping pdf build"
+ return
+ fi
+ theme_font="-a pdf-theme=./shared/zh-cn/zh-cn-theme.yml -a pdf-fontsdir=$LOCALBASE/share/docproj-fonts-cjk"
+ ;;
+ zh-tw)
+ if [ ! -f "$LOCALBASE/share/docproj-fonts-cjk/NotoSansTC-Medium.otf" ]; then
+ echo " font not found, skipping pdf build"
+ return
+ fi
+ theme_font="-a pdf-theme=./shared/zh-tw/zh-tw-theme.yml -a pdf-fontsdir=$LOCALBASE/share/docproj-fonts-cjk/"
+ ;;
+ *)
+ theme_font="-a pdf-theme=default-with-fallback-font"
+ ;;
+ esac
+
$ASCIIDOCTORPDF_CMD \
-r ./shared/lib/man-macro.rb \
-r ./shared/lib/git-macro.rb \
@@ -73,7 +103,7 @@ build_pdf() {
-a lang="$doc_lang" \
-a isonline=1 \
-a env-beastie=1 \
- -a pdf-theme=default-with-fallback-font \
+ ${theme_font} \
-o "${cur_dir_output}${doc_name}_${doc_lang}.pdf" \
"${cur_dir_source}${asciidoctor_file_name}"
}
@@ -110,7 +140,7 @@ build_epub() {
local asciidoctor_file_name="_index.adoc"
fi
- $ASCIIDOCTOREPUB_CMD \
+ $ASCIIDOCTOREPUB3_CMD \
-r ./shared/lib/man-macro.rb \
-r ./shared/lib/git-macro.rb \
-r ./shared/lib/packages-macro.rb \
@@ -161,7 +191,10 @@ archive() {
"$pub_dir" \
public/css/ \
public/fonts/ \
+ public/images/FreeBSD-colors.svg \
+ public/images/FreeBSD-monochromatic.svg \
public/js/ \
+ public/styles/ \
$source_doc_dir \
$image_doc_dir