]> granicus.if.org Git - multimarkdown/commitdiff
UPDATED: Add Spanish style quotes support
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 4 Dec 2017 00:33:55 +0000 (19:33 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 4 Dec 2017 00:33:55 +0000 (19:33 -0500)
13 files changed:
Sources/libMultiMarkdown/aho-corasick.c
Sources/libMultiMarkdown/file.c
Sources/libMultiMarkdown/file.h
Sources/libMultiMarkdown/fodt.c
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/include/libMultiMarkdown.h
Sources/libMultiMarkdown/latex.c
Sources/libMultiMarkdown/mmd.c
Sources/libMultiMarkdown/opendocument-content.c
Sources/libMultiMarkdown/writer.c
tests/MMD6Tests/Spanish.fodt
tests/MMD6Tests/Spanish.html
tests/MMD6Tests/Spanish.tex

index 90cd8bcb6feed37f752b0fcfb4f422f74cff2ee2..a9963806a09d1ab3396e238ad2556b4f4e07b2f8 100644 (file)
@@ -478,9 +478,9 @@ void match_set_filter_leftmost_longest(match * header) {
                                        m->next->start > m->start &&
                                        m->next->start < m->start + m->len) {
                                // This match is "lefter" than next
-#ifndef __clang_analyzer__
+                               #ifndef __clang_analyzer__
                                match_excise(m->next);
-#endif
+                               #endif
                        }
 
                        while (m->next &&
@@ -497,9 +497,9 @@ void match_set_filter_leftmost_longest(match * header) {
                                m->prev->start >= m->start) {
                        // We are "lefter" than previous
                        n = m->prev;
-#ifndef __clang_analyzer__
+                       #ifndef __clang_analyzer__
                        match_excise(n);
-#endif
+                       #endif
                }
 
                m = m->next;
index cc4edabf880b0ccbd34c547416383c7e2392f925..e87bdcd93a51dda0579870577adc93e9ccf227a8 100644 (file)
@@ -4,11 +4,11 @@
 
        @file file.c
 
-       @brief 
+       @brief
 
 
        @author Fletcher T. Penney
-       @bug    
+       @bug
 
 **/
 
 
 
        The `MultiMarkdown 6` project is released under the MIT License..
-       
+
        GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
-       
+
                https://github.com/fletcher/MultiMarkdown-4/
-       
+
        MMD 4 is released under both the MIT License and GPL.
-       
-       
+
+
        CuTest is released under the zlib/libpng license. See CuTest.c for the
        text of the license.
-       
+
        uthash library:
                Copyright (c) 2005-2016, Troy D. Hanson
-       
+
                Licensed under Revised BSD license
-       
+
        miniz library:
                Copyright 2013-2014 RAD Game Tools and Valve Software
                Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
-       
+
                Licensed under the MIT license
-       
+
        argtable3 library:
                Copyright (C) 1998-2001,2003-2011,2013 Stewart Heitmann
                <sheitmann@users.sourceforge.net>
                All rights reserved.
-       
+
                Licensed under the Revised BSD License
-       
-       
+
+
        ## The MIT License ##
-       
+
        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:
-       
+
        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.
-       
+
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-       
-       
+
+
        ## Revised BSD License ##
-       
+
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are
        met:
@@ -85,7 +85,7 @@
              names of its contributors may be used to endorse or promote
              products derived from this software without specific prior
              written permission.
-       
+
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -97,7 +97,7 @@
        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-       
+
 
 */
 
index 0c20108e69408c41a15e69fb795de2c80ff2eb64..03df7360419f325b6376bb8f46b2cb9692ee2bb7 100644 (file)
@@ -4,11 +4,11 @@
 
        @file file.h
 
-       @brief 
+       @brief
 
 
        @author Fletcher T. Penney
-       @bug    
+       @bug
 
 **/
 
 
 
        The `MultiMarkdown 6` project is released under the MIT License..
-       
+
        GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
-       
+
                https://github.com/fletcher/MultiMarkdown-4/
-       
+
        MMD 4 is released under both the MIT License and GPL.
-       
-       
+
+
        CuTest is released under the zlib/libpng license. See CuTest.c for the
        text of the license.
-       
+
        uthash library:
                Copyright (c) 2005-2016, Troy D. Hanson
-       
+
                Licensed under Revised BSD license
-       
+
        miniz library:
                Copyright 2013-2014 RAD Game Tools and Valve Software
                Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
-       
+
                Licensed under the MIT license
-       
+
        argtable3 library:
                Copyright (C) 1998-2001,2003-2011,2013 Stewart Heitmann
                <sheitmann@users.sourceforge.net>
                All rights reserved.
-       
+
                Licensed under the Revised BSD License
-       
-       
+
+
        ## The MIT License ##
-       
+
        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:
-       
+
        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.
-       
+
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
        TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
        SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-       
-       
+
+
        ## Revised BSD License ##
-       
+
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are
        met:
@@ -85,7 +85,7 @@
              names of its contributors may be used to endorse or promote
              products derived from this software without specific prior
              written permission.
-       
+
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -97,7 +97,7 @@
        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
        NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-       
+
 
 */
 
@@ -146,8 +146,8 @@ char * absolute_path_for_argument(const char * arg);
 
 
 #if (defined(_WIN32) || defined(__WIN32__))
-// Windows does not know realpath(), so we need a "windows port"
-char *realpath(const char *path, char *resolved_path);
+       // Windows does not know realpath(), so we need a "windows port"
+       char *realpath(const char *path, char *resolved_path);
 #endif
 
 #endif
index d98b1647f366def4dfdb3ae4101ca39abd07b02a..6c80f84328c6049bdfb2820d4a6fcc8c0a27359e 100644 (file)
@@ -200,6 +200,7 @@ void mmd_print_localized_char_odf(DString * out, unsigned short type, scratch_pa
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("&#171;");
                                        break;
 
@@ -224,6 +225,7 @@ void mmd_print_localized_char_odf(DString * out, unsigned short type, scratch_pa
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("&#187;");
                                        break;
 
index 69873693d191a943bfcfec80f60a5a8d4db6afb5..fdc89c2aa68da999a93764add07539d08cedd7c8 100644 (file)
@@ -209,6 +209,7 @@ void mmd_print_localized_char_html(DString * out, unsigned short type, scratch_p
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("&#171;");
                                        break;
 
@@ -233,6 +234,7 @@ void mmd_print_localized_char_html(DString * out, unsigned short type, scratch_p
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("&#187;");
                                        break;
 
index f9d1ee453855eb8276a7e4704df322894a7eda7a..36ef0204375208085d11d3fed75ba7d357c6df33 100644 (file)
@@ -520,6 +520,7 @@ enum smart_quotes_language {
        FRENCH,
        GERMAN,
        GERMANGUILL,
+       SPANISH,
        SWEDISH,
 };
 
index 81af5e0d191cdc4b7a05e3fdbe457e1f28ca2c89..03cde7185f0e957e460146aab99c6cb39a0c83f7 100644 (file)
@@ -214,6 +214,7 @@ void mmd_print_localized_char_latex(DString * out, unsigned short type, scratch_
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("«");
                                        break;
 
@@ -238,6 +239,7 @@ void mmd_print_localized_char_latex(DString * out, unsigned short type, scratch_
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("»");
                                        break;
 
index 131525422fdda189dcb049d0a5edf980d4514c0e..2ffde95a334047adfd8998d151fcc6c72c636f90 100644 (file)
@@ -237,7 +237,7 @@ void mmd_engine_set_language(mmd_engine * e, short language) {
                        break;
 
                case LC_ES:
-                       e->quotes_lang = ENGLISH;
+                       e->quotes_lang = SPANISH;
                        break;
 
                case LC_FR:
@@ -2398,7 +2398,7 @@ char * mmd_engine_metavalue_for_key(mmd_engine * e, const char * key) {
        if (e == NULL || key == NULL) {
                return NULL;
        }
-       
+
        if (e->metadata_stack->size == 0) {
                // Ensure we have checked for metadata
                if (!mmd_engine_has_metadata(e, NULL)) {
index 27ecbf019266250f4c65076d1f8c6963c02ceaba..9fc6a91a252623b9be8d1049b4093826907cafc0 100644 (file)
@@ -246,6 +246,7 @@ void mmd_print_localized_char_opendocument(DString * out, unsigned short type, s
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("&#171;");
                                        break;
 
@@ -270,6 +271,7 @@ void mmd_print_localized_char_opendocument(DString * out, unsigned short type, s
                                        break;
 
                                case FRENCH:
+                               case SPANISH:
                                        print_const("&#187;");
                                        break;
 
index f1e90aad3d98fc9970742523f68b860d801944e8..1d9bd778825c8e33b95666d748391cf5dbd84ccd 100644 (file)
@@ -598,10 +598,10 @@ attr * parse_attributes(char * source) {
                        a->next = attr_new(key, value);
                        a = a->next;
                } else {
-#ifndef __clang_analyzer__
+                       #ifndef __clang_analyzer__
                        a = attr_new(key, value);
                        attributes = a;
-#endif
+                       #endif
                }
 
                free(value);    // We stored a modified copy
@@ -1620,7 +1620,7 @@ void process_metadata_stack(mmd_engine * e, scratch_pad * scratch) {
                                scratch->quotes_lang = GERMAN;
                        } else if (strcmp(temp_char, "es") == 0) {
                                scratch->language = LC_ES;
-                               scratch->quotes_lang = ENGLISH;
+                               scratch->quotes_lang = SPANISH;
                        } else if (strcmp(temp_char, "fr") == 0) {
                                scratch->language = LC_FR;
                                scratch->quotes_lang = FRENCH;
@@ -1662,6 +1662,9 @@ void process_metadata_stack(mmd_engine * e, scratch_pad * scratch) {
                                scratch->quotes_lang = GERMAN;
                        } else if (strcmp(temp_char, "germanguillemets") == 0) {
                                scratch->quotes_lang = GERMANGUILL;
+                       } else if ((strcmp(temp_char, "spanish") == 0) ||
+                                          (strcmp(temp_char, "es") == 0)) {
+                               scratch->quotes_lang = SPANISH;
                        } else if ((strcmp(temp_char, "swedish") == 0) ||
                                           (strcmp(temp_char, "sv") == 0)) {
                                scratch->quotes_lang = SWEDISH;
index 547ae3285e373388190c6cfd5dea8f6ac5500d6a..943bd34e6b45bd59dc794a8af365cff5bad9bb8e 100644 (file)
@@ -280,7 +280,7 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 <office:text>
 <text:p text:style-name="Standard">&#8216;foo&#8217;</text:p>
 
-<text:p text:style-name="Standard">&#8220;foo&#8221;</text:p>
+<text:p text:style-name="Standard">&#171;foo&#187;</text:p>
 
 <text:p text:style-name="Standard">foo&#8217;s</text:p>
 
index d17d5f6d039be07e5f53d362531fc080e314a3ff..782a52c5f5e12eb5e2c265c96a887b1df0e21894 100644 (file)
@@ -8,7 +8,7 @@
 
 <p>&#8216;foo&#8217;</p>
 
-<p>&#8220;foo&#8221;</p>
+<p>&#171;foo&#187;</p>
 
 <p>foo&#8217;s</p>
 
index 5da7605feb602e2117bc205ae7620b9e076c2242..a475ffe2732ad4787c1fd298c38009fc71434e31 100644 (file)
@@ -4,7 +4,7 @@
 
 `foo'
 
-``foo''
+«foo»
 
 foo's