]> granicus.if.org Git - multimarkdown/commitdiff
ADDED: The '-l' command line argument also sets language, if not overridden by metadata
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 4 Apr 2017 22:35:08 +0000 (18:35 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 4 Apr 2017 22:35:08 +0000 (18:35 -0400)
QuickStart/QuickStart.epub
QuickStart/QuickStart.fodt
QuickStart/QuickStart.html
QuickStart/QuickStart.pdf
QuickStart/QuickStart.txt
Sources/libMultiMarkdown/epub.c
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/latex.c
Sources/libMultiMarkdown/odf.c

index 99d8d0c30be92408656ae5bed3f10aab46dcf364..37fc00ad03000d13bbb5ab98546b429742bb1b15 100644 (file)
Binary files a/QuickStart/QuickStart.epub and b/QuickStart/QuickStart.epub differ
index ea68b5066ddbe62565ac644fae05d94393c6988c..7c987aedb694929acb119aec3e40a513aff67445 100644 (file)
@@ -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 <text:span text:style-name="Source_20_Text">latex leader</text:span>, <text:span text:style-name="Source_20_Text">latex<text:line-break/>begin</text:span>, and <text:span text:style-name="Source_20_Text">latex footer</text:span>.</text:p>
 
+<text:p text:style-name="Standard">There are new metadata keys for controlling internationalization:</text:p>
+
+<text:list text:style-name="L1">
+<text:list-item>
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">language</text:span> &#8211; specify the content language for a document, using the two
+letter code for the language (e.g. <text:span text:style-name="Source_20_Text">en</text:span> for English). Where possible, this
+will also set the default <text:span text:style-name="Source_20_Text">quotes language</text:span>.</text:p></text:list-item>
+
+<text:list-item>
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">quotes language</text:span> &#8211; specify which variant of smart quotes to use. Valid
+options are <text:span text:style-name="Source_20_Text">dutch</text:span>, <text:span text:style-name="Source_20_Text">french</text:span>, <text:span text:style-name="Source_20_Text">german</text:span>, <text:span text:style-name="Source_20_Text">germanguillemets</text:span>, <text:span text:style-name="Source_20_Text">swedish</text:span>, <text:span text:style-name="Source_20_Text">nl</text:span>,
+<text:span text:style-name="Source_20_Text">fr</text:span>, <text:span text:style-name="Source_20_Text">de</text:span>, <text:span text:style-name="Source_20_Text">sv</text:span>. Anything else defaults to English.</text:p></text:list-item>
+
+</text:list>
+
 <text:h text:outline-level="4"><text:bookmark text:name="tableofcontents"/>Table of Contents </text:h>
 
 <text:p text:style-name="Standard">By placing <text:span text:style-name="Source_20_Text">{{TOC}}</text:span> in your document, you can insert an automatically
index 4b7ecb349d1d806c6799df4fa5cc5fa9af688c35..be4247e644908b7ba2b47f5d605611f395e630e1 100644 (file)
@@ -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 <code>latex leader</code>, <code>latex
 begin</code>, and <code>latex footer</code>.</p>
 
+<p>There are new metadata keys for controlling internationalization:</p>
+
+<ul>
+<li><p><code>language</code> &#8211; specify the content language for a document, using the two
+letter code for the language (e.g. <code>en</code> for English). Where possible, this
+will also set the default <code>quotes language</code>.</p></li>
+<li><p><code>quotes language</code> &#8211; specify which variant of smart quotes to use. Valid
+options are <code>dutch</code>, <code>french</code>, <code>german</code>, <code>germanguillemets</code>, <code>swedish</code>, <code>nl</code>,
+<code>fr</code>, <code>de</code>, <code>sv</code>. Anything else defaults to English.</p></li>
+</ul>
+
 <h4 id="tableofcontents">Table of Contents </h4>
 
 <p>By placing <code>{{TOC}}</code> in your document, you can insert an automatically
index 92ddb34b7afdb7fe0a2c6c0cf0c16358574960d1..011eccfb7b04125d9c69fc9d41af827adf3c8f25 100644 (file)
Binary files a/QuickStart/QuickStart.pdf and b/QuickStart/QuickStart.pdf differ
index 57ec3b1bb448a95c5675e3ec7b0095eda111b72e..2dafc5566c5214731efd942427f9e4acea04d9da 100644 (file)
@@ -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 ##
 
index 6f260cbf03d42da4eec79046c4c25e68e28f903d..6a0a3a892b245e1bbd72bed156feec6abe7518f3 100644 (file)
@@ -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("</dc:language>\n");
        } else {
-               print_const("<dc:language>en</dc:language>\n");
+               switch(scratch->language) {
+                       case LC_ES:
+                               print_const("<dc:language>es</dc:language>\n");
+                               break;
+                       case LC_DE:
+                               print_const("<dc:language>de</dc:language>\n");
+                               break;
+                       case LC_FR:
+                               print_const("<dc:language>fr</dc:language>\n");
+                               break;
+                       case LC_NL:
+                               print_const("<dc:language>nl</dc:language>\n");
+                               break;
+                       case LC_SV:
+                               print_const("<dc:language>sv</dc:language>\n");
+                               break;
+                       default:
+                               print_const("<dc:language>en</dc:language>\n");
+               }
        }
 
        // Date
index b7992f8d8f6d78b6c8a2c4122c2c0e11a27d1472..d8baea84d038b43c5ae508f8594e2ff21845079b 100644 (file)
@@ -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<head>\n\t<meta charset=\"utf-8\"/>\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) {
index ae05e4a611772fc52813ce051d8676a7d9ef2502..ce547a7228fc35b1826ccaa49f08d64beb8785e6 100644 (file)
@@ -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) {
index 25f4e586802c32e9accb1bdb87d0e209b9f53c5d..64112f6e2c5af98e48904ce54f58940417417e7f 100644 (file)
@@ -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) {