aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-02-28 10:40:04 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-03-05 10:33:48 -0500
commit8dde791281d89baa8c1c4a2455218d34d740105c (patch)
tree7e98c87a455c07f69118fee18bcb14e46bb03e0f
parentorg-mode, latex file, cosmetic (diff)
latex select papersize & orientation
- cfte, doc collection config, cli e.g. --set-papersize="a4,letter.portrait,b4.portrait"
-rw-r--r--org/config_d_cfte.org2
-rw-r--r--org/meta_conf_make_meta.org42
-rw-r--r--org/out_latex.org16
-rw-r--r--src/doc_reform/io_out/latex.d12
-rw-r--r--src/doc_reform/meta/conf_make_meta_yaml.d42
-rw-r--r--views/configuration.txt2
-rw-r--r--views/configuration_example.txt2
7 files changed, 61 insertions, 57 deletions
diff --git a/org/config_d_cfte.org b/org/config_d_cfte.org
index 00ba703..2f68c05 100644
--- a/org/config_d_cfte.org
+++ b/org/config_d_cfte.org
@@ -88,7 +88,7 @@ struct Cfg {
string db_sqlite_path = "<<db_sqlite_path>>";
string db_sqlite_filename = "<<db_sqlite_filename>>";
string default_language = "en";
- string default_papersize = "a4";
+ string default_papersize = "a4,letter.portrait";
string default_text_wrap = "80";
string default_hash_digest = "sha256";
}
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 331fe49..38fe49a 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -1032,16 +1032,6 @@ string[] selected_papersize(string _sizes_str) {
case "a4.landscape":
_selected_sizes ~= _size;
break;
- case "a5":
- _selected_sizes ~= "a5.portrait";
- _selected_sizes ~= "a5.landscape";
- break;
- case "a5.portrait":
- _selected_sizes ~= _size;
- break;
- case "a5.landscape":
- _selected_sizes ~= _size;
- break;
case "b4":
_selected_sizes ~= "b4.portrait";
_selected_sizes ~= "b4.landscape";
@@ -1052,6 +1042,16 @@ string[] selected_papersize(string _sizes_str) {
case "b4.landscape":
_selected_sizes ~= _size;
break;
+ case "a5":
+ _selected_sizes ~= "a5.portrait";
+ _selected_sizes ~= "a5.landscape";
+ break;
+ case "a5.portrait":
+ _selected_sizes ~= _size;
+ break;
+ case "a5.landscape":
+ _selected_sizes ~= _size;
+ break;
case "letter":
_selected_sizes ~= "letter.portrait";
_selected_sizes ~= "letter.landscape";
@@ -1077,24 +1077,24 @@ string[] selected_papersize(string _sizes_str) {
}
return _selected_sizes;
}
+string _set_papersize;
if (_opt_action.latex_papersize.length > 0) {
- _struct_composite.conf.set_papersize = selected_papersize(_opt_action.latex_papersize);
-} else if (
- "default" in _yaml
- && _yaml["default"].type.sequence
- && _yaml["default"].type.mapping
- && _yaml["default"].tag.match(rgx.yaml_tag_is_map)
-) {
+ _set_papersize
+ = _opt_action.latex_papersize;
+} else {
+ _set_papersize
+ = (_cfg.default_papersize.empty)
+ ? "a4,letter.portrait"
+ : _cfg.default_papersize;
if ("papersize" in _yaml["default"]
&& _yaml["default"]["papersize"].type.string
&& _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str)
) {
- _struct_composite.conf.set_papersize = selected_papersize(_yaml["default"]["papersize"].get!string);
+ _set_papersize
+ = _yaml["default"]["papersize"].get!string;
}
}
-if (_struct_composite.conf.set_papersize.length == 0) {
- _struct_composite.conf.set_papersize = ["a4.portrait", "a4.landscape"];
-}
+_struct_composite.conf.set_papersize = selected_papersize(_set_papersize);
if (
"default" in _yaml
&& _yaml["default"].type.sequence
diff --git a/org/out_latex.org b/org/out_latex.org
index 9bb604b..44ba4ad 100644
--- a/org/out_latex.org
+++ b/org/out_latex.org
@@ -1033,10 +1033,10 @@ string table(O,M)(
switch (paper_size_orientation) {
case "a4.portrait": pw = (paper.a4.portrait.w - 20); break;
case "a4.landscape": pw = (paper.a4.landscape.w - 20); break;
- case "a5.portrait": pw = (paper.a5.portrait.w - 20); break;
- case "a5.landscape": pw = (paper.a5.landscape.w - 20); break;
case "b4.portrait": pw = (paper.b4.portrait.w - 20); break;
case "b4.landscape": pw = (paper.b4.landscape.w - 20); break;
+ case "a5.portrait": pw = (paper.a5.portrait.w - 20); break;
+ case "a5.landscape": pw = (paper.a5.landscape.w - 20); break;
case "letter.portrait": pw = (paper.letter.portrait.w - 20); break;
case "letter.landscape": pw = (paper.letter.landscape.w - 20); break;
case "legal.portrait": pw = (paper.legal.portrait.w - 20); break;
@@ -1094,10 +1094,10 @@ string latex_head(M)(
struct paperTypeLatex {
string a4_portrait;
string a4_landscape;
- string a5_portrait;
- string a5_landscape;
string b4_portrait;
string b4_landscape;
+ string a5_portrait;
+ string a5_landscape;
string us_letter_portrait;
string us_letter_landscape;
string us_legal_portrait;
@@ -1348,16 +1348,20 @@ if (paper_set.is_portrait) {
***** (a4, a5, b4, letter, legal) * (portrait & landscape)
+#+BEGIN_SRC sh
+$SpineBIN/spine --verbose --latex --set-papersize="a4,letter.portrait,b4.portrait" --output="$SpineOUT" $SpinePOD/*
+#+END_SRC
+
#+NAME: output_latex_head_format_string_paper_set_orientation
#+BEGIN_SRC d
string paper_size_orientation_latex;
switch (paper_size_orientation) {
case "a4.portrait": paper_size_orientation_latex = set_paper(paper.a4.portrait); break;
case "a4.landscape": paper_size_orientation_latex = set_paper(paper.a4.landscape); break;
-case "a5.portrait": paper_size_orientation_latex = set_paper(paper.a5.portrait); break;
-case "a5.landscape": paper_size_orientation_latex = set_paper(paper.a5.landscape); break;
case "b4.portrait": paper_size_orientation_latex = set_paper(paper.b4.portrait); break;
case "b4.landscape": paper_size_orientation_latex = set_paper(paper.b4.landscape); break;
+case "a5.portrait": paper_size_orientation_latex = set_paper(paper.a5.portrait); break;
+case "a5.landscape": paper_size_orientation_latex = set_paper(paper.a5.landscape); break;
case "letter.portrait": paper_size_orientation_latex = set_paper(paper.letter.portrait); break;
case "letter.landscape": paper_size_orientation_latex = set_paper(paper.letter.landscape); break;
case "legal.portrait": paper_size_orientation_latex = set_paper(paper.legal.portrait); break;
diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d
index 68ac2f9..3bea60d 100644
--- a/src/doc_reform/io_out/latex.d
+++ b/src/doc_reform/io_out/latex.d
@@ -708,10 +708,10 @@ string table(O,M)(
switch (paper_size_orientation) {
case "a4.portrait": pw = (paper.a4.portrait.w - 20); break;
case "a4.landscape": pw = (paper.a4.landscape.w - 20); break;
- case "a5.portrait": pw = (paper.a5.portrait.w - 20); break;
- case "a5.landscape": pw = (paper.a5.landscape.w - 20); break;
case "b4.portrait": pw = (paper.b4.portrait.w - 20); break;
case "b4.landscape": pw = (paper.b4.landscape.w - 20); break;
+ case "a5.portrait": pw = (paper.a5.portrait.w - 20); break;
+ case "a5.landscape": pw = (paper.a5.landscape.w - 20); break;
case "letter.portrait": pw = (paper.letter.portrait.w - 20); break;
case "letter.landscape": pw = (paper.letter.landscape.w - 20); break;
case "legal.portrait": pw = (paper.legal.portrait.w - 20); break;
@@ -792,10 +792,10 @@ string table(O,M)(
struct paperTypeLatex {
string a4_portrait;
string a4_landscape;
- string a5_portrait;
- string a5_landscape;
string b4_portrait;
string b4_landscape;
+ string a5_portrait;
+ string a5_landscape;
string us_letter_portrait;
string us_letter_landscape;
string us_legal_portrait;
@@ -907,10 +907,10 @@ string table(O,M)(
switch (paper_size_orientation) {
case "a4.portrait": paper_size_orientation_latex = set_paper(paper.a4.portrait); break;
case "a4.landscape": paper_size_orientation_latex = set_paper(paper.a4.landscape); break;
- case "a5.portrait": paper_size_orientation_latex = set_paper(paper.a5.portrait); break;
- case "a5.landscape": paper_size_orientation_latex = set_paper(paper.a5.landscape); break;
case "b4.portrait": paper_size_orientation_latex = set_paper(paper.b4.portrait); break;
case "b4.landscape": paper_size_orientation_latex = set_paper(paper.b4.landscape); break;
+ case "a5.portrait": paper_size_orientation_latex = set_paper(paper.a5.portrait); break;
+ case "a5.landscape": paper_size_orientation_latex = set_paper(paper.a5.landscape); break;
case "letter.portrait": paper_size_orientation_latex = set_paper(paper.letter.portrait); break;
case "letter.landscape": paper_size_orientation_latex = set_paper(paper.letter.landscape); break;
case "legal.portrait": paper_size_orientation_latex = set_paper(paper.legal.portrait); break;
diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d
index ff0bcf5..5af22ad 100644
--- a/src/doc_reform/meta/conf_make_meta_yaml.d
+++ b/src/doc_reform/meta/conf_make_meta_yaml.d
@@ -518,16 +518,6 @@ template contentYAMLtoSpineStruct() {
case "a4.landscape":
_selected_sizes ~= _size;
break;
- case "a5":
- _selected_sizes ~= "a5.portrait";
- _selected_sizes ~= "a5.landscape";
- break;
- case "a5.portrait":
- _selected_sizes ~= _size;
- break;
- case "a5.landscape":
- _selected_sizes ~= _size;
- break;
case "b4":
_selected_sizes ~= "b4.portrait";
_selected_sizes ~= "b4.landscape";
@@ -538,6 +528,16 @@ template contentYAMLtoSpineStruct() {
case "b4.landscape":
_selected_sizes ~= _size;
break;
+ case "a5":
+ _selected_sizes ~= "a5.portrait";
+ _selected_sizes ~= "a5.landscape";
+ break;
+ case "a5.portrait":
+ _selected_sizes ~= _size;
+ break;
+ case "a5.landscape":
+ _selected_sizes ~= _size;
+ break;
case "letter":
_selected_sizes ~= "letter.portrait";
_selected_sizes ~= "letter.landscape";
@@ -563,24 +563,24 @@ template contentYAMLtoSpineStruct() {
}
return _selected_sizes;
}
+ string _set_papersize;
if (_opt_action.latex_papersize.length > 0) {
- _struct_composite.conf.set_papersize = selected_papersize(_opt_action.latex_papersize);
- } else if (
- "default" in _yaml
- && _yaml["default"].type.sequence
- && _yaml["default"].type.mapping
- && _yaml["default"].tag.match(rgx.yaml_tag_is_map)
- ) {
+ _set_papersize
+ = _opt_action.latex_papersize;
+ } else {
+ _set_papersize
+ = (_cfg.default_papersize.empty)
+ ? "a4,letter.portrait"
+ : _cfg.default_papersize;
if ("papersize" in _yaml["default"]
&& _yaml["default"]["papersize"].type.string
&& _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str)
) {
- _struct_composite.conf.set_papersize = selected_papersize(_yaml["default"]["papersize"].get!string);
+ _set_papersize
+ = _yaml["default"]["papersize"].get!string;
}
}
- if (_struct_composite.conf.set_papersize.length == 0) {
- _struct_composite.conf.set_papersize = ["a4.portrait", "a4.landscape"];
- }
+ _struct_composite.conf.set_papersize = selected_papersize(_set_papersize);
if (
"default" in _yaml
&& _yaml["default"].type.sequence
diff --git a/views/configuration.txt b/views/configuration.txt
index ab26992..5f49a1a 100644
--- a/views/configuration.txt
+++ b/views/configuration.txt
@@ -15,7 +15,7 @@ struct Cfg {
string db_sqlite_path = "/var/www/sqlite";
string db_sqlite_filename = "spine.search.db";
string default_language = "en";
- string default_papersize = "a4";
+ string default_papersize = "a4,letter.portrait";
string default_text_wrap = "80";
string default_hash_digest = "sha256";
}
diff --git a/views/configuration_example.txt b/views/configuration_example.txt
index 203d56d..be0d9c5 100644
--- a/views/configuration_example.txt
+++ b/views/configuration_example.txt
@@ -16,7 +16,7 @@ struct Cfg {
string db_sqlite_path = "/var/www/sqlite";
string db_sqlite_filename = "spine.search.db";
string default_language = "en";
- string default_papersize = "a4";
+ string default_papersize = "a4,letter.portrait";
string default_text_wrap = "80";
string default_hash_digest = "sha256";
}