aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-07-19 12:04:10 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-10-17 19:07:20 -0400
commit61409898f0cbd255c1019e1f988de1a978830fe9 (patch)
tree18482b8e4e4aa7b9f06633b1d7f837cab33b864e
parentcss cosmetic (diff)
texpdf, footer & language settingdoc-reform_v0.7.5
-rw-r--r--org/output_latex.org69
-rw-r--r--src/doc_reform/output/latex.d47
2 files changed, 96 insertions, 20 deletions
diff --git a/org/output_latex.org b/org/output_latex.org
index 4c3cf5f..eb50c46 100644
--- a/org/output_latex.org
+++ b/org/output_latex.org
@@ -26,15 +26,17 @@ template outputLaTeX() {
mixin InternalMarkup; // watch
mixin DocReformOutputRgxInit;
auto rgx = Rgx();
+ mixin DocReformLanguageCodes;
+ auto lang = Lang();
<<output_latex_shared>>
<<output_latex_shared_0>>
<<output_latex_head>>
- <<output_latex_head_1>>
+ <<output_latex_head_1_format_string>>
<<output_latex_head_1_tex>>
- <<output_latex_head_1_close>>
- <<output_latex_head_0>>
+ <<output_latex_head_1_format_string_variables>>
+ <<output_latex_head_0_format_string>>
<<output_latex_head_0_tex>>
- <<output_latex_head_0_close>>
+ <<output_latex_head_0_format_string_variables>>
<<output_latex_head_close>>
<<output_latex_body>>
<<output_latex_tail>>
@@ -539,7 +541,8 @@ string bullets_and_indentation(O)(
) {
_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;
@@ -962,9 +965,44 @@ string latex_head(M)(
auto paper = paperType();
#+END_SRC
+****** footer
+
+#+name: output_latex_head
+#+BEGIN_SRC d
+ 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;
+ }
+#+END_SRC
+
****** a4, portrait
-#+name: output_latex_head_1
+#+name: output_latex_head_1_format_string
#+BEGIN_SRC d
paper.a4_portrait = format(q"┃
#+END_SRC
@@ -1177,7 +1215,7 @@ string latex_head(M)(
linkcolor=myred, %% \href{...} and \pageref{...}
#+END_SRC
-#+name: output_latex_head_1_close
+#+name: output_latex_head_1_format_string_variables
#+BEGIN_SRC d
┃",
);
@@ -1185,7 +1223,7 @@ string latex_head(M)(
**** latex head starts
-#+name: output_latex_head_0
+#+name: output_latex_head_0_format_string
#+BEGIN_SRC d
string _latex_head = format(q"┃%%%% DocReform LaTeX output
#+END_SRC
@@ -1243,8 +1281,8 @@ string latex_head(M)(
#+name: output_latex_head_0_tex
#+BEGIN_SRC latex
\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode}
-\setmainlanguage{english}
-\setotherlanguage{}
+\setmainlanguage{%s}
+\setotherlanguage{%s}
\setmainfont{Liberation Sans}
\setmonofont[Scale=0.85]{Liberation Mono}
#+END_SRC
@@ -1427,12 +1465,11 @@ string latex_head(M)(
#+name: output_latex_head_0_tex
#+BEGIN_SRC latex
-\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
@@ -1487,17 +1524,21 @@ string latex_head(M)(
**** latex head format inclusions
-#+name: output_latex_head_0_close
+#+name: output_latex_head_0_format_string_variables
#+BEGIN_SRC d
┃",
doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version.strip,
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),
);
#+END_SRC
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;
}