From: Fletcher T. Penney
Date: Tue, 4 Apr 2017 22:35:08 +0000 (-0400)
Subject: ADDED: The '-l' command line argument also sets language, if not overridden by metadata
X-Git-Tag: 6.0.4^2~2
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67d14e6bef2d7bf14015b93d745568891a7fb184;p=multimarkdown
ADDED: The '-l' command line argument also sets language, if not overridden by metadata
---
diff --git a/QuickStart/QuickStart.epub b/QuickStart/QuickStart.epub
index 99d8d0c..37fc00a 100644
Binary files a/QuickStart/QuickStart.epub and b/QuickStart/QuickStart.epub differ
diff --git a/QuickStart/QuickStart.fodt b/QuickStart/QuickStart.fodt
index ea68b50..7c987ae 100644
--- a/QuickStart/QuickStart.fodt
+++ b/QuickStart/QuickStart.fodt
@@ -650,6 +650,21 @@ included at the top of the file, one to be included right at the beginning of
the document, and one to be included at the end of the document. If you want
to specify the latex files separately, you can use latex leader, latexbegin, and latex footer.
+There are new metadata keys for controlling internationalization:
+
+
+
+language – specify the content language for a document, using the two
+letter code for the language (e.g. en for English). Where possible, this
+will also set the default quotes language.
+
+
+quotes language – specify which variant of smart quotes to use. Valid
+options are dutch, french, german, germanguillemets, swedish, nl,
+fr, de, sv. Anything else defaults to English.
+
+
+
Table of Contents
By placing {{TOC}} in your document, you can insert an automatically
diff --git a/QuickStart/QuickStart.html b/QuickStart/QuickStart.html
index 4b7ecb3..be4247e 100644
--- a/QuickStart/QuickStart.html
+++ b/QuickStart/QuickStart.html
@@ -344,6 +344,17 @@ the document, and one to be included at the end of the document. If you want
to specify the latex files separately, you can use latex leader
, latex
begin
, and latex footer
.
+There are new metadata keys for controlling internationalization:
+
+
+language
– specify the content language for a document, using the two
+letter code for the language (e.g. en
for English). Where possible, this
+will also set the default quotes language
.
+quotes language
– specify which variant of smart quotes to use. Valid
+options are dutch
, french
, german
, germanguillemets
, swedish
, nl
,
+fr
, de
, sv
. Anything else defaults to English.
+
+
Table of Contents
By placing {{TOC}}
in your document, you can insert an automatically
diff --git a/QuickStart/QuickStart.pdf b/QuickStart/QuickStart.pdf
index 92ddb34..011eccf 100644
Binary files a/QuickStart/QuickStart.pdf and b/QuickStart/QuickStart.pdf differ
diff --git a/QuickStart/QuickStart.txt b/QuickStart/QuickStart.txt
index 57ec3b1..2dafc55 100644
--- a/QuickStart/QuickStart.txt
+++ b/QuickStart/QuickStart.txt
@@ -325,6 +325,16 @@ the document, and one to be included at the end of the document. If you want
to specify the latex files separately, you can use `latex leader`, `latex
begin`, and `latex footer`.
+There are new metadata keys for controlling internationalization:
+
+* `language` -- specify the content language for a document, using the two
+letter code for the language (e.g. `en` for English). Where possible, this
+will also set the default `quotes language`.
+
+* `quotes language` -- specify which variant of smart quotes to use. Valid
+options are `dutch`, `french`, `german`, `germanguillemets`, `swedish`, `nl`,
+`fr`, `de`, `sv`. Anything else defaults to English.
+
## Table of Contents ##
diff --git a/Sources/libMultiMarkdown/epub.c b/Sources/libMultiMarkdown/epub.c
index 6f260cb..6a0a3a8 100644
--- a/Sources/libMultiMarkdown/epub.c
+++ b/Sources/libMultiMarkdown/epub.c
@@ -64,6 +64,7 @@
#include "d_string.h"
#include "epub.h"
#include "html.h"
+#include "i18n.h"
#include "miniz.h"
#include "mmd.h"
#include "transclude.h"
@@ -153,7 +154,25 @@ char * epub_package_document(scratch_pad * scratch) {
mmd_print_string_html(out, m->value, false);
print_const("\n");
} else {
- print_const("en\n");
+ switch(scratch->language) {
+ case LC_ES:
+ print_const("es\n");
+ break;
+ case LC_DE:
+ print_const("de\n");
+ break;
+ case LC_FR:
+ print_const("fr\n");
+ break;
+ case LC_NL:
+ print_const("nl\n");
+ break;
+ case LC_SV:
+ print_const("sv\n");
+ break;
+ default:
+ print_const("en\n");
+ }
}
// Date
diff --git a/Sources/libMultiMarkdown/html.c b/Sources/libMultiMarkdown/html.c
index b7992f8..d8baea8 100644
--- a/Sources/libMultiMarkdown/html.c
+++ b/Sources/libMultiMarkdown/html.c
@@ -1714,7 +1714,25 @@ void mmd_start_complete_html(DString * out, const char * source, scratch_pad * s
if (m) {
printf(" lang=\"%s\"", m->value);
} else {
- print_const(" lang=\"en\"");
+ switch(scratch->language) {
+ case LC_ES:
+ print_const(" lang=\"es\"");
+ break;
+ case LC_DE:
+ print_const(" lang=\"de\"");
+ break;
+ case LC_FR:
+ print_const(" lang=\"fr\"");
+ break;
+ case LC_NL:
+ print_const(" lang=\"nl\"");
+ break;
+ case LC_SV:
+ print_const(" lang=\"sv\"");
+ break;
+ default:
+ print_const(" lang=\"en\"");
+ }
}
print_const(">\n
\n\t\n");
@@ -1739,7 +1757,7 @@ void mmd_start_complete_html(DString * out, const char * source, scratch_pad * s
print(m->value);
print_char('\n');
} else if (strcmp(m->key, "htmlheaderlevel") == 0) {
- } else if (strcmp(m->key, "lang") == 0) {
+ } else if (strcmp(m->key, "language") == 0) {
} else if (strcmp(m->key, "latexbegin") == 0) {
} else if (strcmp(m->key, "latexconfig") == 0) {
} else if (strcmp(m->key, "latexfooter") == 0) {
diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c
index ae05e4a..ce547a7 100644
--- a/Sources/libMultiMarkdown/latex.c
+++ b/Sources/libMultiMarkdown/latex.c
@@ -1836,7 +1836,7 @@ void mmd_start_complete_latex(DString * out, const char * source, scratch_pad *
} else if (strcmp(m->key, "htmlfooter") == 0) {
} else if (strcmp(m->key, "htmlheader") == 0) {
} else if (strcmp(m->key, "htmlheaderlevel") == 0) {
- } else if (strcmp(m->key, "lang") == 0) {
+ } else if (strcmp(m->key, "language") == 0) {
} else if (strcmp(m->key, "latexbegin") == 0) {
} else if (strcmp(m->key, "latexconfig") == 0) {
} else if (strcmp(m->key, "latexheader") == 0) {
diff --git a/Sources/libMultiMarkdown/odf.c b/Sources/libMultiMarkdown/odf.c
index 25f4e58..64112f6 100644
--- a/Sources/libMultiMarkdown/odf.c
+++ b/Sources/libMultiMarkdown/odf.c
@@ -1902,7 +1902,6 @@ void mmd_start_complete_odf(DString * out, const char * source, scratch_pad * sc
} else if (strcmp(m->key, "htmlfooter") == 0) {
} else if (strcmp(m->key, "htmlheader") == 0) {
} else if (strcmp(m->key, "htmlheaderlevel") == 0) {
- } else if (strcmp(m->key, "lang") == 0) {
} else if (strcmp(m->key, "language") == 0) {
} else if (strcmp(m->key, "latexbegin") == 0) {
} else if (strcmp(m->key, "latexconfig") == 0) {