From fb7bb9752e3203a0eca1c939ede84e3bbdaba463 Mon Sep 17 00:00:00 2001 From: tghosth Date: Thu, 16 Jul 2026 20:30:11 +0300 Subject: [PATCH 1/3] Add Amiri font to document builder --- 5.0/templates/eisvogel.tex | 1 + docker/Dockerfile | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/5.0/templates/eisvogel.tex b/5.0/templates/eisvogel.tex index 1902734b88..aaef4bbf8f 100644 --- a/5.0/templates/eisvogel.tex +++ b/5.0/templates/eisvogel.tex @@ -205,6 +205,7 @@ $if(zero-width-non-joiner)$ %% Support for zero-width non-joiner characters. \makeatletter +\providecommand{\textormath}[1]{#1} \def\zerowidthnonjoiner{% % Prevent ligatures and adjust kerning, but still support hyphenating. \texorpdfstring{% diff --git a/docker/Dockerfile b/docker/Dockerfile index b5aa15bdfb..168f6518ad 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -56,6 +56,11 @@ RUN for font in source-sans source-serif source-code-pro; do \ done RUN mkdir adobe-fonts RUN find $PWD/ -name "*.ttf" -exec install -m644 {} adobe-fonts/ \; || return 1 +RUN curl -L --retry 5 \ + "https://github.com/aliftype/amiri/releases/download/1.003/Amiri-1.003.zip" \ + --output amiri.zip \ + && unzip amiri.zip \ + && find $PWD/ -path "*/Amiri-1.003/*.ttf" -exec install -m644 {} adobe-fonts/ \; RUN rm -rf $PWD/source* FROM base_${WITH_CERT} as pandoc_base From e181984bd641eaf930de90597890ec7eec7c9cee Mon Sep 17 00:00:00 2001 From: tghosth Date: Sun, 19 Jul 2026 08:23:56 +0300 Subject: [PATCH 2/3] Right-align tables in RTL PDF output --- 5.0/Makefile | 6 ++++-- 5.0/tools/rtl_tables.lua | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 5.0/tools/rtl_tables.lua diff --git a/5.0/Makefile b/5.0/Makefile index 9cd273185d..2f84e4ff2d 100644 --- a/5.0/Makefile +++ b/5.0/Makefile @@ -46,6 +46,8 @@ PANDOC_PDF_FLAGS=-f markdown -s -t latex --pdf-engine=xelatex PANDOC_TEX_FLAGS=-f markdown -s -t latex +PANDOC_RTL_TABLE_FILTER=--lua-filter=$(TOOLSDIR)/rtl_tables.lua + PANDOC_DOCX_FLAGS= -s \ -t docx \ -f markdown \ @@ -90,11 +92,11 @@ md: $(MD_FILES) echo $(MD_FILES) $(PDF_FILES): $(BUILD_FOLDERS) $(TARGETS) $(DIST_FOLDERS) transform-md - pandoc $(PANDOC_PDF_FLAGS) --include-in-header=$(TEMPLATEDIR)/header-eisvogel.tex -o $@ --template $(TEMPLATEDIR)/eisvogel.tex $(subst dist,build,$(@D)/*.md) $(subst dist,,$(@D)/0x00-Header.yaml) + pandoc $(PANDOC_PDF_FLAGS) $(PANDOC_RTL_TABLE_FILTER) --include-in-header=$(TEMPLATEDIR)/header-eisvogel.tex -o $@ --template $(TEMPLATEDIR)/eisvogel.tex $(subst dist,build,$(@D)/*.md) $(subst dist,,$(@D)/0x00-Header.yaml) pdf: $(PDF_FILES) $(TEX_FILES): $(BUILD_FOLDERS) $(TARGETS) $(DIST_FOLDERS) - pandoc $(PANDOC_TEX_FLAGS) --include-in-header=$(TEMPLATEDIR)/header-eisvogel.tex -o $@ --template $(TEMPLATEDIR)/eisvogel.tex $(subst dist,build,$(@D)/*.md) $(subst dist,,$(@D)/0x00-Header.yaml) + pandoc $(PANDOC_TEX_FLAGS) $(PANDOC_RTL_TABLE_FILTER) --include-in-header=$(TEMPLATEDIR)/header-eisvogel.tex -o $@ --template $(TEMPLATEDIR)/eisvogel.tex $(subst dist,build,$(@D)/*.md) $(subst dist,,$(@D)/0x00-Header.yaml) tex: $(TEX_FILES) $(DOCX_FILES): $(BUILD_FOLDERS) $(TARGETS) $(DIST_FOLDERS) diff --git a/5.0/tools/rtl_tables.lua b/5.0/tools/rtl_tables.lua new file mode 100644 index 0000000000..75fce16e01 --- /dev/null +++ b/5.0/tools/rtl_tables.lua @@ -0,0 +1,22 @@ +-- Pandoc preserves Markdown's default left table alignment in LaTeX output, +-- even when the document direction is RTL. Convert those columns to right +-- alignment for RTL documents while preserving explicit centered columns. + +local function align_table_right(table) + for index, colspec in ipairs(table.colspecs) do + local alignment = colspec[1] + if alignment == pandoc.AlignDefault or alignment == pandoc.AlignLeft then + table.colspecs[index] = { pandoc.AlignRight, colspec[2] } + end + end + + return table +end + +function Pandoc(document) + if pandoc.utils.stringify(document.meta.dir) ~= "rtl" then + return document + end + + return document:walk({ Table = align_table_right }) +end From 1de9fdcdb6a0d6fbbc9f85a077eb46932f11c45b Mon Sep 17 00:00:00 2001 From: tghosth Date: Sun, 19 Jul 2026 08:38:34 +0300 Subject: [PATCH 3/3] Handle LTR documents in table filter --- 5.0/tools/rtl_tables.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/5.0/tools/rtl_tables.lua b/5.0/tools/rtl_tables.lua index 75fce16e01..19eb3eb5e0 100644 --- a/5.0/tools/rtl_tables.lua +++ b/5.0/tools/rtl_tables.lua @@ -14,7 +14,8 @@ local function align_table_right(table) end function Pandoc(document) - if pandoc.utils.stringify(document.meta.dir) ~= "rtl" then + local direction = document.meta.dir + if direction == nil or pandoc.utils.stringify(direction) ~= "rtl" then return document end