From 61409898f0cbd255c1019e1f988de1a978830fe9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 19 Jul 2019 12:04:10 -0400 Subject: texpdf, footer & language setting --- src/doc_reform/output/latex.d | 47 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'src/doc_reform/output') diff --git a/src/doc_reform/output/latex.d b/src/doc_reform/output/latex.d index 88cc75c..674d6d3 100644 --- a/src/doc_reform/output/latex.d +++ b/src/doc_reform/output/latex.d @@ -10,6 +10,8 @@ template outputLaTeX() { mixin InternalMarkup; // watch mixin DocReformOutputRgxInit; auto rgx = Rgx(); + mixin DocReformLanguageCodes; + auto lang = Lang(); auto paper() { struct PaperType { auto a4() { @@ -668,7 +670,8 @@ string table(O,M)( ) { _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string; _hang = (((obj.attrib.indent_hang - obj.attrib.indent_base) * _indent_increment)).to!string; - _txt = format(q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃", + _tex_para = q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃"; + _txt = format(_tex_para, _indent, _hang, _txt.footnotes ).strip; @@ -685,6 +688,35 @@ string table(O,M)( string us_letter_landscape; } auto paper = paperType(); + string _footer(M)(M doc_matters) { + writeln("footer: ", doc_matters.conf_make_meta.make.footer); + string _ft = "\\lfoot[\\textrm{\\thepage}]"; + string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "http://sisudoc.org", "SiSU",); + string _ft_2 = format(q"┃ + \cfoot{\href{%s}{%s}}┃", "http://git.sisudoc.org", "git",); + if (doc_matters.conf_make_meta.make.footer.length > 0) { + if (doc_matters.conf_make_meta.make.footer.length > 0) { + if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) { + _ft ~= doc_matters.conf_make_meta.make.footer[0] + .replace(rgx.inline_link, "{\\tiny \\href{$2}{$1}}"); + } else { + _ft ~= _ft_1; + } + } + if (doc_matters.conf_make_meta.make.footer.length > 1) { + if (doc_matters.conf_make_meta.make.footer[1].matchAll(rgx.inline_link)) { + _ft ~= doc_matters.conf_make_meta.make.footer[1] + .replace(rgx.inline_link, "\n\\cfoot{\\href{$2}{$1}}"); + } else { + _ft ~= _ft_2; + } + } + } else { + _ft ~= _ft_1; + _ft ~= _ft_2; + } + return _ft; + } paper.a4_portrait = format(q"┃ \documentclass[12pt,a4paper,titlepage]{scrartcl} \setlength{\textheight}{228mm} \setlength{\textwidth}{160mm} @@ -765,8 +797,8 @@ string table(O,M)( \setlength{\marginparwidth}{8mm} %s \usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} -\setmainlanguage{english} -\setotherlanguage{} +\setmainlanguage{%s} +\setotherlanguage{%s} \setmainfont{Liberation Sans} \setmonofont[Scale=0.85]{Liberation Mono} \usepackage{alltt} @@ -876,12 +908,11 @@ string table(O,M)( {subparagraph}%%{6}%%{-2mm}%% {-\baselineskip}{0.5\baselineskip}%% {\normalfont\normalsize\itshape\raggedright}} -\selectlanguage{english} +\selectlanguage{%s} \lhead[ ]{ } \chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark } \rhead[ ]{ } -\lfoot[\textrm{\thepage}]{\tiny \href{http://sisudoc.org}{SiSU}} -\cfoot{\href{http://git.sisudoc.org}{git}} +%s \rfoot[\tiny \href{}{}]{\textrm{\thepage}} \tolerance=300 \clubpenalty=300 @@ -934,10 +965,14 @@ string table(O,M)( paper.a4_portrait.strip, margins.portrait.strip, multicol.portrait.strip, + lang.codes[doc_matters.src.language]["xlp"], + "english", links.mono.strip, // links.color.strip, doc_matters.conf_make_meta.meta.title_full.strip, doc_matters.conf_make_meta.meta.creator_author.strip, doc_matters.conf_make_meta.meta.classify_subject.strip, + lang.codes[doc_matters.src.language]["xlp"], + _footer(doc_matters), ); return _latex_head.strip; } -- cgit v1.2.3