]> granicus.if.org Git - multimarkdown/commitdiff
UPDATED: Add astyle configuration to tidy c source files
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 21 Jul 2017 22:22:14 +0000 (18:22 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 21 Jul 2017 22:22:14 +0000 (18:22 -0400)
27 files changed:
.astylerc [new file with mode: 0644]
Makefile
Sources/libMultiMarkdown/aho-corasick.c
Sources/libMultiMarkdown/beamer.c
Sources/libMultiMarkdown/char.c
Sources/libMultiMarkdown/char_lookup.c
Sources/libMultiMarkdown/critic_markup.c
Sources/libMultiMarkdown/d_string.c
Sources/libMultiMarkdown/epub.c
Sources/libMultiMarkdown/fodt.c
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/latex.c
Sources/libMultiMarkdown/memoir.c
Sources/libMultiMarkdown/mmd.c
Sources/libMultiMarkdown/object_pool.c
Sources/libMultiMarkdown/opendocument-content.c
Sources/libMultiMarkdown/opendocument.c
Sources/libMultiMarkdown/rng.c
Sources/libMultiMarkdown/stack.c
Sources/libMultiMarkdown/textbundle.c
Sources/libMultiMarkdown/token.c
Sources/libMultiMarkdown/token_pairs.c
Sources/libMultiMarkdown/transclude.c
Sources/libMultiMarkdown/uuid.c
Sources/libMultiMarkdown/writer.c
Sources/libMultiMarkdown/zip.c
Sources/multimarkdown/main.c

diff --git a/.astylerc b/.astylerc
new file mode 100644 (file)
index 0000000..6acda5c
--- /dev/null
+++ b/.astylerc
@@ -0,0 +1,19 @@
+# Brace style
+--style=java
+
+
+# Indents
+--indent=tab=4
+
+# Switch statements
+--indent-switches
+
+
+# Excludes
+--exclude="Sources/libMultiMarkdown/scanners.c"
+--exclude="Sources/libMultiMarkdown/parser.c"
+--exclude="Sources/libMultiMarkdown/lexer.c"
+--exclude="Sources/multimarkdown/argtable3.c"
+--exclude="Sources/libMultiMarkdown/miniz.c"
+
+--ignore-exclude-errors
index 0f9c9791d9724ccb33e3fb2651fc4579db64cd1f..93f4e23830b33a09facb2ed22ea23723f4497c16 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -125,3 +125,7 @@ $(XCODE_DEBUG_BUILD_DIR):
 CHANGELOG:
        -git log master..develop --format="*    %s" | sort | uniq > CHANGELOG-UNRELEASED
 
+# Use astyle
+.PHONY : astyle
+astyle:
+       astyle --options=.astylerc "Sources/libMultiMarkdown/*.c" "Sources/multimarkdown/*.c"
index 44cedec10f6c511914ac4ef5dad469d1b42084b7..38020dbfd38f57acbeb60a101c6e0cc896b0fa4f 100644 (file)
@@ -11,7 +11,7 @@
 
 
        @author Fletcher T. Penney
-       @bug    
+       @bug
 
 **/
 
 
 
        The `c-template` 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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -280,10 +280,9 @@ void ac_trie_node_prepare(trie * a, size_t s, char * buffer, unsigned short dept
 
 
        // Prepare children
-       for (int i = 0; i < 256; ++i)
-       {
+       for (int i = 0; i < 256; ++i) {
                if ((n->child[i] != 0) &&
-                       (n->child[i] != s)) {
+                       (n->child[i] != s)) {
                        buffer[depth] = i;
 
                        ac_trie_node_prepare(a, n->child[i], buffer, depth + 1, last_match_state);
@@ -294,8 +293,7 @@ void ac_trie_node_prepare(trie * a, size_t s, char * buffer, unsigned short dept
 /// Prepare trie for Aho-Corasick search algorithm by mapping failure connections
 void ac_trie_prepare(trie * a) {
        // Clear old pointers
-       for (size_t i = 0; i < a->size; ++i)
-       {
+       for (size_t i = 0; i < a->size; ++i) {
                a->node[i].ac_fail = 0;
        }
 
@@ -401,7 +399,7 @@ match * ac_trie_search(trie * a, const char * source, size_t start, size_t len)
                                        m = result;
                                }
                                m = match_add(m, counter - a->node[temp_state].len,
-                                       a->node[temp_state].len, a->node[temp_state].match_type);
+                                             a->node[temp_state].len, a->node[temp_state].match_type);
                        }
 
                        // Iterate to find shorter matches
@@ -442,8 +440,8 @@ int match_count(match * m) {
 
 
 void match_describe(match * m, const char * source) {
-       fprintf(stderr, "'%.*s'(%d) at %lu:%lu\n", (int)m->len, &source[m->start], 
-               m->match_type, m->start, m->start + m->len);
+       fprintf(stderr, "'%.*s'(%d) at %lu:%lu\n", (int)m->len, &source[m->start],
+               m->match_type, m->start, m->start + m->len);
 }
 
 
@@ -471,15 +469,15 @@ void match_set_filter_leftmost_longest(match * header) {
                                continue;
                        }
 
-                       while (m->next && 
-                               m->next->start > m->start &&
-                               m->next->start < m->start + m->len) {
+                       while (m->next &&
+                               m->next->start > m->start &&
+                               m->next->start < m->start + m->len) {
                                // This match is "lefter" than next
                                match_excise(m->next);
                        }
 
                        while (m->next &&
-                               m->next->start < m->start) {
+                               m->next->start < m->start) {
                                // Next match is "lefter" than us
                                n = m;
                                m = m->prev;
@@ -488,8 +486,8 @@ void match_set_filter_leftmost_longest(match * header) {
                }
 
                while (m->prev &&
-                       m->prev->len &&
-                       m->prev->start >= m->start) {
+                       m->prev->len &&
+                       m->prev->start >= m->start) {
                        // We are "lefter" than previous
                        n = m->prev;
                        match_excise(n);
@@ -564,8 +562,7 @@ void trie_node_to_graphviz(trie * a, size_t s) {
        if (n->match_type)
                fprintf(stderr, "\"%lu\" [shape=doublecircle]\n", s);
 
-       for (int i = 0; i < 256; ++i)
-       {
+       for (int i = 0; i < 256; ++i) {
                if (n->child[i]) {
                        switch (i) {
                                default:
@@ -581,8 +578,7 @@ void trie_node_to_graphviz(trie * a, size_t s) {
 
 void trie_to_graphviz(trie * a) {
        fprintf(stderr, "digraph dfa {\n");
-       for (int i = 0; i <  a->size; ++i)
-       {
+       for (int i = 0; i <  a->size; ++i) {
                trie_node_to_graphviz(a, i);
        }
        fprintf(stderr, "}\n");
index bb6d8306209194e1206493a7d189ecc94692fad4..bf7a9fb1e9ecd18165cebd245a5c89cd004a784c 100644 (file)
@@ -4,11 +4,11 @@
 
        @file beamer.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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -67,7 +67,7 @@
 void mmd_outline_add_beamer(DString * out, token * current, scratch_pad * scratch) {
        token * t;
        short level;            // Header level we are adding
-       short t_level;  
+       short t_level;
        stack * s = scratch->outline_stack;
 
        if (current) {
@@ -236,7 +236,7 @@ void mmd_export_token_beamer(DString * out, const char * source, token * t, scra
                                        temp_char = label_from_token(source, t);
                                }
                                printf("}\n\\label{%s}", temp_char);
-       
+
                                if (temp_char)
                                        free(temp_char);
                        }
@@ -281,8 +281,7 @@ void mmd_export_citation_list_beamer(DString * out, const char * source, scratch
                print_const("\\part{Bibliography}\n\\begin{frame}[allowframebreaks]\n\\frametitle{Bibliography}\n\\def\\newblock{}\n\\begin{thebibliography}{0}");
                scratch->padded = 0;
 
-               for (int i = 0; i < scratch->used_citations->size; ++i)
-               {
+               for (int i = 0; i < scratch->used_citations->size; ++i) {
                        // Export footnote
                        pad(out, 2, scratch);
 
index f9d12592f401598acb8702d52124413eda47f82e..1f8b1f3d719c6a73e90ff3f22666952c9beb284a 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
 
 /// Create this lookup table using char_lookup.c
 static unsigned char smart_char_type[256] = {
- 16,  0,  0,  0,  0,  0,  0,  0,  0,  1, 16,  0,  0, 16,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
-  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  2,  2,  2,  2,  2,  2,
-  2,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
-  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  2,
-  2,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
-  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
      16,  0,  0,  0,  0,  0,  0,  0,  0,  1, 16,  0,  0, 16,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       1,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
+       8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  2,  2,  2,  2,  2,  2,
+       2,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
+       4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  2,
+       2,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
+       4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
 };
 
 
@@ -111,7 +111,7 @@ int char_is_windows_line_ending(char * c) {
 #ifdef TEST
 void Test_char_is_windows_line_ending(CuTest* tc) {
        char * test = "\r\n\n";
-       
+
        CuAssertIntEquals(tc, 1, char_is_windows_line_ending(&test[0]));
        CuAssertIntEquals(tc, 1, char_is_windows_line_ending(&test[1]));
        CuAssertIntEquals(tc, 0, char_is_windows_line_ending(&test[2]));
@@ -120,22 +120,22 @@ void Test_char_is_windows_line_ending(CuTest* tc) {
 
 // Is character punctuation?
 int char_is_punctuation(char c) {
-       return smart_char_type[(unsigned char) c] & CHAR_PUNCTUATION;   
+       return smart_char_type[(unsigned char) c] & CHAR_PUNCTUATION;
 }
 
 // Is character alpha?
 int char_is_alpha(char c) {
-       return smart_char_type[(unsigned char) c] & CHAR_ALPHA; 
+       return smart_char_type[(unsigned char) c] & CHAR_ALPHA;
 }
 
 // Is character digit?
 int char_is_digit(char c) {
-       return smart_char_type[(unsigned char) c] & CHAR_DIGIT; 
+       return smart_char_type[(unsigned char) c] & CHAR_DIGIT;
 }
 
 // Is character alphanumeric?
 int char_is_alphanumeric(char c) {
-       return smart_char_type[(unsigned char) c] & CHAR_ALPHANUMERIC;  
+       return smart_char_type[(unsigned char) c] & CHAR_ALPHANUMERIC;
 }
 
 // Is character either whitespace or line ending?
@@ -150,5 +150,5 @@ int char_is_whitespace_or_punctuation(char c) {
 
 // Is character either whitespace or line ending or punctuation?
 int char_is_whitespace_or_line_ending_or_punctuation(char c) {
-       return smart_char_type[(unsigned char) c] & CHAR_WHITESPACE_OR_LINE_ENDING_OR_PUNCTUATION;      
+       return smart_char_type[(unsigned char) c] & CHAR_WHITESPACE_OR_LINE_ENDING_OR_PUNCTUATION;
 }
index bcf59db4acd05b7e4589567d538111cf62249bf5..26799a8041cd2c8ba41fe76cb68d16405c12a402 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -124,18 +124,15 @@ int main( int argc, char** argv ) {
 
 
        // Define digits
-       for (char i = '0'; i <= '9'; ++i)
-       {
+       for (char i = '0'; i <= '9'; ++i) {
                digit(i);
        }
 
        // Define alpha
-       for (char i = 'a'; i <= 'z'; ++i)
-       {
+       for (char i = 'a'; i <= 'z'; ++i) {
                alpha(i);
        }
-       for (char i = 'A'; i <= 'Z'; ++i)
-       {
+       for (char i = 'A'; i <= 'Z'; ++i) {
                alpha(i);
        }
 
@@ -199,10 +196,8 @@ int main( int argc, char** argv ) {
 
 
        // Print output as 16 x 16 table
-       for (int i = 0; i < 16; ++i)
-       {
-               for (int j = 0; j < 16; ++j)
-               {
+       for (int i = 0; i < 16; ++i) {
+               for (int j = 0; j < 16; ++j) {
                        fprintf(stdout, "%3d,", table[i * 16 + j]);
                }
 
index 17457e751a89bd7707d5d0262d0ee31095c2d7e7..61b2954949ee0e2064c710aed2170bc52e0124fa 100644 (file)
@@ -4,11 +4,11 @@
 
        @file critic_markup.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.
-       
-       
+
+
        ## 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.
@@ -50,7 +50,7 @@
        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.
-       
+
 
 */
 
index d20ae46b0299c811e6c66d146b5d1ddac185402f..eac5328ba64dfeb56faf8311a297a3b650ee2168 100644 (file)
@@ -10,7 +10,7 @@
 
        @author Daniel Jalkut, modified by Fletcher T. Penney and Dan Lowe
 
-       @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -101,10 +101,9 @@ int vasprintf(char** strp, const char* fmt, va_list ap) {
 
 
 /// Create a new dynamic string
-DString* d_string_new(const char * startingString)
-{
+DString* d_string_new(const char * startingString) {
        DString* newString = malloc(sizeof(DString));
-       
+
        if (!newString)
                return NULL;
 
@@ -112,11 +111,10 @@ DString* d_string_new(const char * startingString)
 
        size_t startingBufferSize = kStringBufferStartingSize;
        size_t startingStringSize = strlen(startingString);
-       while (startingBufferSize < (startingStringSize + 1))
-       {
+       while (startingBufferSize < (startingStringSize + 1)) {
                startingBufferSize *= kStringBufferGrowthMultiplier;
        }
-       
+
        newString->str = malloc(startingBufferSize);
 
        if (!newString->str) {
@@ -128,59 +126,53 @@ DString* d_string_new(const char * startingString)
        strncpy(newString->str, startingString, startingStringSize);
        newString->str[startingStringSize] = '\0';
        newString->currentStringLength = startingStringSize;
-       
+
        return newString;
 }
 
 
 /// Free dynamic string
-char* d_string_free(DString * ripString, bool freeCharacterData)
-{      
+char* d_string_free(DString * ripString, bool freeCharacterData) {
        if (ripString == NULL)
                return NULL;
-       
+
        char* returnedString = ripString->str;
-       if (freeCharacterData)
-       {
-               if (ripString->str != NULL)
-               {
+       if (freeCharacterData) {
+               if (ripString->str != NULL) {
                        free(ripString->str);
                }
                returnedString = NULL;
        }
-       
+
        free(ripString);
-       
+
        return returnedString;
 }
 
 
 /// Ensure that dynamic string has specified capacity
-static void ensureStringBufferCanHold(DString * baseString, size_t newStringSize)
-{
+static void ensureStringBufferCanHold(DString * baseString, size_t newStringSize) {
        size_t newBufferSizeNeeded = newStringSize + 1;
-       if (newBufferSizeNeeded > baseString->currentStringBufferSize)
-       {
-               size_t newBufferSize = baseString->currentStringBufferSize;     
+       if (newBufferSizeNeeded > baseString->currentStringBufferSize) {
+               size_t newBufferSize = baseString->currentStringBufferSize;
 
-               while (newBufferSizeNeeded > newBufferSize)
-               {
+               while (newBufferSizeNeeded > newBufferSize) {
                        if (newBufferSize > kStringBufferMaxIncrement) {
                                newBufferSize += kStringBufferMaxIncrement;
                        } else {
                                newBufferSize *= kStringBufferGrowthMultiplier;
                        }
                }
-               
-        char *temp;
-        temp = realloc(baseString->str, newBufferSize);
-        
-        if (temp == NULL) {
-            /* realloc failed */
-            fprintf(stderr, "Error reallocating memory for d_string. Current buffer size %lu.\n",baseString->currentStringBufferSize);
-
-            exit(1);
-        }
+
+               char *temp;
+               temp = realloc(baseString->str, newBufferSize);
+
+               if (temp == NULL) {
+                       /* realloc failed */
+                       fprintf(stderr, "Error reallocating memory for d_string. Current buffer size %lu.\n",baseString->currentStringBufferSize);
+
+                       exit(1);
+               }
                baseString->str = temp;
                baseString->currentStringBufferSize = newBufferSize;
        }
@@ -188,12 +180,10 @@ static void ensureStringBufferCanHold(DString * baseString, size_t newStringSize
 
 
 /// Append null-terminated string to end of dynamic string
-void d_string_append(DString * baseString, const char * appendedString)
-{
+void d_string_append(DString * baseString, const char * appendedString) {
        size_t appendedStringLength = strlen(appendedString);
 
-       if ((appendedString != NULL) && (appendedStringLength > 0))
-       {
+       if ((appendedString != NULL) && (appendedStringLength > 0)) {
                size_t newStringLength = baseString->currentStringLength + appendedStringLength;
                ensureStringBufferCanHold(baseString, newStringLength);
 
@@ -205,20 +195,18 @@ void d_string_append(DString * baseString, const char * appendedString)
 
 
 /// Append single character to end of dynamic string
-void d_string_append_c(DString * baseString, char appendedCharacter)
-{      
+void d_string_append_c(DString * baseString, char appendedCharacter) {
        size_t newSizeNeeded = baseString->currentStringLength + 1;
        ensureStringBufferCanHold(baseString, newSizeNeeded);
-       
+
        baseString->str[baseString->currentStringLength] = appendedCharacter;
-       baseString->currentStringLength++;      
+       baseString->currentStringLength++;
        baseString->str[baseString->currentStringLength] = '\0';
 }
 
 
 /// Append array of characters to end of dynamic string
-void d_string_append_c_array(DString * baseString, const char * appendedChars, size_t bytes)
-{
+void d_string_append_c_array(DString * baseString, const char * appendedChars, size_t bytes) {
        size_t newSizeNeeded = baseString->currentStringLength + bytes;
        ensureStringBufferCanHold(baseString, newSizeNeeded);
 
@@ -230,29 +218,25 @@ void d_string_append_c_array(DString * baseString, const char * appendedChars, s
 
 
 /// Append to end of dynamic string using format specifier
-void d_string_append_printf(DString * baseString, const char * format, ...)
-{
+void d_string_append_printf(DString * baseString, const char * format, ...) {
        va_list args;
        va_start(args, format);
-       
+
        char* formattedString = NULL;
        vasprintf(&formattedString, format, args);
-       if (formattedString != NULL)
-       {
+       if (formattedString != NULL) {
                d_string_append(baseString, formattedString);
                free(formattedString);
        }
        va_end(args);
-} 
+}
 
 
 /// Prepend null-terminated string to end of dynamic string
-void d_string_prepend(DString * baseString, const char * prependedString)
-{
+void d_string_prepend(DString * baseString, const char * prependedString) {
        size_t prependedStringLength = strlen(prependedString);
 
-       if ((prependedString != NULL) && (prependedStringLength > 0))
-       {
+       if ((prependedString != NULL) && (prependedStringLength > 0)) {
                size_t newStringLength = baseString->currentStringLength + prependedStringLength;
                ensureStringBufferCanHold(baseString, newStringLength);
 
@@ -265,18 +249,16 @@ void d_string_prepend(DString * baseString, const char * prependedString)
 
 
 /// Insert null-terminated string inside dynamic string
-void d_string_insert(DString * baseString, size_t pos, const char * insertedString)
-{
+void d_string_insert(DString * baseString, size_t pos, const char * insertedString) {
        size_t insertedStringLength = strlen(insertedString);
 
-       if ((insertedString != NULL) && (insertedStringLength > 0))
-       {
+       if ((insertedString != NULL) && (insertedStringLength > 0)) {
                if (pos > baseString->currentStringLength)
                        pos = baseString->currentStringLength;
-               
+
                size_t newStringLength = baseString->currentStringLength + insertedStringLength;
                ensureStringBufferCanHold(baseString, newStringLength);
-               
+
                /* Shift following string to 'right' */
                memmove(baseString->str + pos + insertedStringLength, baseString->str + pos, baseString->currentStringLength - pos);
                strncpy(baseString->str + pos, insertedString, insertedStringLength);
@@ -287,33 +269,30 @@ void d_string_insert(DString * baseString, size_t pos, const char * insertedStri
 
 
 /// Insert single character inside dynamic string
-void d_string_insert_c(DString * baseString, size_t pos, char insertedCharacter)
-{      
+void d_string_insert_c(DString * baseString, size_t pos, char insertedCharacter) {
        if (pos > baseString->currentStringLength)
                pos = baseString->currentStringLength;
-       
+
        size_t newSizeNeeded = baseString->currentStringLength + 1;
        ensureStringBufferCanHold(baseString, newSizeNeeded);
-       
+
        /* Shift following string to 'right' */
        memmove(baseString->str + pos + 1, baseString->str + pos, baseString->currentStringLength - pos);
-       
+
        baseString->str[pos] = insertedCharacter;
-       baseString->currentStringLength++;      
+       baseString->currentStringLength++;
        baseString->str[baseString->currentStringLength] = '\0';
 }
 
 
 /// Insert inside dynamic string using format specifier
-void d_string_insert_printf(DString * baseString, size_t pos, const char * format, ...)
-{
+void d_string_insert_printf(DString * baseString, size_t pos, const char * format, ...) {
        va_list args;
        va_start(args, format);
-       
+
        char* formattedString = NULL;
        vasprintf(&formattedString, format, args);
-       if (formattedString != NULL)
-       {
+       if (formattedString != NULL) {
                d_string_insert(baseString, pos, formattedString);
                free(formattedString);
        }
@@ -322,43 +301,42 @@ void d_string_insert_printf(DString * baseString, size_t pos, const char * forma
 
 
 /// Erase portion of dynamic string
-void d_string_erase(DString * baseString, size_t pos, size_t len)
-{
+void d_string_erase(DString * baseString, size_t pos, size_t len) {
        if ((pos > baseString->currentStringLength) || (len <= 0))
                return;
-       
-       if ((pos + len) >= baseString->currentStringLength) 
+
+       if ((pos + len) >= baseString->currentStringLength)
                len = -1;
-       
+
        if (len == -1) {
                baseString->currentStringLength = pos;
        } else {
                memmove(baseString->str + pos, baseString->str + pos + len, baseString->currentStringLength - pos - len);
                baseString->currentStringLength -= len;
        }
-       
+
        baseString->str[baseString->currentStringLength] = '\0';
 }
 
 /// Copy a portion of dynamic string
 char * d_string_copy_substring(DString * d, size_t start, size_t len) {
        char * result;
-       
+
        if (len == -1) {
                len = d->currentStringLength - start;
        } else {
                if (start + len > d->currentStringLength) {
                        fprintf(stderr, "d_string: Asked to copy invalid substring range.\n");
                        fprintf(stderr, "start: %lu  len: %lu  string: %lu\n", start, len,
-                                       d->currentStringLength);
+                               d->currentStringLength);
                        return NULL;
                }
        }
-       
+
        result = malloc(len + 1);
        strncpy(result, &d->str[start], len);
        result[len] = '\0';
-       
+
        return result;
 }
 
index 5bd83026dec326133e5b6b3a13a2be421a82aece..e07bb99197d281bbcecbe19732dba4a9026537ab 100644 (file)
@@ -4,11 +4,11 @@
 
        @file epub.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.
-       
-       
+
+
        ## 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.
@@ -50,7 +50,7 @@
        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.
-       
+
 
 */
 
@@ -108,7 +108,7 @@ char * epub_container_xml(void) {
 
        char * result = container->str;
        d_string_free(container, false);
-       return result;  
+       return result;
 }
 
 
@@ -122,7 +122,7 @@ char * epub_package_document(scratch_pad * scratch) {
 
 
        // Metadata
-       d_string_append(out, "<metadata xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n");     
+       d_string_append(out, "<metadata xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n");
 
        // Identifier
        HASH_FIND_STR(scratch->meta_hash, "uuid", m);
@@ -197,7 +197,7 @@ char * epub_package_document(scratch_pad * scratch) {
                struct tm * today = localtime(&t);
 
                d_string_append_printf(out, "<meta property=\"dcterms:modified\">%d-%02d-%02d</meta>\n",
-                       today->tm_year + 1900, today->tm_mon + 1, today->tm_mday);
+                                      today->tm_year + 1900, today->tm_mon + 1, today->tm_mday);
        }
 
        d_string_append(out, "</metadata>\n");
@@ -205,13 +205,13 @@ char * epub_package_document(scratch_pad * scratch) {
 
        // Manifest
        d_string_append(out, "<manifest>\n");
-    d_string_append(out, "<item id=\"nav\" href=\"nav.xhtml\" properties=\"nav\" media-type=\"application/xhtml+xml\"/>\n");
-    d_string_append(out, "<item id=\"main\" href=\"main.xhtml\" media-type=\"application/xhtml+xml\"/>\n");
+       d_string_append(out, "<item id=\"nav\" href=\"nav.xhtml\" properties=\"nav\" media-type=\"application/xhtml+xml\"/>\n");
+       d_string_append(out, "<item id=\"main\" href=\"main.xhtml\" media-type=\"application/xhtml+xml\"/>\n");
        d_string_append(out, "</manifest>\n");
 
        // Spine
        d_string_append(out, "<spine>\n");
-    d_string_append(out, "<itemref idref=\"main\"/>");
+       d_string_append(out, "<itemref idref=\"main\"/>");
        d_string_append(out, "</spine>\n");
 
        d_string_append(out, "</package>\n");
@@ -260,7 +260,7 @@ void epub_export_nav_entry(DString * out, const char * source, scratch_pad * scr
                        (*counter)--;
                        break;
                }
-               
+
                // Increment counter
                (*counter)++;
        }
@@ -292,7 +292,7 @@ char * epub_nav(mmd_engine * e, scratch_pad * scratch) {
                print_const("Untitled");
        }
        print_const("</title>\n</head>\n");
-       
+
        print_const("<body>\n<nav epub:type=\"toc\">\n");
        print_const("<h2>Table of Contents</h2>\n");
 
@@ -302,14 +302,14 @@ char * epub_nav(mmd_engine * e, scratch_pad * scratch) {
 
        char * result = out->str;
        d_string_free(out, false);
-       return result;  
+       return result;
 }
 
 
 static bool add_asset_from_file(mz_zip_archive * pZip, asset * a, const char * destination, const char * directory) {
        if (!directory)
                return false;
-       
+
        char * path = path_from_dir_base(directory, a->url);
        mz_bool status;
        bool result = false;
@@ -365,17 +365,17 @@ static size_t write_memory(void * contents, size_t size, size_t nmemb, void * us
 static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * directory) {
        asset * a, * a_tmp;
 
-       if (e->asset_hash){
+       if (e->asset_hash) {
                CURL * curl;
                CURLcode res;
-               
+
                struct MemoryStruct chunk;
                chunk.memory = malloc(1);
                chunk.size = 0;
 
                char destination[100] = "OEBPS/assets/";
                destination[49] = '\0';
-               
+
                mz_bool status;
 
                curl_global_init(CURL_GLOBAL_ALL);
@@ -413,11 +413,11 @@ static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * direc
 static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * directory) {
        asset * a, * a_tmp;
 
-       if (e->asset_hash){
+       if (e->asset_hash) {
 
                char destination[100] = "OEBPS/assets/";
                destination[49] = '\0';
-               
+
                mz_bool status;
 
                HASH_ITER(hh, e->asset_hash, a, a_tmp) {
index b6ed66a71eb2dbb8fd1fe8bcdca3543ca7d97b66..66f47adfb8c81401ca87af7582a7f6531366907b 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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.
@@ -50,7 +50,7 @@
        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.
-       
+
 
 */
 
@@ -112,7 +112,7 @@ void mmd_print_char_odf(DString * out, char c) {
 void mmd_print_string_odf(DString * out, const char * str) {
        if (str == NULL)
                return;
-       
+
        while (*str != '\0') {
                mmd_print_char_odf(out, *str);
                str++;
@@ -150,7 +150,7 @@ void mmd_print_localized_char_odf(DString * out, unsigned short type, scratch_pa
                                        break;
                                default:
                                        print_const("&#8216;");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_SINGLE:
                        switch (scratch->quotes_lang) {
@@ -162,7 +162,7 @@ void mmd_print_localized_char_odf(DString * out, unsigned short type, scratch_pa
                                        break;
                                default:
                                        print_const("&#8217;");
-                               }
+                       }
                        break;
                case QUOTE_LEFT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -181,7 +181,7 @@ void mmd_print_localized_char_odf(DString * out, unsigned short type, scratch_pa
                                        break;
                                default:
                                        print_const("&#8220;");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -198,7 +198,7 @@ void mmd_print_localized_char_odf(DString * out, unsigned short type, scratch_pa
                                case DUTCH:
                                default:
                                        print_const("&#8221;");
-                               }
+                       }
                        break;
        }
 }
@@ -225,7 +225,7 @@ void mmd_export_link_odf(DString * out, const char * source, token * text, link
                text->child->next->start--;
                text->child->next->len++;
        }
-       
+
        mmd_export_token_tree_odf(out, source, text->child, scratch);
 
        print_const("</text:a>");
@@ -235,17 +235,17 @@ void mmd_export_link_odf(DString * out, const char * source, token * text, link
 static char * correct_dimension_units(char *original) {
        char *result;
        int i;
-       
+
        result = my_strdup(original);
-       
+
        for (i = 0; result[i]; i++)
                result[i] = tolower(result[i]);
-       
+
        if (strstr(&result[strlen(result)-2],"px")) {
                result[strlen(result)-2] = '\0';
                strcat(result, "pt");
        }
-       
+
        return result;
 }
 
@@ -342,7 +342,7 @@ void mmd_export_toc_entry_odf(DString * out, const char * source, scratch_pad *
                        (*counter)--;
                        break;
                }
-               
+
                // Increment counter
                (*counter)++;
        }
@@ -409,8 +409,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                        print_token(t);
                                } else {
                                        print_localized(QUOTE_LEFT_DOUBLE);
-                               }
-                       else if (t->start < t->mate->start) {
+                               } else if (t->start < t->mate->start) {
                                print_const("<text:span text:style-name=\"Source_20_Text\">");
                        } else {
                                print_const("</text:span>");
@@ -449,7 +448,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                                        d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
                                                        scratch->padded = 1;
                                                } else {
-                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);                                                      
+                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
                                                        scratch->padded = 0;
                                                }
                                        }
@@ -458,7 +457,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                        break;
                                }
                        }
-                       
+
                        free(temp_char);
 
                        print_const("<text:p text:style-name=\"Preformatted Text\">");
@@ -487,7 +486,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                mmd_export_token_tree_odf(out, source, t->child, scratch);
                                print_const("</text:p>");
                        } else {
-                               mmd_export_token_tree_odf(out, source, t->child, scratch);                              
+                               mmd_export_token_tree_odf(out, source, t->child, scratch);
                        }
                        scratch->padded = 0;
 
@@ -502,7 +501,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
 
 //                     if (!(t->prev && (t->prev->type == BLOCK_DEFLIST)))
 //                             print_const("<dl>\n");
-       
+
                        scratch->padded = 2;
 
                        mmd_export_token_tree_odf(out, source, t->child, scratch);
@@ -617,7 +616,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        mmd_export_token_tree_odf(out, source, t->child, scratch);
 
                        if (t->child && t->child->type != BLOCK_PARA)
-                       print_const("</text:p>");
+                               print_const("</text:p>");
 
                        print_const("</text:list-item>");
                        scratch->padded = 0;
@@ -639,7 +638,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                case PAIR_BRACKET_GLOSSARY:
                                        print_const(" text:style-name=\"Footnote\">");
                                        break;
-                               default:                                
+                               default:
                                        print_const(" text:style-name=\"Standard\">");
                                        break;
                        }
@@ -656,8 +655,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        scratch->padded = 2;
                        read_table_column_alignments(source, t, scratch);
 
-                       for (int i = 0; i < scratch->table_column_count; ++i)
-                       {
+                       for (int i = 0; i < scratch->table_column_count; ++i) {
                                print_const("<table:table-column/>\n");
 //                             switch (scratch->table_alignment[i]) {
 //                                     case 'l':
@@ -694,7 +692,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                temp_token = t->next->child;
 
                                if (temp_token->next &&
-                                       temp_token->next->type == PAIR_BRACKET) {
+                                       temp_token->next->type == PAIR_BRACKET) {
                                        temp_token = temp_token->next;
                                }
 
@@ -757,7 +755,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        print_const("[#");
                        break;
                case BRACKET_LEFT:
-                       print_const("[");                       
+                       print_const("[");
                        break;
                case BRACKET_RIGHT:
                        print_const("]");
@@ -833,7 +831,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        break;
                case ESCAPED_CHARACTER:
                        if (!(scratch->extensions & EXT_COMPATIBILITY) &&
-                               (source[t->start + 1] == ' ')) {
+                               (source[t->start + 1] == ' ')) {
                                print_const(" ");              // This is a non-breaking space character
                        } else {
                                mmd_print_char_odf(out, source[t->start + 1]);
@@ -1016,7 +1014,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        break;
                case PAIR_BRACKET:
                        if ((scratch->extensions & EXT_NOTES) &&
-                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
+                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
                                goto parse_citation;
                        }
 
@@ -1032,8 +1030,8 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                        temp_token = t->next;
 
                                        if (temp_token &&
-                                               ((temp_token->type == PAIR_BRACKET) ||
-                                               (temp_token->type == PAIR_PAREN))) {
+                                               ((temp_token->type == PAIR_BRACKET) ||
+                                                (temp_token->type == PAIR_PAREN))) {
                                                temp_token = temp_token->next;
                                        }
 
@@ -1049,7 +1047,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                                mmd_export_image_odf(out, source, t, temp_link, scratch, true);
                                        }
                                }
-                               
+
                                if (temp_bool) {
                                        link_free(temp_link);
                                }
@@ -1063,7 +1061,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        mmd_export_token_tree_odf(out, source, t->child, scratch);
                        break;
                case PAIR_BRACKET_CITATION:
-                       parse_citation:
+parse_citation:
                        temp_bool = true;               // Track whether this is regular vs 'not cited'
                        temp_token = t;                 // Remember whether we need to skip ahead
 
@@ -1114,7 +1112,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
 
                                        if (temp_char[0] == '\0') {
                                                // No locator
-                               
+
                                                if (temp_short2 == scratch->used_citations->size) {
                                                        // This is a re-use of a previously used note
                                                        print_const("<text:span text:style-name=\"Footnote_20_anchor\"><text:note-ref text:note-class=\"endnote\" text:reference-format=\"text\" ");
@@ -1144,17 +1142,17 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                                }
                                        }
                                } else {
-                                               if (temp_short2 == scratch->used_citations->size) {
-                                                       // This is a re-use of a previously used note
-                                               } else {
-                                                       // This is the first time this note was used
-                                                       // TODO: Not sure how to add an endnote without inserting a marker in the text
-                                                       printf("<text:note text:id=\"cite%d\" text:note-class=\"endnote\"><text:note-body>", temp_short);
-                                                       temp_note = stack_peek_index(scratch->used_citations, temp_short - 1);
+                                       if (temp_short2 == scratch->used_citations->size) {
+                                               // This is a re-use of a previously used note
+                                       } else {
+                                               // This is the first time this note was used
+                                               // TODO: Not sure how to add an endnote without inserting a marker in the text
+                                               printf("<text:note text:id=\"cite%d\" text:note-class=\"endnote\"><text:note-body>", temp_short);
+                                               temp_note = stack_peek_index(scratch->used_citations, temp_short - 1);
 
-                                                       mmd_export_token_tree_odf(out, source, temp_note->content, scratch);
-                                                       print_const("</text:note-body></text:note>");
-                                               }
+                                               mmd_export_token_tree_odf(out, source, temp_note->content, scratch);
+                                               print_const("</text:note-body></text:note>");
+                                       }
                                }
 
                                if (temp_token != t) {
@@ -1261,13 +1259,13 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                                // This is a reference definition
                                                mmd_print_string_odf(out, temp_note->clean_text);
                                                print_const(" (");
-                                               mmd_print_string_odf(out, temp_note->label_text); 
+                                               mmd_print_string_odf(out, temp_note->label_text);
                                                print_const(")");
                                        } else {
                                                // This is an inline definition
                                                mmd_print_string_odf(out, temp_note->clean_text);
                                                print_const(" (");
-                                               mmd_print_string_odf(out, temp_note->label_text); 
+                                               mmd_print_string_odf(out, temp_note->label_text);
                                                print_const(")");
                                        }
 
@@ -1304,11 +1302,11 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                if (temp_short2 == scratch->used_glossaries->size) {
                                        // This is a re-use of a previously used note
 
-                                       mmd_print_string_odf(out, temp_note->clean_text); 
+                                       mmd_print_string_odf(out, temp_note->clean_text);
                                } else {
                                        // This is the first time this note was used
 
-                                       mmd_print_string_odf(out, temp_note->clean_text); 
+                                       mmd_print_string_odf(out, temp_note->clean_text);
 
                                        printf("<text:note text:id=\"gn%d\" text:note-class=\"glossary\"><text:note-body>", temp_short);
                                        mmd_export_token_tree_odf(out, source, temp_note->content, scratch);
@@ -1348,7 +1346,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                        print_const("</text:span>");
                                }
                        } else {
-                               mmd_export_token_tree_odf(out, source, t->child, scratch);                              
+                               mmd_export_token_tree_odf(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_DEL:
@@ -1366,13 +1364,13 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                        print_const("</text:span>");
                                }
                        } else {
-                               mmd_export_token_tree_odf(out, source, t->child, scratch);                              
+                               mmd_export_token_tree_odf(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_COM:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1387,7 +1385,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                case PAIR_CRITIC_HI:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1407,8 +1405,8 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        break;
                case PAIR_CRITIC_SUB_DEL:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->next) &&
-                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
+                               (t->next) &&
+                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_ACCEPT) {
@@ -1426,8 +1424,8 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                        break;
                case PAIR_CRITIC_SUB_ADD:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->prev) &&
-                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
+                               (t->prev) &&
+                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_REJECT) {
@@ -1519,7 +1517,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                print_const("</text:span>");
                        } else {
                                print_const("^");
-                       }       
+                       }
                        break;
                case TABLE_CELL:
                        print_const("<table:table-cell");
@@ -1560,7 +1558,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                                scratch->table_cell_count += t->next->len;
                        else
                                scratch->table_cell_count++;
-                       
+
                        break;
                case TABLE_DIVIDER:
                        break;
@@ -1690,293 +1688,293 @@ void mmd_export_token_tree_odf_raw(DString * out, const char * source, token * t
 
 void mmd_start_complete_odf(DString * out, const char * source, scratch_pad * scratch) {
        print_const("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
-"<office:document xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n" \
-"     xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
-"     xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
-"     xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
-"     xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
-"     xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
-"     xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
-"     xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
-"     xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
-"     xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
-"     xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
-"     xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
-"     xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
-"     xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
-"     xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
-"     xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
-"     xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"\n" \
-"     xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
-"     xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
-"     xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
-"     xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
-"     xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
-"     xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
-"     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
-"     xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
-"     xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
-"     xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
-"     xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
-"     xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
-"     xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
-"     xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
-"     xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
-"     office:version=\"1.2\"\n" \
-"     grddl:transformation=\"http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl\"\n" \
-"     office:mimetype=\"application/vnd.oasis.opendocument.text\">\n");
-    
+                   "<office:document xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n" \
+                   "     xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
+                   "     xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
+                   "     xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
+                   "     xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
+                   "     xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
+                   "     xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
+                   "     xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
+                   "     xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
+                   "     xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
+                   "     xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
+                   "     xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
+                   "     xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
+                   "     xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
+                   "     xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
+                   "     xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
+                   "     xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"\n" \
+                   "     xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
+                   "     xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
+                   "     xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
+                   "     xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
+                   "     xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
+                   "     xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
+                   "     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
+                   "     xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
+                   "     xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
+                   "     xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
+                   "     xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
+                   "     xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
+                   "     xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
+                   "     xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
+                   "     xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
+                   "     office:version=\"1.2\"\n" \
+                   "     grddl:transformation=\"http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl\"\n" \
+                   "     office:mimetype=\"application/vnd.oasis.opendocument.text\">\n");
+
        /* Font Declarations */
        print_const("<office:font-face-decls>\n" \
-       "   <style:font-face style:name=\"Courier New\" svg:font-family=\"'Courier New'\"\n" \
-    "                    style:font-adornments=\"Regular\"\n" \
-    "                    style:font-family-generic=\"modern\"\n" \
-    "                    style:font-pitch=\"fixed\"/>\n" \
-    "</office:font-face-decls>\n");
-    
-    /* Append basic style information */
-    print_const("<office:styles>\n" \
-    "<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n" \
-    "      <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.15in\"" \
-    "     fo:text-align=\"justify\" style:justify-single-word=\"false\"/>\n" \
-    "   </style:style>\n" \
-    "<style:style style:name=\"Preformatted_20_Text\" style:display-name=\"Preformatted Text\"\n" \
-    "             style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"html\">\n" \
-    "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0in\" fo:text-align=\"start\"\n" \
-    "                               style:justify-single-word=\"false\"/>\n" \
-    "   <style:text-properties style:font-name=\"Courier New\" fo:font-size=\"11pt\"\n" \
-    "                          style:font-name-asian=\"Courier New\"\n" \
-    "                          style:font-size-asian=\"11pt\"\n" \
-    "                          style:font-name-complex=\"Courier New\"\n" \
-    "                          style:font-size-complex=\"11pt\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Source_20_Text\" style:display-name=\"Source Text\"\n" \
-    "             style:family=\"text\">\n" \
-    "   <style:text-properties style:font-name=\"Courier New\" style:font-name-asian=\"Courier New\"\n" \
-    "                          style:font-name-complex=\"Courier New\"\n" \
-    "                          fo:font-size=\"11pt\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"List\" style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"list\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
-    "   <style:text-properties style:font-size-asian=\"12pt\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Quotations\" style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"html\">\n" \
-    "   <style:paragraph-properties fo:margin-left=\"0.3937in\" fo:margin-right=\"0.3937in\" fo:margin-top=\"0in\"\n" \
-    "                               fo:margin-bottom=\"0.1965in\"\n" \
-    "                               fo:text-align=\"justify\"" \
-    "                               style:justify-single-word=\"false\"" \
-    "                               fo:text-indent=\"0in\"\n" \
-    "                               style:auto-text-indent=\"false\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Table_20_Heading\" style:display-name=\"Table Heading\"\n" \
-    "             style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Table_20_Contents\"\n" \
-    "             style:class=\"extra\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"\n" \
-    "                               text:number-lines=\"false\"\n" \
-    "                               text:line-number=\"0\"/>\n" \
-    "   <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
-    "                          style:font-weight-complex=\"bold\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Horizontal_20_Line\" style:display-name=\"Horizontal Line\"\n" \
-    "             style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"html\">\n" \
-    "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.1965in\"\n" \
-    "                               style:border-line-width-bottom=\"0.0008in 0.0138in 0.0008in\"\n" \
-    "                               fo:padding=\"0in\"\n" \
-    "                               fo:border-left=\"none\"\n" \
-    "                               fo:border-right=\"none\"\n" \
-    "                               fo:border-top=\"none\"\n" \
-    "                               fo:border-bottom=\"0.0154in double #808080\"\n" \
-    "                               text:number-lines=\"false\"\n" \
-    "                               text:line-number=\"0\"\n" \
-    "                               style:join-border=\"false\"/>\n" \
-    "   <style:text-properties fo:font-size=\"6pt\" style:font-size-asian=\"6pt\" style:font-size-complex=\"6pt\"/>\n" \
-    "</style:style>\n" \
-       "<style:style style:name=\"Footnote_20_anchor\" style:display-name=\"Footnote anchor\"" \
-       "              style:family=\"text\">" \
-       "    <style:text-properties style:text-position=\"super 58%\"/>" \
-       " </style:style>\n" \
-       "<style:style style:name=\"TOC_Item\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
-       " <style:paragraph-properties>\n" \
-       "  <style:tab-stops>\n" \
-       "   <style:tab-stop style:position=\"6.7283in\" style:type=\"right\" style:leader-style=\"dotted\" style:leader-text=\".\"/>\n" \
-       "  </style:tab-stops>\n" \
-       " </style:paragraph-properties>\n" \
-       "</style:style>\n" \
-       "  <text:notes-configuration text:note-class=\"footnote\" text:default-style-name=\"Footnote\" text:citation-style-name=\"Footnote_20_Symbol\" text:citation-body-style-name=\"Footnote_20_anchor\" text:master-page-name=\"Footnote\" style:num-format=\"a\" text:start-value=\"0\" text:footnotes-position=\"page\" text:start-numbering-at=\"page\"/>\n" \
-       "  <text:notes-configuration text:note-class=\"endnote\" text:default-style-name=\"Endnote\" text:citation-style-name=\"Endnote_20_Symbol\" text:citation-body-style-name=\"Endnote_20_anchor\" text:master-page-name=\"Endnote\" style:num-format=\"1\" text:start-value=\"0\"/>\n" \
-    "</office:styles>\n");
-
-    /* Automatic style information */
-    print_const("<office:automatic-styles>" \
-    "   <style:style style:name=\"MMD-Italic\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\"\n" \
-    "                             style:font-style-complex=\"italic\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"MMD-Bold\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
-    "                             style:font-weight-complex=\"bold\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"MMD-Superscript\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-position=\"super 58%\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"MMD-Subscript\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-position=\"sub 58%\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Strike\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-line-through-style=\"solid\" />\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Underline\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-underline-style=\"solid\" style:text-underline-color=\"font-color\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Highlight\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:background-color=\"#FFFF00\" />\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Comment\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:color=\"#0000BB\" />\n" \
-    "   </style:style>\n" \
-    "<style:style style:name=\"MMD-Table\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
-    "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.05in\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"MMD-Table-Center\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"MMD-Table-Right\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"right\" style:justify-single-word=\"false\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"P2\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
-    "             style:list-style-name=\"L2\">\n" \
-    "<style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
-    "</style:style>\n" \
-       "<style:style style:name=\"fr1\" style:family=\"graphic\" style:parent-style-name=\"Frame\">\n" \
-       "   <style:graphic-properties style:print-content=\"true\" style:vertical-pos=\"top\"\n" \
-       "                             style:vertical-rel=\"baseline\"\n" \
-       "                             fo:padding=\"0in\"\n" \
-       "                             fo:border=\"none\"\n" \
-       "                             style:shadow=\"none\"/>\n" \
-       "</style:style>\n" \
-    "<style:style style:name=\"P1\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
-    "             style:list-style-name=\"L1\"/>\n" \
-       "<text:list-style style:name=\"L1\">\n" \
-       "       <text:list-level-style-bullet text:level=\"1\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"•\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-bullet>\n" \
-       "       <text:list-level-style-bullet text:level=\"2\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â—¦\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-bullet>\n" \
-       "       <text:list-level-style-bullet text:level=\"3\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â–ª\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-bullet>\n" \
-       "       <text:list-level-style-number text:level=\"4\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"5\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"6\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"7\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"8\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"9\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"10\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "</text:list-style>\n" \
-       "<text:list-style style:name=\"L2\">\n" \
-       "       <text:list-level-style-number text:level=\"1\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"2\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"3\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"4\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"5\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"6\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"7\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"8\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"9\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"10\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "</text:list-style>\n" \
-    "</office:automatic-styles>\n" \
-       " <office:master-styles>\n" \
-       "  <style:master-page style:name=\"Endnote\" >\n" \
-       "    <style:header><text:h text:outline-level=\"2\">Bibliography</text:h></style:header></style:master-page>\n" \
-       "  <style:master-page style:name=\"Footnote\" style:page-layout-name=\"pm2\"/>\n" \
-       " </office:master-styles>\n");
-
-               // Iterate over metadata keys
+                   "   <style:font-face style:name=\"Courier New\" svg:font-family=\"'Courier New'\"\n" \
+                   "                    style:font-adornments=\"Regular\"\n" \
+                   "                    style:font-family-generic=\"modern\"\n" \
+                   "                    style:font-pitch=\"fixed\"/>\n" \
+                   "</office:font-face-decls>\n");
+
+       /* Append basic style information */
+       print_const("<office:styles>\n" \
+                   "<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n" \
+                   "      <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.15in\"" \
+                   "     fo:text-align=\"justify\" style:justify-single-word=\"false\"/>\n" \
+                   "   </style:style>\n" \
+                   "<style:style style:name=\"Preformatted_20_Text\" style:display-name=\"Preformatted Text\"\n" \
+                   "             style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"html\">\n" \
+                   "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0in\" fo:text-align=\"start\"\n" \
+                   "                               style:justify-single-word=\"false\"/>\n" \
+                   "   <style:text-properties style:font-name=\"Courier New\" fo:font-size=\"11pt\"\n" \
+                   "                          style:font-name-asian=\"Courier New\"\n" \
+                   "                          style:font-size-asian=\"11pt\"\n" \
+                   "                          style:font-name-complex=\"Courier New\"\n" \
+                   "                          style:font-size-complex=\"11pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Source_20_Text\" style:display-name=\"Source Text\"\n" \
+                   "             style:family=\"text\">\n" \
+                   "   <style:text-properties style:font-name=\"Courier New\" style:font-name-asian=\"Courier New\"\n" \
+                   "                          style:font-name-complex=\"Courier New\"\n" \
+                   "                          fo:font-size=\"11pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"List\" style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"list\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
+                   "   <style:text-properties style:font-size-asian=\"12pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Quotations\" style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"html\">\n" \
+                   "   <style:paragraph-properties fo:margin-left=\"0.3937in\" fo:margin-right=\"0.3937in\" fo:margin-top=\"0in\"\n" \
+                   "                               fo:margin-bottom=\"0.1965in\"\n" \
+                   "                               fo:text-align=\"justify\"" \
+                   "                               style:justify-single-word=\"false\"" \
+                   "                               fo:text-indent=\"0in\"\n" \
+                   "                               style:auto-text-indent=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Table_20_Heading\" style:display-name=\"Table Heading\"\n" \
+                   "             style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Table_20_Contents\"\n" \
+                   "             style:class=\"extra\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"\n" \
+                   "                               text:number-lines=\"false\"\n" \
+                   "                               text:line-number=\"0\"/>\n" \
+                   "   <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
+                   "                          style:font-weight-complex=\"bold\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Horizontal_20_Line\" style:display-name=\"Horizontal Line\"\n" \
+                   "             style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"html\">\n" \
+                   "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.1965in\"\n" \
+                   "                               style:border-line-width-bottom=\"0.0008in 0.0138in 0.0008in\"\n" \
+                   "                               fo:padding=\"0in\"\n" \
+                   "                               fo:border-left=\"none\"\n" \
+                   "                               fo:border-right=\"none\"\n" \
+                   "                               fo:border-top=\"none\"\n" \
+                   "                               fo:border-bottom=\"0.0154in double #808080\"\n" \
+                   "                               text:number-lines=\"false\"\n" \
+                   "                               text:line-number=\"0\"\n" \
+                   "                               style:join-border=\"false\"/>\n" \
+                   "   <style:text-properties fo:font-size=\"6pt\" style:font-size-asian=\"6pt\" style:font-size-complex=\"6pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Footnote_20_anchor\" style:display-name=\"Footnote anchor\"" \
+                   "              style:family=\"text\">" \
+                   "    <style:text-properties style:text-position=\"super 58%\"/>" \
+                   " </style:style>\n" \
+                   "<style:style style:name=\"TOC_Item\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
+                   " <style:paragraph-properties>\n" \
+                   "  <style:tab-stops>\n" \
+                   "   <style:tab-stop style:position=\"6.7283in\" style:type=\"right\" style:leader-style=\"dotted\" style:leader-text=\".\"/>\n" \
+                   "  </style:tab-stops>\n" \
+                   " </style:paragraph-properties>\n" \
+                   "</style:style>\n" \
+                   "  <text:notes-configuration text:note-class=\"footnote\" text:default-style-name=\"Footnote\" text:citation-style-name=\"Footnote_20_Symbol\" text:citation-body-style-name=\"Footnote_20_anchor\" text:master-page-name=\"Footnote\" style:num-format=\"a\" text:start-value=\"0\" text:footnotes-position=\"page\" text:start-numbering-at=\"page\"/>\n" \
+                   "  <text:notes-configuration text:note-class=\"endnote\" text:default-style-name=\"Endnote\" text:citation-style-name=\"Endnote_20_Symbol\" text:citation-body-style-name=\"Endnote_20_anchor\" text:master-page-name=\"Endnote\" style:num-format=\"1\" text:start-value=\"0\"/>\n" \
+                   "</office:styles>\n");
+
+       /* Automatic style information */
+       print_const("<office:automatic-styles>" \
+                   "   <style:style style:name=\"MMD-Italic\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\"\n" \
+                   "                             style:font-style-complex=\"italic\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"MMD-Bold\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
+                   "                             style:font-weight-complex=\"bold\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"MMD-Superscript\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-position=\"super 58%\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"MMD-Subscript\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-position=\"sub 58%\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Strike\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-line-through-style=\"solid\" />\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Underline\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-underline-style=\"solid\" style:text-underline-color=\"font-color\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Highlight\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:background-color=\"#FFFF00\" />\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Comment\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:color=\"#0000BB\" />\n" \
+                   "   </style:style>\n" \
+                   "<style:style style:name=\"MMD-Table\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
+                   "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.05in\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"MMD-Table-Center\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"MMD-Table-Right\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"right\" style:justify-single-word=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"P2\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
+                   "             style:list-style-name=\"L2\">\n" \
+                   "<style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"fr1\" style:family=\"graphic\" style:parent-style-name=\"Frame\">\n" \
+                   "   <style:graphic-properties style:print-content=\"true\" style:vertical-pos=\"top\"\n" \
+                   "                             style:vertical-rel=\"baseline\"\n" \
+                   "                             fo:padding=\"0in\"\n" \
+                   "                             fo:border=\"none\"\n" \
+                   "                             style:shadow=\"none\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"P1\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
+                   "             style:list-style-name=\"L1\"/>\n" \
+                   "<text:list-style style:name=\"L1\">\n" \
+                   "   <text:list-level-style-bullet text:level=\"1\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"•\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-bullet>\n" \
+                   "   <text:list-level-style-bullet text:level=\"2\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â—¦\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-bullet>\n" \
+                   "   <text:list-level-style-bullet text:level=\"3\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â–ª\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-bullet>\n" \
+                   "   <text:list-level-style-number text:level=\"4\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"5\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"6\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"7\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"8\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"9\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"10\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "</text:list-style>\n" \
+                   "<text:list-style style:name=\"L2\">\n" \
+                   "   <text:list-level-style-number text:level=\"1\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"2\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"3\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"4\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"5\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"6\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"7\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"8\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"9\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"10\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "</text:list-style>\n" \
+                   "</office:automatic-styles>\n" \
+                   " <office:master-styles>\n" \
+                   "  <style:master-page style:name=\"Endnote\" >\n" \
+                   "    <style:header><text:h text:outline-level=\"2\">Bibliography</text:h></style:header></style:master-page>\n" \
+                   "  <style:master-page style:name=\"Footnote\" style:page-layout-name=\"pm2\"/>\n" \
+                   " </office:master-styles>\n");
+
+       // Iterate over metadata keys
        meta * m;
 
        if (scratch->meta_hash)
index c856e48f03de0cf491f2a673aa66c2f7e6dffb27..f6931e7697076985c0307f6da886d8c102070089 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -159,7 +159,7 @@ void mmd_print_localized_char_html(DString * out, unsigned short type, scratch_p
                                        break;
                                default:
                                        print_const("&#8216;");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_SINGLE:
                        switch (scratch->quotes_lang) {
@@ -171,7 +171,7 @@ void mmd_print_localized_char_html(DString * out, unsigned short type, scratch_p
                                        break;
                                default:
                                        print_const("&#8217;");
-                               }
+                       }
                        break;
                case QUOTE_LEFT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -190,7 +190,7 @@ void mmd_print_localized_char_html(DString * out, unsigned short type, scratch_p
                                        break;
                                default:
                                        print_const("&#8220;");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -207,7 +207,7 @@ void mmd_print_localized_char_html(DString * out, unsigned short type, scratch_p
                                case DUTCH:
                                default:
                                        print_const("&#8221;");
-                               }
+                       }
                        break;
        }
 }
@@ -216,12 +216,12 @@ void mmd_print_localized_char_html(DString * out, unsigned short type, scratch_p
 static char * strip_dimension_units(char *original) {
        char *result;
        int i;
-       
+
        result = my_strdup(original);
-       
+
        for (i = 0; result[i]; i++)
                result[i] = tolower(result[i]);
-       
+
        if (strstr(&result[strlen(result)-2],"px")) {
                // Leave 'px' alone
                return result;
@@ -234,7 +234,7 @@ static char * strip_dimension_units(char *original) {
                        return result;
                }
        }
-               
+
        return result;
 }
 
@@ -423,7 +423,7 @@ void mmd_export_toc_entry_html(DString * out, const char * source, scratch_pad *
                        (*counter)--;
                        break;
                }
-               
+
                // Increment counter
                (*counter)++;
        }
@@ -479,8 +479,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        print_token(t);
                                } else {
                                        print_localized(QUOTE_LEFT_DOUBLE);
-                               }
-                       else if (t->start < t->mate->start) {
+                               } else if (t->start < t->mate->start) {
                                print_const("<code>");
                        } else {
                                print_const("</code>");
@@ -520,7 +519,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
 
                        if (!(t->prev && (t->prev->type == BLOCK_DEFLIST)))
                                print_const("<dl>\n");
-       
+
                        scratch->padded = 2;
 
                        mmd_export_token_tree_html(out, source, t->child, scratch);
@@ -553,7 +552,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                                        d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
                                                        scratch->padded = 1;
                                                } else {
-                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);                                                      
+                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
                                                        scratch->padded = 0;
                                                }
                                        }
@@ -686,12 +685,12 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                case BLOCK_DEF_FOOTNOTE:
                case BLOCK_DEF_GLOSSARY:
                        pad(out, 2, scratch);
-       
+
                        if (!scratch->list_is_tight)
                                print_const("<p>");
 
                        mmd_export_token_tree_html(out, source, t->child, scratch);
-                       
+
                        if (scratch->citation_being_printed) {
                                scratch->footnote_para_counter--;
 
@@ -776,7 +775,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                temp_token = t->next->child;
 
                                if (temp_token->next &&
-                                       temp_token->next->type == PAIR_BRACKET) {
+                                       temp_token->next->type == PAIR_BRACKET) {
                                        temp_token = temp_token->next;
                                }
 
@@ -797,8 +796,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        read_table_column_alignments(source, t, scratch);
 
                        print_const("<colgroup>\n");
-                       for (int i = 0; i < scratch->table_column_count; ++i)
-                       {
+                       for (int i = 0; i < scratch->table_column_count; ++i) {
                                switch (scratch->table_alignment[i]) {
                                        case 'l':
                                                print_const("<col style=\"text-align:left;\"/>\n");
@@ -878,7 +876,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        print_const("}}");
                        break;
                case BRACKET_LEFT:
-                       print_const("[");                       
+                       print_const("[");
                        break;
                case BRACKET_ABBREVIATION_LEFT:
                        print_const("[>");
@@ -972,7 +970,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        break;
                case ESCAPED_CHARACTER:
                        if (!(scratch->extensions & EXT_COMPATIBILITY) &&
-                               (source[t->start + 1] == ' ')) {
+                               (source[t->start + 1] == ' ')) {
                                print_const("&nbsp;");
                        } else {
                                mmd_print_char_html(out, source[t->start + 1], false);
@@ -1151,7 +1149,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        break;
                case PAIR_BRACKET:
                        if ((scratch->extensions & EXT_NOTES) &&
-                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
+                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
                                goto parse_citation;
                        }
 
@@ -1167,8 +1165,8 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        temp_token = t->next;
 
                                        if (temp_token &&
-                                               ((temp_token->type == PAIR_BRACKET) ||
-                                               (temp_token->type == PAIR_PAREN))) {
+                                               ((temp_token->type == PAIR_BRACKET) ||
+                                                (temp_token->type == PAIR_PAREN))) {
                                                temp_token = temp_token->next;
                                        }
 
@@ -1184,7 +1182,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                                mmd_export_image_html(out, source, t, temp_link, scratch, true);
                                        }
                                }
-                               
+
                                if (temp_bool) {
                                        link_free(temp_link);
                                }
@@ -1263,7 +1261,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        }
                        break;
                case PAIR_BRACKET_CITATION:
-                       parse_citation:
+parse_citation:
                        temp_bool = true;               // Track whether this is regular vs 'not cited'
                        temp_token = t;                 // Remember whether we need to skip ahead
 
@@ -1310,15 +1308,15 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
 
                                        if (temp_char[0] == '\0') {
                                                // No locator
-                               
+
                                                if (temp_short2 == scratch->used_citations->size) {
                                                        // This is a re-use of a previously used note
                                                        printf("<a href=\"#cn:%d\" title=\"%s\" class=\"citation\">(%d)</a>",
-                                                                       temp_short, LC("see citation"), temp_short);
+                                                              temp_short, LC("see citation"), temp_short);
                                                } else {
                                                        // This is the first time this note was used
                                                        printf("<a href=\"#cn:%d\" id=\"cnref:%d\" title=\"%s\" class=\"citation\">(%d)</a>",
-                                                                       temp_short, temp_short, LC("see citation"), temp_short);
+                                                              temp_short, temp_short, LC("see citation"), temp_short);
                                                }
                                        } else {
                                                // Locator present
@@ -1326,11 +1324,11 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                                if (temp_short2 == scratch->used_citations->size) {
                                                        // This is a re-use of a previously used note
                                                        printf("<a href=\"#cn:%d\" title=\"%s\" class=\"citation\">(%s, %d)</a>",
-                                                                       temp_short, LC("see citation"), temp_char, temp_short);
+                                                              temp_short, LC("see citation"), temp_char, temp_short);
                                                } else {
                                                        // This is the first time this note was used
                                                        printf("<a href=\"#cn:%d\" id=\"cnref:%d\" title=\"%s\" class=\"citation\">(%s, %d)</a>",
-                                                                       temp_short, temp_short, LC("see citation"), temp_char, temp_short);
+                                                              temp_short, temp_short, LC("see citation"), temp_char, temp_short);
                                                }
                                        }
                                } else {
@@ -1376,7 +1374,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        }
 
                                        printf("<a href=\"#fn:%d\" title=\"%s\" class=\"footnote\"><sup>%d</sup></a>",
-                                               temp_short3, LC("see footnote"), temp_short);
+                                              temp_short3, LC("see footnote"), temp_short);
                                } else {
                                        // This is the first time this note was used
 
@@ -1388,7 +1386,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        }
 
                                        printf("<a href=\"#fn:%d\" id=\"fnref:%d\" title=\"%s\" class=\"footnote\"><sup>%d</sup></a>",
-                                               temp_short3, temp_short3, LC("see footnote"), temp_short);
+                                              temp_short3, temp_short3, LC("see footnote"), temp_short);
                                }
                        } else {
                                // Note-based syntax disabled
@@ -1408,11 +1406,11 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        // This instance is not properly formed
                                        print_const("[?");
 
-                    if (t->child)
-                        mmd_export_token_tree_html(out, source, t->child->next, scratch);
-                    else
-                        print_token(t);
-                        
+                                       if (t->child)
+                                               mmd_export_token_tree_html(out, source, t->child->next, scratch);
+                                       else
+                                               print_token(t);
+
                                        print_const("]");
                                        break;
                                }
@@ -1424,7 +1422,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        // This is a re-use of a previously used note
 
                                        printf("<a href=\"#gn:%d\" title=\"%s\" class=\"glossary\">",
-                                                  temp_short, LC("see glossary"));
+                                              temp_short, LC("see glossary"));
                                        mmd_print_string_html(out, temp_note->clean_text, false);
                                        print_const("</a>");
                                } else {
@@ -1432,7 +1430,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
 
 
                                        printf("<a href=\"#gn:%d\" id=\"gnref:%d\" title=\"%s\" class=\"glossary\">",
-                                                  temp_short, temp_short, LC("see glossary"));
+                                              temp_short, temp_short, LC("see glossary"));
                                        mmd_print_string_html(out, temp_note->clean_text, false);
                                        print_const("</a>");
                                }
@@ -1468,7 +1466,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        print_const("</ins>");
                                }
                        } else {
-                               mmd_export_token_tree_html(out, source, t->child, scratch);                             
+                               mmd_export_token_tree_html(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_DEL:
@@ -1486,13 +1484,13 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                        print_const("</del>");
                                }
                        } else {
-                               mmd_export_token_tree_html(out, source, t->child, scratch);                             
+                               mmd_export_token_tree_html(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_COM:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1507,7 +1505,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                case PAIR_CRITIC_HI:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1527,8 +1525,8 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        break;
                case PAIR_CRITIC_SUB_DEL:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->next) &&
-                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
+                               (t->next) &&
+                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_ACCEPT) {
@@ -1546,8 +1544,8 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                        break;
                case PAIR_CRITIC_SUB_ADD:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->prev) &&
-                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
+                               (t->prev) &&
+                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_REJECT) {
@@ -1642,7 +1640,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                print_const("</sup>");
                        } else {
                                print_const("^");
-                       }       
+                       }
                        break;
                case TABLE_CELL:
                        if (scratch->in_table_header) {
@@ -1680,7 +1678,7 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                                scratch->table_cell_count += t->next->len;
                        else
                                scratch->table_cell_count++;
-                       
+
                        break;
                case TABLE_DIVIDER:
                        break;
@@ -1935,8 +1933,7 @@ void mmd_export_footnote_list_html(DString * out, const char * source, scratch_p
                print_const("<div class=\"footnotes\">\n<hr />\n<ol>");
                scratch->padded = 0;
 
-               for (int i = 0; i < scratch->used_footnotes->size; ++i)
-               {
+               for (int i = 0; i < scratch->used_footnotes->size; ++i) {
                        // Export footnote
                        pad(out, 2, scratch);
 
@@ -1952,7 +1949,7 @@ void mmd_export_footnote_list_html(DString * out, const char * source, scratch_p
                        while(content) {
                                if (content->type == BLOCK_PARA)
                                        scratch->footnote_para_counter++;
-                               
+
                                content = content->next;
                        }
 
@@ -1983,8 +1980,7 @@ void mmd_export_glossary_list_html(DString * out, const char * source, scratch_p
                print_const("<div class=\"glossary\">\n<hr />\n<ol>");
                scratch->padded = 0;
 
-               for (int i = 0; i < scratch->used_glossaries->size; ++i)
-               {
+               for (int i = 0; i < scratch->used_glossaries->size; ++i) {
                        // Export glossary
                        pad(out, 2, scratch);
 
@@ -2005,7 +2001,7 @@ void mmd_export_glossary_list_html(DString * out, const char * source, scratch_p
                        while(content) {
                                if (content->type == BLOCK_PARA)
                                        scratch->footnote_para_counter++;
-                               
+
                                content = content->next;
                        }
 
@@ -2036,8 +2032,7 @@ void mmd_export_citation_list_html(DString * out, const char * source, scratch_p
                print_const("<div class=\"citations\">\n<hr />\n<ol>");
                scratch->padded = 0;
 
-               for (int i = 0; i < scratch->used_citations->size; ++i)
-               {
+               for (int i = 0; i < scratch->used_citations->size; ++i) {
                        // Export footnote
                        pad(out, 2, scratch);
 
@@ -2053,7 +2048,7 @@ void mmd_export_citation_list_html(DString * out, const char * source, scratch_p
                        while(content) {
                                if (content->type == BLOCK_PARA)
                                        scratch->footnote_para_counter++;
-                               
+
                                content = content->next;
                        }
 
index d32d6d446bcab43c22b589649032f9fb744a7956..f9c42462027f7a6abc4b43ec60b6a0b840ef3b05 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -124,7 +124,7 @@ void mmd_print_char_latex(DString * out, char c) {
 void mmd_print_string_latex(DString * out, const char * str) {
        if (str == NULL)
                return;
-       
+
        while (*str != '\0') {
                mmd_print_char_latex(out, *str);
                str++;
@@ -162,7 +162,7 @@ void mmd_print_localized_char_latex(DString * out, unsigned short type, scratch_
                                        break;
                                default:
                                        print_const("`");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_SINGLE:
                        switch (scratch->quotes_lang) {
@@ -174,7 +174,7 @@ void mmd_print_localized_char_latex(DString * out, unsigned short type, scratch_
                                        break;
                                default:
                                        print_const("'");
-                               }
+                       }
                        break;
                case QUOTE_LEFT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -193,7 +193,7 @@ void mmd_print_localized_char_latex(DString * out, unsigned short type, scratch_
                                        break;
                                default:
                                        print_const("``");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -210,7 +210,7 @@ void mmd_print_localized_char_latex(DString * out, unsigned short type, scratch_
                                case DUTCH:
                                default:
                                        print_const("''");
-                               }
+                       }
                        break;
        }
 }
@@ -241,7 +241,7 @@ void mmd_export_link_latex(DString * out, const char * source, token * text, lin
                        }
                        return;
                } else {
-                       printf("\\href{%s}", link->url);                        
+                       printf("\\href{%s}", link->url);
                }
        } else
                print_const("\\href{}");
@@ -253,7 +253,7 @@ void mmd_export_link_latex(DString * out, const char * source, token * text, lin
                text->child->next->start--;
                text->child->next->len++;
        }
-       
+
        mmd_export_token_tree_latex(out, source, text->child, scratch);
 
        print_const("}");
@@ -268,17 +268,17 @@ void mmd_export_link_latex(DString * out, const char * source, token * text, lin
 static char * correct_dimension_units(char *original) {
        char *result;
        int i;
-       
+
        result = my_strdup(original);
-       
+
        for (i = 0; result[i]; i++)
                result[i] = tolower(result[i]);
-       
+
        if (strstr(&result[strlen(result)-2],"px")) {
                result[strlen(result)-2] = '\0';
                strcat(result, "pt");
        }
-       
+
        return result;
 }
 
@@ -419,7 +419,7 @@ void mmd_export_toc_entry_latex(DString * out, const char * source, scratch_pad
                        (*counter)--;
                        break;
                }
-               
+
                // Increment counter
                (*counter)++;
        }
@@ -502,7 +502,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                                        d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
                                                        scratch->padded = 1;
                                                } else {
-                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);                                                      
+                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
                                                        scratch->padded = 0;
                                                }
                                        }
@@ -552,7 +552,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
 
                        if (!(t->prev && (t->prev->type == BLOCK_DEFLIST)))
                                print_const("\\begin{description}\n");
-       
+
                        scratch->padded = 2;
 
                        mmd_export_token_tree_latex(out, source, t->child, scratch);
@@ -706,7 +706,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                temp_token = t->next->child;
 
                                if (temp_token->next &&
-                                       temp_token->next->type == PAIR_BRACKET) {
+                                       temp_token->next->type == PAIR_BRACKET) {
                                        temp_token = temp_token->next;
                                }
 
@@ -743,8 +743,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
 
                        print_const("\\begin{tabulary}{\\textwidth}{@{}");
 
-                       for (int i = 0; i < scratch->table_column_count; ++i)
-                       {
+                       for (int i = 0; i < scratch->table_column_count; ++i) {
                                switch (scratch->table_alignment[i]) {
                                        case 'l':
                                        case 'L':
@@ -799,7 +798,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                        print_const("\\}\\}");
                        break;
                case BRACKET_LEFT:
-                       print_const("[");                       
+                       print_const("[");
                        break;
                case BRACKET_ABBREVIATION_LEFT:
                        print_const("[>");
@@ -895,7 +894,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                        break;
                case ESCAPED_CHARACTER:
                        if (!(scratch->extensions & EXT_COMPATIBILITY) &&
-                               (source[t->start + 1] == ' ')) {
+                               (source[t->start + 1] == ' ')) {
                                print_const("~");
                        } else {
                                mmd_print_char_latex(out, source[t->start + 1]);
@@ -907,8 +906,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                case HASH4:
                case HASH5:
                case HASH6:
-                       for (int i = 0; i < t->len; ++i)
-                       {
+                       for (int i = 0; i < t->len; ++i) {
                                if (source[t->start + i] == '#') {
                                        print_char('\\');
                                        print_char('#');
@@ -1073,7 +1071,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                        break;
                case PAIR_BRACKET:
                        if ((scratch->extensions & EXT_NOTES) &&
-                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
+                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
                                goto parse_citation;
                        }
 
@@ -1089,8 +1087,8 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                        temp_token = t->next;
 
                                        if (temp_token &&
-                                               ((temp_token->type == PAIR_BRACKET) ||
-                                               (temp_token->type == PAIR_PAREN))) {
+                                               ((temp_token->type == PAIR_BRACKET) ||
+                                                (temp_token->type == PAIR_PAREN))) {
                                                temp_token = temp_token->next;
                                        }
 
@@ -1106,7 +1104,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                                mmd_export_image_latex(out, source, t, temp_link, scratch, true);
                                        }
                                }
-                               
+
                                if (temp_bool) {
                                        link_free(temp_link);
                                }
@@ -1160,7 +1158,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                        }
                        break;
                case PAIR_BRACKET_CITATION:
-                       parse_citation:
+parse_citation:
                        temp_bool = true;               // Track whether this is regular vs 'not cited'
                        temp_token = t;                 // Remember whether we need to skip ahead
 
@@ -1208,7 +1206,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                if (temp_short == -1) {
                                        temp_note = NULL;
                                } else {
-                                       temp_note = stack_peek_index(scratch->used_citations, temp_short - 1);                                  
+                                       temp_note = stack_peek_index(scratch->used_citations, temp_short - 1);
                                }
 
                                if (temp_bool) {
@@ -1297,7 +1295,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                if (temp_short2 == scratch->used_footnotes->size) {
                                        // This is a re-use of a previously used note
 
-                                       // TODO: This would work, assuming no URL's are converted to 
+                                       // TODO: This would work, assuming no URL's are converted to
                                        // footnotes without affecting the numbering.
                                        // Could add a NULL to the used_footnotes stack??
 
@@ -1338,7 +1336,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                if (temp_short == -1) {
                                        // This instance is not properly formed
                                        print_const("[?");
-                                       
+
                                        if (t->child)
                                                mmd_export_token_tree_latex(out, source, t->child->next, scratch);
                                        else
@@ -1374,7 +1372,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                                print(temp_note->clean_text);
 
                                                print_const(", description={");
-                                               
+
                                                // We skip over temp_note->content, since that is the term in use
                                                mmd_export_token_tree_latex(out, source, temp_note->content, scratch);
                                                print_const("}}\\gls{");
@@ -1414,7 +1412,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                        print_const("}");
                                }
                        } else {
-                               mmd_export_token_tree_latex(out, source, t->child, scratch);                            
+                               mmd_export_token_tree_latex(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_DEL:
@@ -1432,13 +1430,13 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                        print_const("}");
                                }
                        } else {
-                               mmd_export_token_tree_latex(out, source, t->child, scratch);                            
+                               mmd_export_token_tree_latex(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_COM:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1453,7 +1451,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                case PAIR_CRITIC_HI:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1474,8 +1472,8 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                        break;
                case PAIR_CRITIC_SUB_DEL:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->next) &&
-                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
+                               (t->next) &&
+                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_ACCEPT) {
@@ -1493,8 +1491,8 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                        break;
                case PAIR_CRITIC_SUB_ADD:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->prev) &&
-                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
+                               (t->prev) &&
+                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_REJECT) {
@@ -1540,8 +1538,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                        print_const(")");
                        break;
                case PIPE:
-                       for (int i = 0; i < t->len; ++i)
-                       {
+                       for (int i = 0; i < t->len; ++i) {
                                print_const("\\textbar{}");
                        }
                        break;
@@ -1598,7 +1595,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                                print_const("}");
                        } else {
                                print_const("\\^{}");
-                       }       
+                       }
                        break;
                case TABLE_CELL:
                        if (t->next && t->next->type == TABLE_DIVIDER) {
@@ -1729,7 +1726,7 @@ void mmd_export_token_latex_raw(DString * out, const char * source, token * t, s
                        if (t->next)
                                t->next->type = TEXT_EMPTY;
                case TEXT_EMPTY:
-                       break;                  
+                       break;
                default:
                        if (t->child)
                                mmd_export_token_tree_latex_raw(out, source, t->child, scratch);
@@ -2051,8 +2048,7 @@ void mmd_export_citation_list_latex(DString * out, const char * source, scratch_
                print_const("\\begin{thebibliography}{0}");
                scratch->padded = 0;
 
-               for (int i = 0; i < scratch->used_citations->size; ++i)
-               {
+               for (int i = 0; i < scratch->used_citations->size; ++i) {
                        // Export footnote
                        pad(out, 2, scratch);
 
index 4b59892261417817a11b7aad1699f4ff85de55ea..6578324fa01d2442721a341c3b6d129cfc9d1de8 100644 (file)
@@ -4,11 +4,11 @@
 
        @file memoir.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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
index 1be90e5d80ee15a689ce14550d6284eb8c8e5460..328e57f2cdf1d4e367002e2e516b3c15c53e996a 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -157,7 +157,7 @@ mmd_engine * mmd_engine_create(DString * d, unsigned long extensions) {
                        token_pair_engine_add_pairing(e->pairings3, BRACKET_GLOSSARY_LEFT, BRACKET_RIGHT, PAIR_BRACKET, PAIRING_ALLOW_EMPTY | PAIRING_PRUNE_MATCH);
                        token_pair_engine_add_pairing(e->pairings3, BRACKET_ABBREVIATION_LEFT, BRACKET_RIGHT, PAIR_BRACKET, PAIRING_ALLOW_EMPTY | PAIRING_PRUNE_MATCH);
                }
-               
+
                token_pair_engine_add_pairing(e->pairings3, BRACKET_VARIABLE_LEFT, BRACKET_RIGHT, PAIR_BRACKET_VARIABLE, PAIRING_ALLOW_EMPTY | PAIRING_PRUNE_MATCH);
 
                token_pair_engine_add_pairing(e->pairings3, BRACKET_IMAGE_LEFT, BRACKET_RIGHT, PAIR_BRACKET_IMAGE, PAIRING_ALLOW_EMPTY | PAIRING_PRUNE_MATCH);
@@ -183,7 +183,7 @@ mmd_engine * mmd_engine_create(DString * d, unsigned long extensions) {
                        token_pair_engine_add_pairing(e->pairings3, MATH_DOLLAR_SINGLE, MATH_DOLLAR_SINGLE, PAIR_MATH, PAIRING_ALLOW_EMPTY | PAIRING_PRUNE_MATCH);
                        token_pair_engine_add_pairing(e->pairings3, MATH_DOLLAR_DOUBLE, MATH_DOLLAR_DOUBLE, PAIR_MATH, PAIRING_ALLOW_EMPTY | PAIRING_PRUNE_MATCH);
                }
-       
+
                // Superscript/Subscript
                if (!(extensions & EXT_COMPATIBILITY)) {
                        token_pair_engine_add_pairing(e->pairings4, SUPERSCRIPT, SUPERSCRIPT, PAIR_SUPERSCRIPT, PAIRING_PRUNE_MATCH);
@@ -360,7 +360,7 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
        }
 
        const char * source = e->dstr->str;
-       
+
        token * t = NULL;
        short temp_short;
        size_t scan_len;
@@ -377,7 +377,7 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
                line->type = LINE_EMPTY;
                return;
        }
-       
+
        switch (line->child->type) {
                case INDENT_TAB:
                        if (line_is_empty(line->child)) {
@@ -466,13 +466,13 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
                                // Strip trailing '#' sequence if present
                                if (line->child->tail->type == TEXT_NL) {
                                        if ((line->child->tail->prev->type >= HASH1) &&
-                                               (line->child->tail->prev->type <= HASH6)) {
+                                               (line->child->tail->prev->type <= HASH6)) {
                                                line->child->tail->prev->type -= HASH1;
                                                line->child->tail->prev->type += MARKER_H1;
                                        }
                                } else {
                                        if ((line->child->tail->type >= HASH1) &&
-                                               (line->child->tail->type <= HASH6)) {
+                                               (line->child->tail->type <= HASH6)) {
                                                line->child->tail->type -= TEXT_EMPTY;
                                                line->child->tail->type += MARKER_H1;
                                        }
@@ -513,8 +513,8 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
                                                case NON_INDENT_SPACE:
                                                        t = line->child;
                                                        while(t->next && ((t->next->type == INDENT_SPACE) ||
-                                                               (t->next->type == INDENT_TAB) ||
-                                                               (t->next->type == NON_INDENT_SPACE))) {
+                                                                         (t->next->type == INDENT_TAB) ||
+                                                                         (t->next->type == NON_INDENT_SPACE))) {
                                                                tokens_prune(t->next, t->next);
                                                        }
                                                        break;
@@ -601,7 +601,7 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
                                line->type = LINE_PLAIN;
                                break;
                        }
-                       // If longer than 1 character, then it can't be a list marker, so it's a 
+                       // If longer than 1 character, then it can't be a list marker, so it's a
                        // plain line
                        if (line->child->len > 1) {
                                line->type = LINE_PLAIN;
@@ -631,8 +631,8 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
                                                        case NON_INDENT_SPACE:
                                                                t = line->child;
                                                                while(t->next && ((t->next->type == INDENT_SPACE) ||
-                                                                       (t->next->type == INDENT_TAB) ||
-                                                                       (t->next->type == NON_INDENT_SPACE))) {
+                                                                                 (t->next->type == INDENT_TAB) ||
+                                                                                 (t->next->type == NON_INDENT_SPACE))) {
                                                                        tokens_prune(t->next, t->next);
                                                                }
                                                                break;
@@ -720,7 +720,7 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
        }
 
        if ((line->type == LINE_PLAIN) &&
-               !(e->extensions & EXT_COMPATIBILITY)) {
+               !(e->extensions & EXT_COMPATIBILITY)) {
                // Check if this is a potential table line
                token * walker = line->child;
 
@@ -742,7 +742,7 @@ void mmd_assign_line_type(mmd_engine * e, token * line) {
 void deindent_line(token  * line) {
        if (!line || !line->child)
                return;
-       
+
        token * t;
 
        switch (line->child->type) {
@@ -784,7 +784,7 @@ void strip_quote_markers_from_line(token * line, const char * source) {
                return;
 
        token * t;
-       
+
        switch (line->child->type) {
                case MARKER_BLOCKQUOTE:
                case NON_INDENT_SPACE:
@@ -802,12 +802,12 @@ void strip_quote_markers_from_line(token * line, const char * source) {
        if (line->child && (line->child->type == TEXT_PLAIN)) {
                // Strip leading whitespace from first text token
                t = line->child;
-               
+
                while (t->len && char_is_whitespace(source[t->start])) {
                        t->start++;
                        t->len--;
                }
-               
+
                if (t->len == 0) {
                        line->child = t->next;
                        t->next = NULL;
@@ -815,7 +815,7 @@ void strip_quote_markers_from_line(token * line, const char * source) {
                                line->child->prev = NULL;
                                line->child->tail = t->tail;
                        }
-                       
+
                        token_free(t);
                }
        }
@@ -854,7 +854,7 @@ token * mmd_tokenize_string(mmd_engine * e, size_t start, size_t len, bool stop_
        // Strip trailing whitespace
 //     while (len && char_is_whitespace_or_line_ending(str[len - 1]))
 //             len--;
-       
+
        // Where do we stop parsing?
        const char * stop = &e->dstr->str[start] + len;
 
@@ -871,22 +871,22 @@ token * mmd_tokenize_string(mmd_engine * e, size_t start, size_t len, bool stop_
                type = scan(&s, stop);
 
                //if (type && s.start != last_stop) {
-        if (s.start != last_stop) {
+               if (s.start != last_stop) {
                        // We skipped characters between tokens
 
-            if (type) {
+                       if (type) {
                                // Create a default token type for the skipped characters
                                t = token_new(TEXT_PLAIN, (size_t)(last_stop - e->dstr->str), (size_t)(s.start - last_stop));
 
                                token_append_child(line, t);
-            } else {
+                       } else {
                                if (stop > last_stop) {
                                        // Source text ends without newline
                                        t = token_new(TEXT_PLAIN, (size_t)(last_stop - e->dstr->str), (size_t)(stop - last_stop));
-                
+
                                        token_append_child(line, t);
                                }
-            }
+                       }
                } else if (type == 0 && stop > last_stop) {
                        // Source text ends without newline
                        t = token_new(TEXT_PLAIN, (size_t)(last_stop - e->dstr->str), (size_t)(stop - last_stop));
@@ -940,7 +940,7 @@ token * mmd_tokenize_string(mmd_engine * e, size_t start, size_t len, bool stop_
                last_stop = s.cur;
        } while (type != 0);
 
-       
+
        return root;
 }
 
@@ -1065,7 +1065,7 @@ void mmd_pair_tokens_in_block(token * block, token_pair_engine * e, stack * s) {
 
 
 /// Ambidextrous tokens can open OR close a pair.  This routine gives the opportunity
-/// to change this behavior on case-by-case basis.  For example, in `foo **bar** foo`, the 
+/// to change this behavior on case-by-case basis.  For example, in `foo **bar** foo`, the
 /// first set of asterisks can open, but not close a pair.  The second set can close, but not
 /// open a pair.  This allows for complex behavior without having to bog down the tokenizer
 /// with figuring out which type of asterisk we have.  Default behavior is that open and close
@@ -1076,7 +1076,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
 
        size_t offset;          // Temp variable for use below
        size_t lead_count, lag_count, pre_count, post_count;
-       
+
        token * t = block->child;
 
        char * str = e->dstr->str;
@@ -1086,7 +1086,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                        case BLOCK_META:
                                // Do we treat this like metadata?
                                if (!(e->extensions & EXT_COMPATIBILITY) &&
-                                       !(e->extensions & EXT_NO_METADATA))
+                                       !(e->extensions & EXT_NO_METADATA))
                                        break;
                                // This is not metadata
                                t->type = BLOCK_PARA;
@@ -1129,23 +1129,23 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                        case STAR:
                                // Look left and skip over neighboring '*' characters
                                offset = t->start;
-                               
+
                                while ((offset != 0) && ((str[offset] == '*') || (str[offset] == '_'))) {
                                        offset--;
                                }
-                               
+
                                // We can only close if there is something to left besides whitespace
                                if ((offset == 0) || (char_is_whitespace_or_line_ending(str[offset]))) {
                                        // Whitespace or punctuation to left, so can't close
                                        t->can_close = 0;
                                }
-                               
+
                                // Look right and skip over neighboring '*' characters
                                offset = t->start + 1;
-                               
+
                                while ((str[offset] == '*') || (str[offset] == '_'))
                                        offset++;
-                               
+
                                // We can only open if there is something to right besides whitespace/punctuation
                                if (char_is_whitespace_or_line_ending(str[offset])) {
                                        // Whitespace to right, so can't open
@@ -1245,11 +1245,11 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                        case UL:
                                // Look left and skip over neighboring '_' characters
                                offset = t->start;
-                               
+
                                while ((offset != 0) && ((str[offset] == '_') || (str[offset] == '*'))) {
                                        offset--;
                                }
-                               
+
                                if ((offset == 0) || (char_is_whitespace_or_line_ending(str[offset]))) {
                                        // Whitespace to left, so can't close
                                        t->can_close = 0;
@@ -1260,18 +1260,18 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                                        // Letters to left, so can't open
                                        t->can_open = 0;
                                }
-                               
+
                                // Look right and skip over neighboring '_' characters
                                offset = t->start + 1;
-                               
+
                                while ((str[offset] == '*') || (str[offset] == '_'))
                                        offset++;
-                               
+
                                if (char_is_whitespace_or_line_ending(str[offset])) {
                                        // Whitespace to right, so can't open
                                        t->can_open = 0;
                                }
-                               
+
                                if (char_is_alphanumeric(str[offset])) {
                                        // Letters to right, so can't close
                                        t->can_close = 0;
@@ -1282,12 +1282,12 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                                // Backticks are used for code spans, but also for ``foo'' double quote syntax.
                                // We care only about the quote syntax.
                                offset = t->start;
-                               
+
                                // TODO: This does potentially prevent ``foo `` from closing due to space before closer?
                                // Bug or feature??
                                if (t->len != 2)
                                        break;
-                               
+
                                if ((offset == 0) || (str[offset] != '`' && char_is_whitespace_or_line_ending_or_punctuation(str[offset - 1]))) {
                                        // Whitespace or punctuation to left, so can't close
                                        t->can_close = 0;
@@ -1298,15 +1298,15 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                                offset = t->start;
 
                                if (!((offset == 0) ||
-                                       (char_is_whitespace_or_line_ending_or_punctuation(str[offset - 1])) ||
-                                       (char_is_whitespace_or_line_ending_or_punctuation(str[offset + 1])))) {
+                                       (char_is_whitespace_or_line_ending_or_punctuation(str[offset - 1])) ||
+                                       (char_is_whitespace_or_line_ending_or_punctuation(str[offset + 1])))) {
                                        t->type = APOSTROPHE;
                                        break;
                                }
 
                                if (offset && (char_is_punctuation(str[offset - 1])) &&
-                                       (char_is_alphanumeric(str[offset + 1]))) {
-                                       // If possessive apostrophe, e.g. `x`'s 
+                                       (char_is_alphanumeric(str[offset + 1]))) {
+                                       // If possessive apostrophe, e.g. `x`'s
                                        if (str[offset + 1] == 's' || str[offset + 1] == 'S') {
                                                if (char_is_whitespace_or_line_ending_or_punctuation(str[offset + 2])) {
                                                        t->type = APOSTROPHE;
@@ -1335,7 +1335,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                                if (t->len == 1) {
                                        // Check whether we have '1-2'
                                        if ((offset == 0) || (!char_is_digit(str[offset - 1])) ||
-                                               (!char_is_digit(str[offset + 1]))) {
+                                               (!char_is_digit(str[offset + 1]))) {
                                                t->type = TEXT_PLAIN;
                                        }
                                }
@@ -1351,14 +1351,14 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                                if ((offset == 0) || (char_is_whitespace_or_line_ending(str[offset - 1]))) {
                                        // Whitespace to left, so can't close
                                        t->can_close = 0;
-                               } else if ((offset != 0) && (!char_is_whitespace_or_line_ending_or_punctuation(str[offset - 1]))){
+                               } else if ((offset != 0) && (!char_is_whitespace_or_line_ending_or_punctuation(str[offset - 1]))) {
                                        // No whitespace or punctuation to left, can't open
                                        t->can_open = 0;
                                }
-                               
+
                                // Look right
                                offset = t->start + t->len;
-                               
+
                                if (char_is_whitespace_or_line_ending(str[offset])) {
                                        // Whitespace to right, so can't open
                                        t->can_open = 0;
@@ -1446,7 +1446,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
 
                                break;
                }
-               
+
                t = t->next;
        }
 
@@ -1454,13 +1454,13 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
 
 
 /// Strong/emph parsing is done using single `*` and `_` characters, which are
-/// then combined in a separate routine here to determine when 
+/// then combined in a separate routine here to determine when
 /// consecutive characters should be interpreted as STRONG instead of EMPH
 /// \todo: Perhaps combining this with the routine when they are paired
 /// would improve performance?
 void pair_emphasis_tokens(token * t) {
        token * closer;
-       
+
        while (t != NULL) {
                if (t->mate != NULL) {
                        switch (t->type) {
@@ -1468,19 +1468,19 @@ void pair_emphasis_tokens(token * t) {
                                case UL:
                                        closer = t->mate;
                                        if (t->next &&
-                                               (t->next->mate == closer->prev) &&
-                                               (t->type == t->next->type) &&
-                                               (t->next->mate != t) &&
-                                               (t->start+t->len == t->next->start) &&
-                                               (closer->start == closer->prev->start + closer->prev->len)) {
-                                               
+                                               (t->next->mate == closer->prev) &&
+                                               (t->type == t->next->type) &&
+                                               (t->next->mate != t) &&
+                                               (t->start+t->len == t->next->start) &&
+                                               (closer->start == closer->prev->start + closer->prev->len)) {
+
                                                // We have a strong pair
                                                t->type = STRONG_START;
                                                t->len = 2;
                                                closer->type = STRONG_STOP;
                                                closer->len = 2;
                                                closer->start--;
-                                               
+
                                                tokens_prune(t->next, t->next);
                                                tokens_prune(closer->prev, closer->prev);
 
@@ -1491,13 +1491,13 @@ void pair_emphasis_tokens(token * t) {
                                                token_prune_graft(t, closer, PAIR_EMPH);
                                        }
                                        break;
-                                       
+
                                default:
                                        break;
                        }
 
                }
-               
+
                if (t->child != NULL) {
                        switch(t->type) {
                                case PAIR_BACKTICK:
@@ -1508,7 +1508,7 @@ void pair_emphasis_tokens(token * t) {
                                        break;
                        }
                }
-               
+
                t = t->next;
        }
 }
@@ -1554,7 +1554,7 @@ void recursive_parse_indent(mmd_engine * e, token * block) {
 
 void is_list_loose(token * list) {
        bool loose = false;
-       
+
        token * walker = list->child;
 
        if (walker == NULL)
@@ -1568,7 +1568,7 @@ void is_list_loose(token * list) {
                                walker->type = BLOCK_LIST_ITEM_TIGHT;
                        }
                }
-               
+
                walker = walker->next;
        }
 
@@ -1588,8 +1588,8 @@ void is_list_loose(token * list) {
 /// Is this actually an HTML block?
 void is_para_html(mmd_engine * e, token * block) {
        if ((block == NULL) ||
-               (block->child == NULL) ||
-               (block->child->type != LINE_PLAIN))
+               (block->child == NULL) ||
+               (block->child->type != LINE_PLAIN))
                return;
        token * t = block->child->child;
 
@@ -1597,7 +1597,7 @@ void is_para_html(mmd_engine * e, token * block) {
                if (scan_html_block(&(e->dstr->str[t->start]))) {
                        block->type = BLOCK_HTML;
                        return;
-               }       
+               }
 
                if (scan_html_line(&(e->dstr->str[t->start]))) {
                        block->type = BLOCK_HTML;
@@ -1618,8 +1618,7 @@ void recursive_parse_blockquote(mmd_engine * e, token * block) {
 void metadata_stack_describe(mmd_engine * e) {
        meta * m;
 
-       for (int i = 0; i < e->metadata_stack->size; ++i)
-       {
+       for (int i = 0; i < e->metadata_stack->size; ++i) {
                m = stack_peek_index(e->metadata_stack, i);
                fprintf(stderr, "'%s': '%s'\n", m->key, m->value);
        }
@@ -1638,7 +1637,7 @@ void strip_line_tokens_from_metadata(mmd_engine * e, token * metadata) {
        while (l) {
                switch (l->type) {
                        case LINE_META:
-                       meta:
+meta:
                                if (m) {
                                        meta_set_value(m, d->str);
                                        d_string_erase(d, 0, -1);
@@ -1657,7 +1656,7 @@ void strip_line_tokens_from_metadata(mmd_engine * e, token * metadata) {
                                        l->len--;
                                }
                        case LINE_PLAIN:
-                       plain:
+plain:
                                d_string_append_c(d, '\n');
                                d_string_append_c_array(d, &source[l->start], l->len);
                                break;
@@ -1812,7 +1811,7 @@ void strip_line_tokens_from_block(mmd_engine * e, token * block) {
                        case LINE_SETEXT_1:
                        case LINE_SETEXT_2:
                                if ((block->type == BLOCK_SETEXT_1) ||
-                                       (block->type == BLOCK_SETEXT_2)) {
+                                       (block->type == BLOCK_SETEXT_2)) {
                                        temp = l->next;
                                        tokens_prune(l, l);
                                        l = temp;
@@ -1843,10 +1842,10 @@ void strip_line_tokens_from_block(mmd_engine * e, token * block) {
                        case LINE_PLAIN:
                        case LINE_START_COMMENT:
                        case LINE_STOP_COMMENT:
-                               handle_line:
+handle_line:
                                // Remove leading non-indent space from line
                                if (l->child && l->child->type == NON_INDENT_SPACE)
-                               token_remove_first_child(l);
+                                       token_remove_first_child(l);
 
                        case LINE_INDENTED_TAB:
                        case LINE_INDENTED_SPACE:
@@ -1855,8 +1854,8 @@ void strip_line_tokens_from_block(mmd_engine * e, token * block) {
                                        token_remove_first_child(l);
 
                                // If we're not a code block, strip additional indents
-                               if ((block->type != BLOCK_CODE_INDENTED) && 
-                                       (block->type != BLOCK_CODE_FENCED)) {
+                               if ((block->type != BLOCK_CODE_INDENTED) &&
+                                       (block->type != BLOCK_CODE_FENCED)) {
                                        while (l->child && ((l->child->type == INDENT_SPACE) || (l->child->type == INDENT_TAB)))
                                                token_remove_first_child(l);
                                }
@@ -1930,7 +1929,7 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt
        // First, clean up any leftovers from previous parse
 
        mmd_engine_reset(e);
-       
+
        // Tokenize the string
        token * doc = mmd_tokenize_string(e, byte_start, byte_len, false);
 
@@ -1968,7 +1967,7 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt
 /// Parse the entire string into a token tree
 void mmd_engine_parse_string(mmd_engine * e) {
        if (e) {
-               e->root = mmd_engine_parse_substring(e, 0, e->dstr->currentStringLength);               
+               e->root = mmd_engine_parse_substring(e, 0, e->dstr->currentStringLength);
        }
 }
 
@@ -2004,15 +2003,15 @@ bool mmd_engine_has_metadata(mmd_engine * e, size_t * end) {
        bool result = false;
        if (!e)
                return false;
-       
+
        if (!(scan_meta_line(&e->dstr->str[0]))) {
                // First line is not metadata, so can't have metadata
-               // Saves the time of an unnecessary parse 
+               // Saves the time of an unnecessary parse
                // TODO:  Need faster confirmation of actual metadata than full tokenizing
                if (end) {
                        *end = 0;
                }
-       
+
                return false;
        }
 
@@ -2083,8 +2082,7 @@ char * mmd_engine_metadata_keys(mmd_engine * e) {
 
        meta * m;
 
-       for (int i = 0; i < e->metadata_stack->size; ++i)
-       {
+       for (int i = 0; i < e->metadata_stack->size; ++i) {
                m = stack_peek_index(e->metadata_stack, i);
 
                d_string_append_printf(output, "%s\n", m->key);
@@ -2103,8 +2101,8 @@ char * mmd_string_metavalue_for_key(char * source, const char * key) {
        char * result;
 
        mmd_engine * e = mmd_engine_create_with_string(source, 0);
-    result = mmd_engine_metavalue_for_key(e, key);
-    result = my_strdup(result);
+       result = mmd_engine_metavalue_for_key(e, key);
+       result = my_strdup(result);
 
        mmd_engine_free(e, true);
 
@@ -2118,10 +2116,10 @@ char * mmd_d_string_metavalue_for_key(DString * source, const char * key) {
        char * result;
 
        mmd_engine * e = mmd_engine_create_with_dstring(source, 0);
-    result = mmd_engine_metavalue_for_key(e, key);
-    if (result) {
-        result = my_strdup(result);
-    }
+       result = mmd_engine_metavalue_for_key(e, key);
+       if (result) {
+               result = my_strdup(result);
+       }
 
        mmd_engine_free(e, false);
 
@@ -2143,8 +2141,7 @@ char * mmd_engine_metavalue_for_key(mmd_engine * e, const char * key) {
 
        meta * m;
 
-       for (int i = 0; i < e->metadata_stack->size; ++i)
-       {
+       for (int i = 0; i < e->metadata_stack->size; ++i) {
                m = stack_peek_index(e->metadata_stack, i);
 
                if (strcmp(clean, m->key) == 0) {
@@ -2203,8 +2200,7 @@ void mmd_engine_update_metavalue_for_key(mmd_engine * e, const char * key, const
 
        meta * m;
 
-       for (int i = 0; i < e->metadata_stack->size; ++i)
-       {
+       for (int i = 0; i < e->metadata_stack->size; ++i) {
                m = stack_peek_index(e->metadata_stack, i);
 
                if (strcmp(clean, m->key) == 0) {
@@ -2356,7 +2352,7 @@ void mmd_engine_convert_to_file(mmd_engine * e, short format, const char * direc
        DString * output = d_string_new("");
 
        mmd_engine_parse_string(e);
-       
+
        mmd_engine_export_token_tree(output, e, format);
 
        // Now we have the input source string, the output string, the (modified) parse tree, and engine stacks
@@ -2419,7 +2415,7 @@ DString * mmd_engine_convert_to_data(mmd_engine * e, short format, const char *
        DString * result = NULL;
 
        mmd_engine_parse_string(e);
-       
+
        mmd_engine_export_token_tree(output, e, format);
 
        switch (format) {
@@ -2441,7 +2437,7 @@ DString * mmd_engine_convert_to_data(mmd_engine * e, short format, const char *
                        break;
                case FORMAT_FODT:
                        result = opendocument_flat_text_create(output->str, e, directory);
-                       
+
                        d_string_free(output, true);
                        break;
                default:
index 9579c8d50b8cd1128646c09fef58fedea3154f1c..3b85c1c32944b3ec8f4c3b5af345646235df6588 100644 (file)
@@ -5,12 +5,12 @@
        @file object_pool.c
 
        @brief Allocate memory for "objects" in large slabs, rather than one at a time. Improves
-       performance when generating large numbers of small chunks of memory, as the expense of 
+       performance when generating large numbers of small chunks of memory, as the expense of
        allocating memory in larger units.  Could cause difficulty in extreme low memory situations.
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
index f1a95c861c70f6eee6aec4252d6621e0390275a0..d7824de18cc187d5207e4a5f979835e0fbcda936 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
+
 
 */
 
@@ -158,7 +158,7 @@ void mmd_print_char_opendocument(DString * out, char c) {
 void mmd_print_string_opendocument(DString * out, const char * str) {
        if (str == NULL)
                return;
-       
+
        while (*str != '\0') {
                mmd_print_char_opendocument(out, *str);
                str++;
@@ -196,7 +196,7 @@ void mmd_print_localized_char_opendocument(DString * out, unsigned short type, s
                                        break;
                                default:
                                        print_const("&#8216;");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_SINGLE:
                        switch (scratch->quotes_lang) {
@@ -208,7 +208,7 @@ void mmd_print_localized_char_opendocument(DString * out, unsigned short type, s
                                        break;
                                default:
                                        print_const("&#8217;");
-                               }
+                       }
                        break;
                case QUOTE_LEFT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -227,7 +227,7 @@ void mmd_print_localized_char_opendocument(DString * out, unsigned short type, s
                                        break;
                                default:
                                        print_const("&#8220;");
-                               }
+                       }
                        break;
                case QUOTE_RIGHT_DOUBLE:
                        switch (scratch->quotes_lang) {
@@ -244,7 +244,7 @@ void mmd_print_localized_char_opendocument(DString * out, unsigned short type, s
                                case DUTCH:
                                default:
                                        print_const("&#8221;");
-                               }
+                       }
                        break;
        }
 }
@@ -344,17 +344,17 @@ void mmd_export_link_opendocument(DString * out, const char * source, token * te
 static char * correct_dimension_units(char *original) {
        char *result;
        int i;
-       
+
        result = my_strdup(original);
-       
+
        for (i = 0; result[i]; i++)
                result[i] = tolower(result[i]);
-       
+
        if (strstr(&result[strlen(result)-2],"px")) {
                result[strlen(result)-2] = '\0';
                strcat(result, "pt");
        }
-       
+
        return result;
 }
 
@@ -401,9 +401,9 @@ void mmd_export_image_opendocument(DString * out, const char * source, token * t
                        store_asset(scratch, link->url);
                        asset * a = extract_asset(scratch, link->url);
 
-                       printf(">\n<draw:image xlink:href=\"Pictures/%s\"", a->asset_path);                     
+                       printf(">\n<draw:image xlink:href=\"Pictures/%s\"", a->asset_path);
                } else {
-                       printf(">\n<draw:image xlink:href=\"%s\"", link->url);                  
+                       printf(">\n<draw:image xlink:href=\"%s\"", link->url);
                }
        }
 
@@ -458,7 +458,7 @@ void mmd_export_toc_entry_opendocument(DString * out, const char * source, scrat
                        (*counter)--;
                        break;
                }
-               
+
                // Increment counter
                (*counter)++;
        }
@@ -527,8 +527,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                        print_token(t);
                                } else {
                                        print_localized(QUOTE_LEFT_DOUBLE);
-                               }
-                       else if (t->start < t->mate->start) {
+                               } else if (t->start < t->mate->start) {
                                print_const("<text:span text:style-name=\"Source_20_Text\">");
                        } else {
                                print_const("</text:span>");
@@ -567,7 +566,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                                        d_string_append_c_array(out, &source[t->child->next->start], temp_token->start - t->child->next->start);
                                                        scratch->padded = 1;
                                                } else {
-                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);                                                      
+                                                       d_string_append_c_array(out, &source[t->child->start + t->child->len], t->start + t->len - t->child->next->start);
                                                        scratch->padded = 0;
                                                }
                                        }
@@ -576,7 +575,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                        break;
                                }
                        }
-                       
+
                        free(temp_char);
 
                        print_const("<text:p text:style-name=\"Preformatted Text\">");
@@ -605,7 +604,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                mmd_export_token_tree_opendocument(out, source, t->child, scratch);
                                print_const("</text:p>");
                        } else {
-                               mmd_export_token_tree_opendocument(out, source, t->child, scratch);                             
+                               mmd_export_token_tree_opendocument(out, source, t->child, scratch);
                        }
                        scratch->padded = 0;
 
@@ -620,7 +619,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
 
 //                     if (!(t->prev && (t->prev->type == BLOCK_DEFLIST)))
 //                             print_const("<dl>\n");
-       
+
                        scratch->padded = 2;
 
                        mmd_export_token_tree_opendocument(out, source, t->child, scratch);
@@ -735,7 +734,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        mmd_export_token_tree_opendocument(out, source, t->child, scratch);
 
                        if (t->child && t->child->type != BLOCK_PARA)
-                       print_const("</text:p>");
+                               print_const("</text:p>");
 
                        print_const("</text:list-item>");
                        scratch->padded = 0;
@@ -757,7 +756,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                case PAIR_BRACKET_GLOSSARY:
                                        print_const(" text:style-name=\"Footnote\">");
                                        break;
-                               default:                                
+                               default:
                                        print_const(" text:style-name=\"Standard\">");
                                        break;
                        }
@@ -774,8 +773,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        scratch->padded = 2;
                        read_table_column_alignments(source, t, scratch);
 
-                       for (int i = 0; i < scratch->table_column_count; ++i)
-                       {
+                       for (int i = 0; i < scratch->table_column_count; ++i) {
                                print_const("<table:table-column/>\n");
 //                             switch (scratch->table_alignment[i]) {
 //                                     case 'l':
@@ -812,7 +810,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                temp_token = t->next->child;
 
                                if (temp_token->next &&
-                                       temp_token->next->type == PAIR_BRACKET) {
+                                       temp_token->next->type == PAIR_BRACKET) {
                                        temp_token = temp_token->next;
                                }
 
@@ -875,7 +873,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        print_const("[#");
                        break;
                case BRACKET_LEFT:
-                       print_const("[");                       
+                       print_const("[");
                        break;
                case BRACKET_RIGHT:
                        print_const("]");
@@ -951,7 +949,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        break;
                case ESCAPED_CHARACTER:
                        if (!(scratch->extensions & EXT_COMPATIBILITY) &&
-                               (source[t->start + 1] == ' ')) {
+                               (source[t->start + 1] == ' ')) {
                                print_const(" ");              // This is a non-breaking space character
                        } else {
                                mmd_print_char_opendocument(out, source[t->start + 1]);
@@ -1134,7 +1132,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        break;
                case PAIR_BRACKET:
                        if ((scratch->extensions & EXT_NOTES) &&
-                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
+                               (t->next && t->next->type == PAIR_BRACKET_CITATION)) {
                                goto parse_citation;
                        }
 
@@ -1150,8 +1148,8 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                        temp_token = t->next;
 
                                        if (temp_token &&
-                                               ((temp_token->type == PAIR_BRACKET) ||
-                                               (temp_token->type == PAIR_PAREN))) {
+                                               ((temp_token->type == PAIR_BRACKET) ||
+                                                (temp_token->type == PAIR_PAREN))) {
                                                temp_token = temp_token->next;
                                        }
 
@@ -1167,7 +1165,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                                mmd_export_image_opendocument(out, source, t, temp_link, scratch, true);
                                        }
                                }
-                               
+
                                if (temp_bool) {
                                        link_free(temp_link);
                                }
@@ -1181,7 +1179,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        mmd_export_token_tree_opendocument(out, source, t->child, scratch);
                        break;
                case PAIR_BRACKET_CITATION:
-                       parse_citation:
+parse_citation:
                        temp_bool = true;               // Track whether this is regular vs 'not cited'
                        temp_token = t;                 // Remember whether we need to skip ahead
 
@@ -1232,7 +1230,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
 
                                        if (temp_char[0] == '\0') {
                                                // No locator
-                               
+
                                                if (temp_short2 == scratch->used_citations->size) {
                                                        // This is a re-use of a previously used note
                                                        print_const("<text:span text:style-name=\"Footnote_20_anchor\"><text:note-ref text:note-class=\"endnote\" text:reference-format=\"text\" ");
@@ -1262,17 +1260,17 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                                }
                                        }
                                } else {
-                                               if (temp_short2 == scratch->used_citations->size) {
-                                                       // This is a re-use of a previously used note
-                                               } else {
-                                                       // This is the first time this note was used
-                                                       // TODO: Not sure how to add an endnote without inserting a marker in the text
-                                                       printf("<text:note text:id=\"cite%d\" text:note-class=\"endnote\"><text:note-body>", temp_short);
-                                                       temp_note = stack_peek_index(scratch->used_citations, temp_short - 1);
+                                       if (temp_short2 == scratch->used_citations->size) {
+                                               // This is a re-use of a previously used note
+                                       } else {
+                                               // This is the first time this note was used
+                                               // TODO: Not sure how to add an endnote without inserting a marker in the text
+                                               printf("<text:note text:id=\"cite%d\" text:note-class=\"endnote\"><text:note-body>", temp_short);
+                                               temp_note = stack_peek_index(scratch->used_citations, temp_short - 1);
 
-                                                       mmd_export_token_tree_opendocument(out, source, temp_note->content, scratch);
-                                                       print_const("</text:note-body></text:note>");
-                                               }
+                                               mmd_export_token_tree_opendocument(out, source, temp_note->content, scratch);
+                                               print_const("</text:note-body></text:note>");
+                                       }
                                }
 
                                if (temp_token != t) {
@@ -1379,13 +1377,13 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                                // This is a reference definition
                                                mmd_print_string_opendocument(out, temp_note->clean_text);
                                                print_const(" (");
-                                               mmd_print_string_opendocument(out, temp_note->label_text); 
+                                               mmd_print_string_opendocument(out, temp_note->label_text);
                                                print_const(")");
                                        } else {
                                                // This is an inline definition
                                                mmd_print_string_opendocument(out, temp_note->clean_text);
                                                print_const(" (");
-                                               mmd_print_string_opendocument(out, temp_note->label_text); 
+                                               mmd_print_string_opendocument(out, temp_note->label_text);
                                                print_const(")");
                                        }
 
@@ -1422,11 +1420,11 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                if (temp_short2 == scratch->used_glossaries->size) {
                                        // This is a re-use of a previously used note
 
-                                       mmd_print_string_opendocument(out, temp_note->clean_text); 
+                                       mmd_print_string_opendocument(out, temp_note->clean_text);
                                } else {
                                        // This is the first time this note was used
 
-                                       mmd_print_string_opendocument(out, temp_note->clean_text); 
+                                       mmd_print_string_opendocument(out, temp_note->clean_text);
 
                                        printf("<text:note text:id=\"gn%d\" text:note-class=\"glossary\"><text:note-body>", temp_short);
                                        mmd_export_token_tree_opendocument(out, source, temp_note->content, scratch);
@@ -1466,7 +1464,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                        print_const("</text:span>");
                                }
                        } else {
-                               mmd_export_token_tree_opendocument(out, source, t->child, scratch);                             
+                               mmd_export_token_tree_opendocument(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_DEL:
@@ -1484,13 +1482,13 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                        print_const("</text:span>");
                                }
                        } else {
-                               mmd_export_token_tree_opendocument(out, source, t->child, scratch);                             
+                               mmd_export_token_tree_opendocument(out, source, t->child, scratch);
                        }
                        break;
                case PAIR_CRITIC_COM:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1505,7 +1503,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                case PAIR_CRITIC_HI:
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
-                               (scratch->extensions & EXT_CRITIC_ACCEPT))
+                               (scratch->extensions & EXT_CRITIC_ACCEPT))
                                break;
                        if (scratch->extensions & EXT_CRITIC) {
                                t->child->type = TEXT_EMPTY;
@@ -1525,8 +1523,8 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        break;
                case PAIR_CRITIC_SUB_DEL:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->next) &&
-                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
+                               (t->next) &&
+                               (t->next->type == PAIR_CRITIC_SUB_ADD)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_ACCEPT) {
@@ -1544,8 +1542,8 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                        break;
                case PAIR_CRITIC_SUB_ADD:
                        if ((scratch->extensions & EXT_CRITIC) &&
-                               (t->prev) &&
-                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
+                               (t->prev) &&
+                               (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
                                t->child->type = TEXT_EMPTY;
                                t->child->mate->type = TEXT_EMPTY;
                                if (scratch->extensions & EXT_CRITIC_REJECT) {
@@ -1637,7 +1635,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                print_const("</text:span>");
                        } else {
                                print_const("^");
-                       }       
+                       }
                        break;
                case TABLE_CELL:
                        print_const("<table:table-cell");
@@ -1678,7 +1676,7 @@ void mmd_export_token_opendocument(DString * out, const char * source, token * t
                                scratch->table_cell_count += t->next->len;
                        else
                                scratch->table_cell_count++;
-                       
+
                        break;
                case TABLE_DIVIDER:
                        break;
index 725797bb29bc7fd3637eb77da2aad5da26d30b8b..d3e318b9f1787c392d4e6c3e56acd1db9537737c 100644 (file)
@@ -4,11 +4,11 @@
 
        @file opendocument.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.
-       
+
 
 */
 
@@ -135,7 +135,7 @@ static char * my_strdup(const char * source) {
 static bool add_asset_from_file(mz_zip_archive * pZip, asset * a, const char * destination, const char * directory) {
        if (!directory)
                return false;
-       
+
        char * path = path_from_dir_base(directory, a->url);
        mz_bool status;
        bool result = false;
@@ -207,7 +207,7 @@ char * opendocument_metadata(mmd_engine * e, scratch_pad * scratch) {
        }
 
        d_string_append(out, "</office:meta>");
-       
+
        char * result = out->str;
        d_string_free(out, false);
        return result;
@@ -242,255 +242,255 @@ char * opendocument_metadata_file(mmd_engine * e, scratch_pad * scratch) {
 char * opendocument_style(int format) {
        DString * out = d_string_new("");
 
-               /* Font Declarations */
+       /* Font Declarations */
        print_const("<office:font-face-decls>\n" \
-       "   <style:font-face style:name=\"Courier New\" svg:font-family=\"'Courier New'\"\n" \
-    "                    style:font-adornments=\"Regular\"\n" \
-    "                    style:font-family-generic=\"modern\"\n" \
-    "                    style:font-pitch=\"fixed\"/>\n" \
-    "</office:font-face-decls>\n");
-    
-    /* Append basic style information */
-    print_const("<office:styles>\n" \
-    "<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n" \
-    "      <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.15in\"" \
-    "     fo:text-align=\"justify\" style:justify-single-word=\"false\"/>\n" \
-    "   </style:style>\n" \
-    "<style:style style:name=\"Preformatted_20_Text\" style:display-name=\"Preformatted Text\"\n" \
-    "             style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"html\">\n" \
-    "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0in\" fo:text-align=\"start\"\n" \
-    "                               style:justify-single-word=\"false\"/>\n" \
-    "   <style:text-properties style:font-name=\"Courier New\" fo:font-size=\"11pt\"\n" \
-    "                          style:font-name-asian=\"Courier New\"\n" \
-    "                          style:font-size-asian=\"11pt\"\n" \
-    "                          style:font-name-complex=\"Courier New\"\n" \
-    "                          style:font-size-complex=\"11pt\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Source_20_Text\" style:display-name=\"Source Text\"\n" \
-    "             style:family=\"text\">\n" \
-    "   <style:text-properties style:font-name=\"Courier New\" style:font-name-asian=\"Courier New\"\n" \
-    "                          style:font-name-complex=\"Courier New\"\n" \
-    "                          fo:font-size=\"11pt\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"List\" style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"list\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
-    "   <style:text-properties style:font-size-asian=\"12pt\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Quotations\" style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"html\">\n" \
-    "   <style:paragraph-properties fo:margin-left=\"0.3937in\" fo:margin-right=\"0.3937in\" fo:margin-top=\"0in\"\n" \
-    "                               fo:margin-bottom=\"0.1965in\"\n" \
-    "                               fo:text-align=\"justify\"" \
-    "                               style:justify-single-word=\"false\"" \
-    "                               fo:text-indent=\"0in\"\n" \
-    "                               style:auto-text-indent=\"false\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Table_20_Heading\" style:display-name=\"Table Heading\"\n" \
-    "             style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Table_20_Contents\"\n" \
-    "             style:class=\"extra\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"\n" \
-    "                               text:number-lines=\"false\"\n" \
-    "                               text:line-number=\"0\"/>\n" \
-    "   <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
-    "                          style:font-weight-complex=\"bold\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"Horizontal_20_Line\" style:display-name=\"Horizontal Line\"\n" \
-    "             style:family=\"paragraph\"\n" \
-    "             style:parent-style-name=\"Standard\"\n" \
-    "             style:class=\"html\">\n" \
-    "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.1965in\"\n" \
-    "                               style:border-line-width-bottom=\"0.0008in 0.0138in 0.0008in\"\n" \
-    "                               fo:padding=\"0in\"\n" \
-    "                               fo:border-left=\"none\"\n" \
-    "                               fo:border-right=\"none\"\n" \
-    "                               fo:border-top=\"none\"\n" \
-    "                               fo:border-bottom=\"0.0154in double #808080\"\n" \
-    "                               text:number-lines=\"false\"\n" \
-    "                               text:line-number=\"0\"\n" \
-    "                               style:join-border=\"false\"/>\n" \
-    "   <style:text-properties fo:font-size=\"6pt\" style:font-size-asian=\"6pt\" style:font-size-complex=\"6pt\"/>\n" \
-    "</style:style>\n" \
-       "<style:style style:name=\"Footnote_20_anchor\" style:display-name=\"Footnote anchor\"" \
-       "              style:family=\"text\">" \
-       "    <style:text-properties style:text-position=\"super 58%\"/>" \
-       " </style:style>\n" \
-       "<style:style style:name=\"TOC_Item\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
-       " <style:paragraph-properties>\n" \
-       "  <style:tab-stops>\n" \
-       "   <style:tab-stop style:position=\"6.7283in\" style:type=\"right\" style:leader-style=\"dotted\" style:leader-text=\".\"/>\n" \
-       "  </style:tab-stops>\n" \
-       " </style:paragraph-properties>\n" \
-       "</style:style>\n" \
-       "  <text:notes-configuration text:note-class=\"footnote\" text:default-style-name=\"Footnote\" text:citation-style-name=\"Footnote_20_Symbol\" text:citation-body-style-name=\"Footnote_20_anchor\" text:master-page-name=\"Footnote\" style:num-format=\"a\" text:start-value=\"0\" text:footnotes-position=\"page\" text:start-numbering-at=\"page\"/>\n" \
-       "  <text:notes-configuration text:note-class=\"endnote\" text:default-style-name=\"Endnote\" text:citation-style-name=\"Endnote_20_Symbol\" text:citation-body-style-name=\"Endnote_20_anchor\" text:master-page-name=\"Endnote\" style:num-format=\"1\" text:start-value=\"0\"/>\n" \
-    "</office:styles>\n");
-
-    /* Automatic style information */
-    print_const("<office:automatic-styles>" \
-    "   <style:style style:name=\"MMD-Italic\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\"\n" \
-    "                             style:font-style-complex=\"italic\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"MMD-Bold\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
-    "                             style:font-weight-complex=\"bold\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"MMD-Superscript\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-position=\"super 58%\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"MMD-Subscript\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-position=\"sub 58%\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Strike\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-line-through-style=\"solid\" />\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Underline\" style:family=\"text\">\n" \
-    "      <style:text-properties style:text-underline-style=\"solid\" style:text-underline-color=\"font-color\"/>\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Highlight\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:background-color=\"#FFFF00\" />\n" \
-    "   </style:style>\n" \
-    "   <style:style style:name=\"Comment\" style:family=\"text\">\n" \
-    "      <style:text-properties fo:color=\"#0000BB\" />\n" \
-    "   </style:style>\n" \
-    "<style:style style:name=\"MMD-Table\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
-    "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.05in\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"MMD-Table-Center\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"MMD-Table-Right\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
-    "   <style:paragraph-properties fo:text-align=\"right\" style:justify-single-word=\"false\"/>\n" \
-    "</style:style>\n" \
-    "<style:style style:name=\"P2\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
-    "             style:list-style-name=\"L2\">\n" \
-    "<style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
-    "</style:style>\n" \
-       "<style:style style:name=\"fr1\" style:family=\"graphic\" style:parent-style-name=\"Frame\">\n" \
-       "   <style:graphic-properties style:print-content=\"true\" style:vertical-pos=\"top\"\n" \
-       "                             style:vertical-rel=\"baseline\"\n" \
-       "                             fo:padding=\"0in\"\n" \
-       "                             fo:border=\"none\"\n" \
-       "                             style:shadow=\"none\"/>\n" \
-       "</style:style>\n" \
-    "<style:style style:name=\"P1\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
-    "             style:list-style-name=\"L1\"/>\n" \
-       "<text:list-style style:name=\"L1\">\n" \
-       "       <text:list-level-style-bullet text:level=\"1\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"•\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-bullet>\n" \
-       "       <text:list-level-style-bullet text:level=\"2\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â—¦\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-bullet>\n" \
-       "       <text:list-level-style-bullet text:level=\"3\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â–ª\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-bullet>\n" \
-       "       <text:list-level-style-number text:level=\"4\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"5\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"6\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"7\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"8\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"9\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"10\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "</text:list-style>\n" \
-       "<text:list-style style:name=\"L2\">\n" \
-       "       <text:list-level-style-number text:level=\"1\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"2\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"3\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"4\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"5\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"6\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"7\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"8\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"9\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "       <text:list-level-style-number text:level=\"10\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
-       "               <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
-       "                       <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
-       "               </style:list-level-properties>\n" \
-       "       </text:list-level-style-number>\n" \
-       "</text:list-style>\n" \
-    "</office:automatic-styles>\n" \
-       " <office:master-styles>\n" \
-       "  <style:master-page style:name=\"Endnote\" >\n" \
-       "    <style:header><text:h text:outline-level=\"2\">Bibliography</text:h></style:header></style:master-page>\n" \
-       "  <style:master-page style:name=\"Footnote\" style:page-layout-name=\"pm2\"/>\n" \
-       " </office:master-styles>\n");
+                   "   <style:font-face style:name=\"Courier New\" svg:font-family=\"'Courier New'\"\n" \
+                   "                    style:font-adornments=\"Regular\"\n" \
+                   "                    style:font-family-generic=\"modern\"\n" \
+                   "                    style:font-pitch=\"fixed\"/>\n" \
+                   "</office:font-face-decls>\n");
+
+       /* Append basic style information */
+       print_const("<office:styles>\n" \
+                   "<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n" \
+                   "      <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.15in\"" \
+                   "     fo:text-align=\"justify\" style:justify-single-word=\"false\"/>\n" \
+                   "   </style:style>\n" \
+                   "<style:style style:name=\"Preformatted_20_Text\" style:display-name=\"Preformatted Text\"\n" \
+                   "             style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"html\">\n" \
+                   "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0in\" fo:text-align=\"start\"\n" \
+                   "                               style:justify-single-word=\"false\"/>\n" \
+                   "   <style:text-properties style:font-name=\"Courier New\" fo:font-size=\"11pt\"\n" \
+                   "                          style:font-name-asian=\"Courier New\"\n" \
+                   "                          style:font-size-asian=\"11pt\"\n" \
+                   "                          style:font-name-complex=\"Courier New\"\n" \
+                   "                          style:font-size-complex=\"11pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Source_20_Text\" style:display-name=\"Source Text\"\n" \
+                   "             style:family=\"text\">\n" \
+                   "   <style:text-properties style:font-name=\"Courier New\" style:font-name-asian=\"Courier New\"\n" \
+                   "                          style:font-name-complex=\"Courier New\"\n" \
+                   "                          fo:font-size=\"11pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"List\" style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"list\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
+                   "   <style:text-properties style:font-size-asian=\"12pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Quotations\" style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"html\">\n" \
+                   "   <style:paragraph-properties fo:margin-left=\"0.3937in\" fo:margin-right=\"0.3937in\" fo:margin-top=\"0in\"\n" \
+                   "                               fo:margin-bottom=\"0.1965in\"\n" \
+                   "                               fo:text-align=\"justify\"" \
+                   "                               style:justify-single-word=\"false\"" \
+                   "                               fo:text-indent=\"0in\"\n" \
+                   "                               style:auto-text-indent=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Table_20_Heading\" style:display-name=\"Table Heading\"\n" \
+                   "             style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Table_20_Contents\"\n" \
+                   "             style:class=\"extra\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"\n" \
+                   "                               text:number-lines=\"false\"\n" \
+                   "                               text:line-number=\"0\"/>\n" \
+                   "   <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
+                   "                          style:font-weight-complex=\"bold\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Horizontal_20_Line\" style:display-name=\"Horizontal Line\"\n" \
+                   "             style:family=\"paragraph\"\n" \
+                   "             style:parent-style-name=\"Standard\"\n" \
+                   "             style:class=\"html\">\n" \
+                   "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.1965in\"\n" \
+                   "                               style:border-line-width-bottom=\"0.0008in 0.0138in 0.0008in\"\n" \
+                   "                               fo:padding=\"0in\"\n" \
+                   "                               fo:border-left=\"none\"\n" \
+                   "                               fo:border-right=\"none\"\n" \
+                   "                               fo:border-top=\"none\"\n" \
+                   "                               fo:border-bottom=\"0.0154in double #808080\"\n" \
+                   "                               text:number-lines=\"false\"\n" \
+                   "                               text:line-number=\"0\"\n" \
+                   "                               style:join-border=\"false\"/>\n" \
+                   "   <style:text-properties fo:font-size=\"6pt\" style:font-size-asian=\"6pt\" style:font-size-complex=\"6pt\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"Footnote_20_anchor\" style:display-name=\"Footnote anchor\"" \
+                   "              style:family=\"text\">" \
+                   "    <style:text-properties style:text-position=\"super 58%\"/>" \
+                   " </style:style>\n" \
+                   "<style:style style:name=\"TOC_Item\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
+                   " <style:paragraph-properties>\n" \
+                   "  <style:tab-stops>\n" \
+                   "   <style:tab-stop style:position=\"6.7283in\" style:type=\"right\" style:leader-style=\"dotted\" style:leader-text=\".\"/>\n" \
+                   "  </style:tab-stops>\n" \
+                   " </style:paragraph-properties>\n" \
+                   "</style:style>\n" \
+                   "  <text:notes-configuration text:note-class=\"footnote\" text:default-style-name=\"Footnote\" text:citation-style-name=\"Footnote_20_Symbol\" text:citation-body-style-name=\"Footnote_20_anchor\" text:master-page-name=\"Footnote\" style:num-format=\"a\" text:start-value=\"0\" text:footnotes-position=\"page\" text:start-numbering-at=\"page\"/>\n" \
+                   "  <text:notes-configuration text:note-class=\"endnote\" text:default-style-name=\"Endnote\" text:citation-style-name=\"Endnote_20_Symbol\" text:citation-body-style-name=\"Endnote_20_anchor\" text:master-page-name=\"Endnote\" style:num-format=\"1\" text:start-value=\"0\"/>\n" \
+                   "</office:styles>\n");
+
+       /* Automatic style information */
+       print_const("<office:automatic-styles>" \
+                   "   <style:style style:name=\"MMD-Italic\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\"\n" \
+                   "                             style:font-style-complex=\"italic\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"MMD-Bold\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
+                   "                             style:font-weight-complex=\"bold\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"MMD-Superscript\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-position=\"super 58%\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"MMD-Subscript\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-position=\"sub 58%\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Strike\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-line-through-style=\"solid\" />\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Underline\" style:family=\"text\">\n" \
+                   "      <style:text-properties style:text-underline-style=\"solid\" style:text-underline-color=\"font-color\"/>\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Highlight\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:background-color=\"#FFFF00\" />\n" \
+                   "   </style:style>\n" \
+                   "   <style:style style:name=\"Comment\" style:family=\"text\">\n" \
+                   "      <style:text-properties fo:color=\"#0000BB\" />\n" \
+                   "   </style:style>\n" \
+                   "<style:style style:name=\"MMD-Table\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
+                   "   <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.05in\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"MMD-Table-Center\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"MMD-Table-Right\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
+                   "   <style:paragraph-properties fo:text-align=\"right\" style:justify-single-word=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"P2\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
+                   "             style:list-style-name=\"L2\">\n" \
+                   "<style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"fr1\" style:family=\"graphic\" style:parent-style-name=\"Frame\">\n" \
+                   "   <style:graphic-properties style:print-content=\"true\" style:vertical-pos=\"top\"\n" \
+                   "                             style:vertical-rel=\"baseline\"\n" \
+                   "                             fo:padding=\"0in\"\n" \
+                   "                             fo:border=\"none\"\n" \
+                   "                             style:shadow=\"none\"/>\n" \
+                   "</style:style>\n" \
+                   "<style:style style:name=\"P1\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
+                   "             style:list-style-name=\"L1\"/>\n" \
+                   "<text:list-style style:name=\"L1\">\n" \
+                   "   <text:list-level-style-bullet text:level=\"1\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"•\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-bullet>\n" \
+                   "   <text:list-level-style-bullet text:level=\"2\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â—¦\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-bullet>\n" \
+                   "   <text:list-level-style-bullet text:level=\"3\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"â–ª\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-bullet>\n" \
+                   "   <text:list-level-style-number text:level=\"4\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"5\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"6\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"7\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"8\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"9\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"10\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "</text:list-style>\n" \
+                   "<text:list-style style:name=\"L2\">\n" \
+                   "   <text:list-level-style-number text:level=\"1\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"2\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"3\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"4\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"5\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"6\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"7\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"8\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"9\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "   <text:list-level-style-number text:level=\"10\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
+                   "           <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
+                   "                   <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
+                   "           </style:list-level-properties>\n" \
+                   "   </text:list-level-style-number>\n" \
+                   "</text:list-style>\n" \
+                   "</office:automatic-styles>\n" \
+                   " <office:master-styles>\n" \
+                   "  <style:master-page style:name=\"Endnote\" >\n" \
+                   "    <style:header><text:h text:outline-level=\"2\">Bibliography</text:h></style:header></style:master-page>\n" \
+                   "  <style:master-page style:name=\"Footnote\" style:page-layout-name=\"pm2\"/>\n" \
+                   " </office:master-styles>\n");
 
        char * result = out->str;
        d_string_free(out, false);
@@ -508,41 +508,41 @@ char * opendocument_style_file(int format) {
        d_string_append(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
 
        print_const("<office:document-styles xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n" \
-"xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
-"xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
-"xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
-"xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
-"xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
-"xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
-"xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
-"xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
-"xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
-"xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
-"xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
-"xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
-"xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
-"xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
-"xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
-"xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
-"xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
-"xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
-"xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
-"xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
-"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
-"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
-"xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
-"xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
-"xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
-"xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
-"xmlns:officeooo=\"http://openoffice.org/2009/office\"\n" \
-"xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
-"xmlns:drawooo=\"http://openoffice.org/2010/draw\"\n" \
-"xmlns:calcext=\"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0\"\n" \
-"xmlns:loext=\"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0\"\n" \
-"xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
-"xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
-"xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
-"office:version=\"1.2\">\n");
+                   "xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
+                   "xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
+                   "xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
+                   "xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
+                   "xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
+                   "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
+                   "xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
+                   "xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
+                   "xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
+                   "xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
+                   "xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
+                   "xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
+                   "xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
+                   "xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
+                   "xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
+                   "xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
+                   "xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
+                   "xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
+                   "xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
+                   "xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
+                   "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
+                   "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
+                   "xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
+                   "xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
+                   "xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
+                   "xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
+                   "xmlns:officeooo=\"http://openoffice.org/2009/office\"\n" \
+                   "xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
+                   "xmlns:drawooo=\"http://openoffice.org/2010/draw\"\n" \
+                   "xmlns:calcext=\"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0\"\n" \
+                   "xmlns:loext=\"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0\"\n" \
+                   "xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
+                   "xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
+                   "xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
+                   "office:version=\"1.2\">\n");
 
        // Styles
        d_string_append(out, style);
@@ -596,17 +596,17 @@ static size_t write_memory(void * contents, size_t size, size_t nmemb, void * us
 static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * directory) {
        asset * a, * a_tmp;
 
-       if (e->asset_hash){
+       if (e->asset_hash) {
                CURL * curl;
                CURLcode res;
-               
+
                struct MemoryStruct chunk;
                chunk.memory = malloc(1);
                chunk.size = 0;
 
                char destination[100] = "Pictures/";
                destination[45] = '\0';
-               
+
                mz_bool status;
 
                curl_global_init(CURL_GLOBAL_ALL);
@@ -644,11 +644,11 @@ static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * direc
 static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * directory) {
        asset * a, * a_tmp;
 
-       if (e->asset_hash){
+       if (e->asset_hash) {
 
                char destination[100] = "Pictures/";
                destination[45] = '\0';
-               
+
                mz_bool status;
 
                HASH_ITER(hh, e->asset_hash, a, a_tmp) {
@@ -800,41 +800,41 @@ mz_zip_archive * opendocument_core_zip(mmd_engine * e, int format) {
 /// Add shared office:document config
 void opendocument_document_attr(DString * out) {
        print_const("xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n" \
-       "xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
-       "xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
-       "xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
-       "xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
-       "xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
-       "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
-       "xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
-       "xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
-       "xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
-       "xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
-       "xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
-       "xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
-       "xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
-       "xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
-       "xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
-       "xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
-       "xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
-       "xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
-       "xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
-       "xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
-       "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
-       "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
-       "xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
-       "xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
-       "xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
-       "xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
-       "xmlns:officeooo=\"http://openoffice.org/2009/office\"\n" \
-       "xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
-       "xmlns:drawooo=\"http://openoffice.org/2010/draw\"\n" \
-       "xmlns:calcext=\"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0\"\n" \
-       "xmlns:loext=\"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0\"\n" \
-       "xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
-       "xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
-       "xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
-       "office:version=\"1.2\"");
+                   "xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
+                   "xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
+                   "xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
+                   "xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
+                   "xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
+                   "xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
+                   "xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
+                   "xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
+                   "xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
+                   "xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
+                   "xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
+                   "xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
+                   "xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
+                   "xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
+                   "xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
+                   "xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
+                   "xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
+                   "xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
+                   "xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
+                   "xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
+                   "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
+                   "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
+                   "xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
+                   "xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
+                   "xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
+                   "xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
+                   "xmlns:officeooo=\"http://openoffice.org/2009/office\"\n" \
+                   "xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
+                   "xmlns:drawooo=\"http://openoffice.org/2010/draw\"\n" \
+                   "xmlns:calcext=\"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0\"\n" \
+                   "xmlns:loext=\"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0\"\n" \
+                   "xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
+                   "xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
+                   "xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
+                   "office:version=\"1.2\"");
 }
 
 
index 07a870105167d48a6d12ca1f764486022ba8f2f3..1a239dab4dec46c6b877b1f84551812757314502 100644 (file)
@@ -29,15 +29,15 @@ long ran_x[KK];                    /* the generator state */
 void ran_array(long aa[],int n)
 #else
 void ran_array(aa,n)    /* put n new random numbers in aa */
-  long *aa;   /* destination */
-  int n;      /* array length (must be at least KK) */
+long *aa;   /* destination */
+int n;      /* array length (must be at least KK) */
 #endif
 {
-  register int i,j;
-  for (j=0;j<KK;j++) aa[j]=ran_x[j];
-  for (;j<n;j++) aa[j]=mod_diff(aa[j-KK],aa[j-LL]);
-  for (i=0;i<LL;i++,j++) ran_x[i]=mod_diff(aa[j-KK],aa[j-LL]);
-  for (;i<KK;i++,j++) ran_x[i]=mod_diff(aa[j-KK],ran_x[i-LL]);
+       register int i,j;
+       for (j=0; j<KK; j++) aa[j]=ran_x[j];
+       for (; j<n; j++) aa[j]=mod_diff(aa[j-KK],aa[j-LL]);
+       for (i=0; i<LL; i++,j++) ran_x[i]=mod_diff(aa[j-KK],aa[j-LL]);
+       for (; i<KK; i++,j++) ran_x[i]=mod_diff(aa[j-KK],ran_x[i-LL]);
 }
 
 /* the following routines are from exercise 3.6--15 */
@@ -55,51 +55,52 @@ long *ran_arr_ptr=&ran_arr_dummy; /* the next random number, or -1 */
 void ran_start(long seed)
 #else
 void ran_start(seed)    /* do this before using ran_array */
-  long seed;            /* selector for different streams */
+long seed;            /* selector for different streams */
 #endif
 {
-  register int t,j;
-  long x[KK+KK-1];              /* the preparation buffer */
-  register long ss=(seed+2)&(MM-2);
-  for (j=0;j<KK;j++) {
-    x[j]=ss;                      /* bootstrap the buffer */
-    ss<<=1; if (ss>=MM) ss-=MM-2; /* cyclic shift 29 bits */
-  }
-  x[1]++;              /* make x[1] (and only x[1]) odd */
-  for (ss=seed&(MM-1),t=TT-1; t; ) {       
-    for (j=KK-1;j>0;j--) x[j+j]=x[j], x[j+j-1]=0; /* "square" */
-    for (j=KK+KK-2;j>=KK;j--)
-      x[j-(KK-LL)]=mod_diff(x[j-(KK-LL)],x[j]),
-      x[j-KK]=mod_diff(x[j-KK],x[j]);
-    if (is_odd(ss)) {              /* "multiply by z" */
-      for (j=KK;j>0;j--)  x[j]=x[j-1];
-      x[0]=x[KK];            /* shift the buffer cyclically */
-      x[LL]=mod_diff(x[LL],x[KK]);
-    }
-    if (ss) ss>>=1; else t--;
-  }
-  for (j=0;j<LL;j++) ran_x[j+KK-LL]=x[j];
-  for (;j<KK;j++) ran_x[j-LL]=x[j];
-  for (j=0;j<10;j++) ran_array(x,KK+KK-1); /* warm things up */
-  ran_arr_ptr=&ran_arr_started;
+       register int t,j;
+       long x[KK+KK-1];              /* the preparation buffer */
+       register long ss=(seed+2)&(MM-2);
+       for (j=0; j<KK; j++) {
+               x[j]=ss;                      /* bootstrap the buffer */
+               ss<<=1;
+               if (ss>=MM) ss-=MM-2; /* cyclic shift 29 bits */
+       }
+       x[1]++;              /* make x[1] (and only x[1]) odd */
+       for (ss=seed&(MM-1),t=TT-1; t; ) {
+               for (j=KK-1; j>0; j--) x[j+j]=x[j], x[j+j-1]=0; /* "square" */
+               for (j=KK+KK-2; j>=KK; j--)
+                       x[j-(KK-LL)]=mod_diff(x[j-(KK-LL)],x[j]),
+                                    x[j-KK]=mod_diff(x[j-KK],x[j]);
+               if (is_odd(ss)) {              /* "multiply by z" */
+                       for (j=KK; j>0; j--)  x[j]=x[j-1];
+                       x[0]=x[KK];            /* shift the buffer cyclically */
+                       x[LL]=mod_diff(x[LL],x[KK]);
+               }
+               if (ss) ss>>=1;
+               else t--;
+       }
+       for (j=0; j<LL; j++) ran_x[j+KK-LL]=x[j];
+       for (; j<KK; j++) ran_x[j-LL]=x[j];
+       for (j=0; j<10; j++) ran_array(x,KK+KK-1); /* warm things up */
+       ran_arr_ptr=&ran_arr_started;
 }
 
 #define ran_arr_next() (*ran_arr_ptr>=0? *ran_arr_ptr++: ran_arr_cycle())
-long ran_arr_cycle()
-{
-  if (ran_arr_ptr==&ran_arr_dummy)
-    ran_start(314159L); /* the user forgot to initialize */
-  ran_array(ran_arr_buf,QUALITY);
-  ran_arr_buf[KK]=-1;
-  ran_arr_ptr=ran_arr_buf+1;
-  return ran_arr_buf[0];
+long ran_arr_cycle() {
+       if (ran_arr_ptr==&ran_arr_dummy)
+               ran_start(314159L); /* the user forgot to initialize */
+       ran_array(ran_arr_buf,QUALITY);
+       ran_arr_buf[KK]=-1;
+       ran_arr_ptr=ran_arr_buf+1;
+       return ran_arr_buf[0];
 }
 
 /* Tweaked to include as a library - Fletcher T. Penney */
 /*#include <stdio.h>
 int main()
 {
-  register int m; long a[2009]; 
+  register int m; long a[2009];
   ran_start(310952L);
   for (m=0;m<=2009;m++) ran_array(a,1009);
   printf("%ld\n", a[0]);             *//* 995235265 */
@@ -110,8 +111,7 @@ int main()
   return 0;
 } */
 
-long ran_num_next()
-{
+long ran_num_next() {
        return ran_arr_next();
 }
 
index 5b1864f3537f807cde1c3b4d60d603220e692516..007905a0417fb404e56067e3f069c5f9ce024a61 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -64,7 +64,7 @@
 /// initial capacity (0 to use default capacity)
 stack * stack_new(int startingSize) {
        stack * s = malloc(sizeof(stack));
-       
+
        if (s) {
                if (startingSize <= 0)
                        startingSize = kStackStartingSize;
index b401bc90b17fc3fc4dd2629b071044bd2659ba90..bdd1d78f312019b7b7ea3d48c046c397f3ad3f78 100644 (file)
@@ -4,11 +4,11 @@
 
        @file textbundle.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.
-       
+
 
 */
 
@@ -135,7 +135,7 @@ char * textbundle_info_json(void) {
 static bool add_asset_from_file(mz_zip_archive * pZip, asset * a, const char * destination, const char * directory) {
        if (!directory)
                return false;
-       
+
        char * path = path_from_dir_base(directory, a->url);
        mz_bool status;
        bool result = false;
@@ -191,17 +191,17 @@ static size_t write_memory(void * contents, size_t size, size_t nmemb, void * us
 static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * directory) {
        asset * a, * a_tmp;
 
-       if (e->asset_hash){
+       if (e->asset_hash) {
                CURL * curl;
                CURLcode res;
-               
+
                struct MemoryStruct chunk;
                chunk.memory = malloc(1);
                chunk.size = 0;
 
                char destination[100] = "assets/";
                destination[43] = '\0';
-               
+
                mz_bool status;
 
                curl_global_init(CURL_GLOBAL_ALL);
@@ -239,11 +239,11 @@ static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * direc
 static void add_assets(mz_zip_archive * pZip, mmd_engine * e, const char * directory) {
        asset * a, * a_tmp;
 
-       if (e->asset_hash){
+       if (e->asset_hash) {
 
                char destination[100] = "assets/";
                destination[43] = '\0';
-               
+
                mz_bool status;
 
                HASH_ITER(hh, e->asset_hash, a, a_tmp) {
@@ -331,8 +331,7 @@ void sub_asset_paths(DString * text, mmd_engine * e) {
                if (e->metadata_stack->size > 0) {
                        meta * m;
 
-                       for (int i = 0; i < e->metadata_stack->size; ++i)
-                       {
+                       for (int i = 0; i < e->metadata_stack->size; ++i) {
                                m = stack_peek_index(e->metadata_stack, i);
                                if (strcmp("css", m->key) == 0) {
                                        // Get METADATA range
index 77582ba64bdbb29deae7da1c78687a3b8e64c381..de6aa619be51c358425a680aed82d25188863b4d 100644 (file)
@@ -10,7 +10,7 @@
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -163,7 +163,7 @@ token * token_new_parent(token * child, unsigned short type) {
        if (child == NULL) {
                return token_new(type, 0, 0);
        }
-       
+
        token * t = token_new(type, child->start, 0);
        t->child = child;
        child->prev = NULL;
@@ -188,7 +188,7 @@ token * token_new_parent(token * child, unsigned short type) {
 /// may or may not also be the start of a chain
 void token_chain_append(token * chain_start, token * t) {
        if ((chain_start == NULL) ||
-               (t == NULL))
+               (t == NULL))
                return;
 
        // Append t
@@ -303,13 +303,13 @@ void tokens_prune(token * first, token * last) {
 
        if (prev != NULL)
                prev->next = next;
-       
+
        if (next != NULL)
                next->prev = prev;
 
-    first->prev = NULL;
-    last->next = NULL;
-    
+       first->prev = NULL;
+       last->next = NULL;
+
        token_tree_free(first);
 }
 
@@ -321,7 +321,7 @@ token * token_prune_graft(token * first, token * last, unsigned short container_
                return first;
 
        token * next = last->next;
-       
+
        // Duplicate first token -- this will be child of new container
        token * new_child = token_copy(first);
        new_child->prev = NULL;
@@ -365,7 +365,7 @@ void token_free(token * t) {
 #else
        if (t == NULL)
                return;
-       
+
        token_tree_free(t->child);
 
        free(t);
@@ -397,8 +397,7 @@ void print_token_tree(token * t, unsigned short depth, const char * string);
 /// Print contents of the token based on specified string
 void print_token(token * t, unsigned short depth, const char * string) {
        if (t != NULL) {
-               for (int i = 0; i < depth; ++i)
-               {
+               for (int i = 0; i < depth; ++i) {
                        fprintf(stderr, "\t");
                }
                if (string == NULL) {
@@ -444,14 +443,14 @@ void token_tree_describe(token * t, const char * string) {
 /// Find the child node of a given parent that contains the specified
 /// offset position.
 token * token_child_for_offset(
-       token * parent,                                         //!< Pointer to parent token
-       size_t offset                                           //!< Search position
+    token * parent,                                            //!< Pointer to parent token
+    size_t offset                                              //!< Search position
 ) {
        if (parent == NULL)
                return NULL;
 
        if ((parent->start > offset) ||
-               (parent->start + parent->len < offset))
+               (parent->start + parent->len < offset))
                return NULL;
 
        token * walker = parent->child;
@@ -464,7 +463,7 @@ token * token_child_for_offset(
                }
                if (walker->start > offset)
                        return NULL;
-               
+
                walker = walker->next;
        }
 
@@ -480,15 +479,15 @@ static bool ranges_intersect(size_t start1, size_t len1, size_t start2, size_t l
 /// Find first child node of a given parent that intersects the specified
 /// offset range.
 token * token_first_child_in_range(
-       token * parent,                                         //!< Pointer to parent token
-       size_t start,                                           //!< Start search position
-       size_t len                                                      //!< Search length
+    token * parent,                                            //!< Pointer to parent token
+    size_t start,                                              //!< Start search position
+    size_t len                                                 //!< Search length
 ) {
        if (parent == NULL)
                return NULL;
 
        if ((parent->start > start + len) ||
-               (parent->start + parent->len < start))
+               (parent->start + parent->len < start))
                return NULL;
 
        token * walker = parent->child;
@@ -510,15 +509,15 @@ token * token_first_child_in_range(
 /// Find last child node of a given parent that intersects the specified
 /// offset range.
 token * token_last_child_in_range(
-       token * parent,                                         //!< Pointer to parent token
-       size_t start,                                           //!< Start search position
-       size_t len                                                      //!< Search length
+    token * parent,                                            //!< Pointer to parent token
+    size_t start,                                              //!< Start search position
+    size_t len                                                 //!< Search length
 ) {
        if (parent == NULL)
                return NULL;
 
        if ((parent->start > start + len) ||
-               (parent->start + parent->len < start))
+               (parent->start + parent->len < start))
                return NULL;
 
        token * walker = parent->child;
@@ -580,8 +579,7 @@ token * token_chain_accept_multiple(token ** t, int n, ...) {
 
        va_start(valist, n);
 
-       for (int i = 0; i < n; ++i)
-       {
+       for (int i = 0; i < n; ++i) {
                result = token_chain_accept(t, va_arg(valist, int));
                if (result)
                        break;
@@ -607,15 +605,13 @@ void token_skip_until_type_multiple(token ** t, int n, ...) {
        va_start(valist, n);
 
        // Load target types
-       for (int i = 0; i < n; ++i)
-       {
+       for (int i = 0; i < n; ++i) {
                type[i] = va_arg(valist, int);
        }
 
-       // 
+       //
        while (*t) {
-               for (int i = 0; i < n; ++i)
-               {
+               for (int i = 0; i < n; ++i) {
                        if ((*t)->type == type[i])
                                return;
                }
@@ -637,13 +633,13 @@ void token_split_on_char(token * t, const char * source, const char c) {
        token * new = NULL;
 
        while (pos + 1 < stop) {
-               if (source[start + pos] == c){
+               if (source[start + pos] == c) {
                        new = token_new(t->type, start + pos + 1, stop - (pos + 1));
                        new->next = t->next;
                        t->next = new;
-                       
+
                        t->len = pos;
-                       
+
                        t = t->next;
                }
 
@@ -686,7 +682,7 @@ void token_split(token * t, size_t start, size_t len, unsigned short new_type) {
                        // Create T2
                        token * T2 = token_new(t->type, stop, t->start + t->len - stop);
                        T2->next = t->next;
-       
+
                        if (t->next)
                                t->next->prev = T2;
 
index 7b932516eb4c2b78c5fc0cffd60ffe483019663b..e19622afc6f96a2b491962314a8b04cd0f10d1da 100644 (file)
 
 
        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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -96,7 +96,7 @@ void token_pair_engine_free(token_pair_engine * e) {
 
 /// Add a new pairing configuration to a token pair engine
 void token_pair_engine_add_pairing(token_pair_engine * e, unsigned short open_type, unsigned short close_type,
-       unsigned short pair_type, int options) {
+                                   unsigned short pair_type, int options) {
        // \todo: This needs to be more sophisticated
        e->can_open_pair[open_type] = 1;
        e->can_close_pair[close_type] = 1;
@@ -159,8 +159,7 @@ void token_pairs_match_pairs_inside_token(token * parent, token_pair_engine * e,
                        // Do we even have a valid opener in the stack?
                        // It's only worth checking if the stack is beyond a certain size
                        if (i > start_counter + kLargeStackThreshold) {
-                               for (int j = 0; j < kMaxTokenTypes; ++j)
-                               {
+                               for (int j = 0; j < kMaxTokenTypes; ++j) {
                                        if (opener_count[j]) {
                                                if (e->pair_type[j][walker->type])
                                                        goto close;
@@ -171,7 +170,7 @@ void token_pairs_match_pairs_inside_token(token * parent, token_pair_engine * e,
                                goto open;
                        }
 
-                       close:
+close:
                        // Find matching opener for this closer
                        while (i > start_counter) {
                                peek = stack_peek_index(s, i - 1);
@@ -182,7 +181,7 @@ void token_pairs_match_pairs_inside_token(token * parent, token_pair_engine * e,
                                        if (!e->empty_allowed[pair_type]) {
                                                // Make sure they aren't consecutive tokens
                                                if ((peek->next == walker) &&
-                                                       (peek->start + peek->len == walker->start)) {
+                                                       (peek->start + peek->len == walker->start)) {
                                                        // i--;
                                                        i = start_counter;      // In this situation, we can't use this token as a closer
                                                        continue;
@@ -230,13 +229,13 @@ void token_pairs_match_pairs_inside_token(token * parent, token_pair_engine * e,
                        }
                }
 
-               open:
+open:
                // Is this an opener?
                if (walker->can_open && e->can_open_pair[walker->type] && walker->unmatched) {
                        stack_push(s, walker);
                        opener_count[walker->type]++;
 #ifndef NDEBUG
-               fprintf(stderr, "push token type %d to stack (%lu elements)\n", walker->type, s->size);
+                       fprintf(stderr, "push token type %d to stack (%lu elements)\n", walker->type, s->size);
 #endif
                }
 
index 0b733eebf3877b064e1eb66da428973492307672..d6e24df4ed30d96f4d59dc8c65fc116187b22fc3 100644 (file)
@@ -4,11 +4,11 @@
 
        @file transclude.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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -73,8 +73,7 @@ static char * my_strndup(const char * source, size_t n) {
        const char * test = source;
 
        // strlen is too slow if strlen(source) >> n
-       for (len = 0; len < n; ++len)
-       {
+       for (len = 0; len < n; ++len) {
                if (test == '\0')
                        break;
 
@@ -87,7 +86,7 @@ static char * my_strndup(const char * source, size_t n) {
                memcpy(result, source, len);
                result[len] = '\0';
        }
-       
+
        return result;
 }
 
@@ -118,7 +117,7 @@ bool is_separator(char c) {
 #ifdef TEST
 void Test_is_separator(CuTest* tc) {
        char * test = "a/\\";
-       
+
 #if defined(__WIN32)
        CuAssertIntEquals(tc, false, is_separator(test[0]));
        CuAssertIntEquals(tc, true, is_separator(test[1]));
@@ -208,7 +207,7 @@ void Test_path_from_dir_base(CuTest* tc) {
 ///
 /// See http://stackoverflow.com/questions/1575278/function-to-split-a-filepath-into-path-and-file
 void split_path_file(char ** dir, char ** file, const char * path) {
-    const char * slash = path, * next;
+       const char * slash = path, * next;
 
 #if defined(__WIN32)
        const char sep[] = "\\/";       // Windows allows either variant
@@ -216,14 +215,14 @@ void split_path_file(char ** dir, char ** file, const char * path) {
        const char sep[] = "/";
 #endif
 
-    while ((next = strpbrk(slash + 1, sep)))
-       slash = next;
-    
-    if (path != slash)
-       slash++;
+       while ((next = strpbrk(slash + 1, sep)))
+               slash = next;
 
-    *dir = my_strndup(path, slash - path);
-    *file = my_strdup(slash);
+       if (path != slash)
+               slash++;
+
+       *dir = my_strndup(path, slash - path);
+       *file = my_strdup(slash);
 }
 
 #ifdef TEST
@@ -405,8 +404,7 @@ void mmd_transclude_source(DString * source, const char * search_path, const cha
                        }
 
                        // Prevent infinite recursive loops
-                       for (int i = 0; i < stack_depth; ++i)
-                       {
+                       for (int i = 0; i < stack_depth; ++i) {
                                temp = stack_peek_index(parse_stack, i);
                                if (strcmp(file_path->str, temp) == 0) {
                                        // We have parsed this file already, don't recurse infinitely
@@ -422,8 +420,7 @@ void mmd_transclude_source(DString * source, const char * search_path, const cha
                        if (manifest) {
                                bool add = true;
 
-                               for (int i = 0; i < manifest->size; ++i)
-                               {
+                               for (int i = 0; i < manifest->size; ++i) {
                                        temp = stack_peek_index(manifest, i);
                                        if (strcmp(file_path->str, temp) == 0) {
                                                // Already on manifest, don't duplicate
@@ -446,16 +443,16 @@ void mmd_transclude_source(DString * source, const char * search_path, const cha
 
                                // Recursively check this file for transclusions
                                mmd_transclude_source(buffer, search_folder, file_path->str, format, parse_stack, manifest);
-                               
+
                                // Strip metadata from buffer now that we have parsed it
                                e = mmd_engine_create_with_dstring(buffer, EXT_TRANSCLUDE);
-                               
+
                                if (mmd_engine_has_metadata(e, &offset)) {
                                        d_string_erase(buffer, 0, offset);
                                } else {
                                        // Do we need to strip BOM?
                                        if (strncmp(buffer->str, "\xef\xbb\xbf",3) == 0)
-                                       d_string_erase(buffer, 0, 3);
+                                               d_string_erase(buffer, 0, 3);
                                }
 
                                mmd_engine_free(e, false);
@@ -476,7 +473,7 @@ void mmd_transclude_source(DString * source, const char * search_path, const cha
                        // Remove this file from stack
                        stack_pop(parse_stack);
 
-                       finish_file:
+finish_file:
                        d_string_free(file_path, true);
 
                } else {
@@ -488,7 +485,7 @@ void mmd_transclude_source(DString * source, const char * search_path, const cha
                start = strstr(source->str + last_match, "{{");
        }
 
-       exit:
+exit:
 
        if (parsed == NULL) {
                // Free temp stack
index 5f7aa72baaedae1fb4a86d284e4b8e2f6e8f379c..5426f2b488c4ba92940028c6049a9a2586fec169 100644 (file)
@@ -4,11 +4,11 @@
 
        @file uuid.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 BSD Revised 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
-       
-       
+
+
        ## 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.
@@ -61,7 +61,7 @@
        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.
-       
+
 
 */
 
@@ -83,8 +83,7 @@ char * uuid_new(void) {
        unsigned char raw[16];
 
        // Get 128 bits of random goodness
-       for (int i = 0; i < 16; ++i)
-       {
+       for (int i = 0; i < 16; ++i) {
                raw[i] = rand() % 256;
        }
 
@@ -103,8 +102,8 @@ char * uuid_string_from_bits(unsigned char * raw) {
        char * result = malloc(37);
 
        sprintf(result, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-               raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6], raw[7],
-               raw[8], raw[9], raw[10], raw[11], raw[12], raw[13], raw[14], raw[15] );
+               raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6], raw[7],
+               raw[8], raw[9], raw[10], raw[11], raw[12], raw[13], raw[14], raw[15] );
 
        return result;
 }
@@ -113,18 +112,35 @@ char * uuid_string_from_bits(unsigned char * raw) {
 
 // http://stackoverflow.com/questions/322938/recommended-way-to-initialize-srand
 // http://www.concentric.net/~Ttwang/tech/inthash.htm
-unsigned long mix(unsigned long a, unsigned long b, unsigned long c)
-{
-    a=a-b;  a=a-c;  a=a^(c >> 13);
-    b=b-c;  b=b-a;  b=b^(a << 8);
-    c=c-a;  c=c-b;  c=c^(b >> 13);
-    a=a-b;  a=a-c;  a=a^(c >> 12);
-    b=b-c;  b=b-a;  b=b^(a << 16);
-    c=c-a;  c=c-b;  c=c^(b >> 5);
-    a=a-b;  a=a-c;  a=a^(c >> 3);
-    b=b-c;  b=b-a;  b=b^(a << 10);
-    c=c-a;  c=c-b;  c=c^(b >> 15);
-    return c;
+unsigned long mix(unsigned long a, unsigned long b, unsigned long c) {
+       a=a-b;
+       a=a-c;
+       a=a^(c >> 13);
+       b=b-c;
+       b=b-a;
+       b=b^(a << 8);
+       c=c-a;
+       c=c-b;
+       c=c^(b >> 13);
+       a=a-b;
+       a=a-c;
+       a=a^(c >> 12);
+       b=b-c;
+       b=b-a;
+       b=b^(a << 16);
+       c=c-a;
+       c=c-b;
+       c=c^(b >> 5);
+       a=a-b;
+       a=a-c;
+       a=a^(c >> 3);
+       b=b-c;
+       b=b-a;
+       b=b^(a << 10);
+       c=c-a;
+       c=c-b;
+       c=c^(b >> 15);
+       return c;
 }
 
 
index 87ce1973148bc8627e0f549e77ed9e7807c96a8c..80b6263ee0383a353076c71a86c77c051722be7e 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -96,8 +96,7 @@ static char * my_strndup(const char * source, size_t n) {
        const char * test = source;
 
        // strlen is too slow is strlen(source) >> n
-       for (len = 0; len < n; ++len)
-       {
+       for (len = 0; len < n; ++len) {
                if (test == '\0')
                        break;
 
@@ -110,7 +109,7 @@ static char * my_strndup(const char * source, size_t n) {
                memcpy(result, source, len);
                result[len] = '\0';
        }
-       
+
        return result;
 }
 
@@ -162,8 +161,7 @@ scratch_pad * scratch_pad_new(mmd_engine * e, short format) {
                p->link_hash = NULL;
                link * l;
 
-               for (int i = 0; i < e->link_stack->size; ++i)
-               {
+               for (int i = 0; i < e->link_stack->size; ++i) {
                        l = stack_peek_index(e->link_stack, i);
 
                        store_link(p, l);
@@ -179,8 +177,7 @@ scratch_pad * scratch_pad_new(mmd_engine * e, short format) {
 
                p->citation_hash = NULL;
 
-               for (int i = 0; i < e->citation_stack->size; ++i)
-               {
+               for (int i = 0; i < e->citation_stack->size; ++i) {
                        f = stack_peek_index(e->citation_stack, i);
 
                        store_citation(p, f);
@@ -194,8 +191,7 @@ scratch_pad * scratch_pad_new(mmd_engine * e, short format) {
 
                p->footnote_hash = NULL;                                // Store defined footnotes in a hash
 
-               for (int i = 0; i < e->footnote_stack->size; ++i)
-               {
+               for (int i = 0; i < e->footnote_stack->size; ++i) {
                        f = stack_peek_index(e->footnote_stack, i);
 
                        store_footnote(p, f);
@@ -208,8 +204,7 @@ scratch_pad * scratch_pad_new(mmd_engine * e, short format) {
 
                p->glossary_hash = NULL;
 
-               for (int i = 0; i < e->glossary_stack->size; ++i)
-               {
+               for (int i = 0; i < e->glossary_stack->size; ++i) {
                        f = stack_peek_index(e->glossary_stack, i);
 
                        store_glossary(p, f);
@@ -221,8 +216,7 @@ scratch_pad * scratch_pad_new(mmd_engine * e, short format) {
 
                p->abbreviation_hash = NULL;
 
-               for (int i = 0; i < e->abbreviation_stack->size; ++i)
-               {
+               for (int i = 0; i < e->abbreviation_stack->size; ++i) {
                        f = stack_peek_index(e->abbreviation_stack, i);
 
                        store_abbreviation(p, f);
@@ -232,15 +226,14 @@ scratch_pad * scratch_pad_new(mmd_engine * e, short format) {
                p->meta_hash = NULL;
                meta * m;
 
-               for (int i = 0; i < e->metadata_stack->size; ++i)
-               {
+               for (int i = 0; i < e->metadata_stack->size; ++i) {
                        m = stack_peek_index(e->metadata_stack, i);
 
                        store_metadata(p, m);
                }
 
 
-               // Store used assets in a hash 
+               // Store used assets in a hash
                p->asset_hash = NULL;
                p->store_assets = 0;
        }
@@ -255,12 +248,12 @@ void scratch_pad_free(scratch_pad * scratch) {
        stack_free(scratch->outline_stack);
 
        link * l, * l_tmp;
-       
+
        // Free link hash
        HASH_ITER(hh, scratch->link_hash, l, l_tmp) {
                HASH_DEL(scratch->link_hash, l);        // Remove item from hash
                free(l);                // "Shallow" free -- the pointers will be freed
-                                               // with the original later.
+               // with the original later.
        }
 
        fn_holder * f, * f_tmp;
@@ -321,7 +314,7 @@ void scratch_pad_free(scratch_pad * scratch) {
 
        // Free metadata hash
        meta * m, * m_tmp;
-       
+
        HASH_ITER(hh, scratch->meta_hash, m, m_tmp) {
                HASH_DEL(scratch->meta_hash, m);        // Remove item from hash
                // Don't free meta pointer since it is freed with the mmd_engine
@@ -408,9 +401,8 @@ char * label_from_string(const char * str) {
                                next_char++;
                        }
                } else if ((*str >= '0' && *str <= '9') || (*str >= 'A' && *str <= 'Z')
-                       || (*str >= 'a' && *str <= 'z') || (*str == '.') || (*str== '_')
-                       || (*str== '-') || (*str== ':'))
-               {
+                          || (*str >= 'a' && *str <= 'z') || (*str == '.') || (*str== '_')
+                          || (*str== '-') || (*str== ':')) {
                        // Allow 0-9, A-Z, a-z, ., _, -, :
                        d_string_append_c(out, tolower(*str));
                }
@@ -457,7 +449,7 @@ char * label_from_header(const char * source, token * t) {
 char * clean_string(const char * str, bool lowercase) {
        if (str == NULL)
                return NULL;
-       
+
        DString * out = d_string_new("");
        char * clean = NULL;
        bool block_whitespace = true;
@@ -570,7 +562,7 @@ attr * parse_attributes(char * source) {
                // Get key
                scan_len = scan_key(&source[pos]);
                key = my_strndup(&source[pos], scan_len);
-               
+
                // Skip '='
                pos += scan_len + 1;
 
@@ -631,7 +623,7 @@ link * link_shallow_copy(link * l) {
                new->title = l->title;
                new->attributes = l->attributes;
        }
-       
+
        return new;
 }
 
@@ -646,7 +638,7 @@ void store_link(scratch_pad * scratch, link * l) {
        // Add link via `clean_text`?
        if (l->clean_text && l->clean_text[0] != '\0') {
                HASH_FIND_STR(scratch->link_hash, l->clean_text, temp_link);
-               
+
                if (!temp_link) {
                        // Only add if another link is not found with clean_text
                        temp_link = link_shallow_copy(l);
@@ -865,7 +857,7 @@ char * destination_accept(const char * source, token ** remainder, bool validate
 
        if (*remainder == NULL)
                return url;
-       
+
        switch ((*remainder)->type) {
                case PAIR_PAREN:
                case PAIR_ANGLE:
@@ -874,9 +866,9 @@ char * destination_accept(const char * source, token ** remainder, bool validate
                        t = token_chain_accept_multiple(remainder, 2, PAIR_ANGLE, PAIR_PAREN);
                        url = text_inside_pair(source, t);
                        break;
-        default:
-            start = (*remainder)->start;
-                       
+               default:
+                       start = (*remainder)->start;
+
                        // Skip any whitespace
                        while (char_is_whitespace(source[start]))
                                start++;
@@ -888,7 +880,7 @@ char * destination_accept(const char * source, token ** remainder, bool validate
 
                        // Advance remainder to end of destination
                        while ((*remainder)->next &&
-                                  (*remainder)->next->start < start + scan_len) {
+                               (*remainder)->next->start < start + scan_len) {
                                *remainder = (*remainder)->next;
                        }
 
@@ -912,7 +904,7 @@ char * destination_accept(const char * source, token ** remainder, bool validate
 
        // Is this a valid URL?
        clean = clean_string(url, false);
-       
+
        if (validate && !validate_url(clean)) {
                free(clean);
                clean = NULL;
@@ -939,7 +931,7 @@ char * url_accept(const char * source, size_t start, size_t max_len, size_t * en
 
                // Is this <foo>?
                if ((source[start] == '<') &&
-                       (source[start + scan_len - 1] == '>')) {
+                       (source[start + scan_len - 1] == '>')) {
                        // Strip '<' and '>'
                        start++;
                        scan_len -= 2;
@@ -963,10 +955,10 @@ char * url_accept(const char * source, size_t start, size_t max_len, size_t * en
 
 /// Extract url string from `(foo)` or `(<foo>)` or `(foo "bar")`
 void extract_from_paren(token * paren, const char * source, char ** url, char ** title, char ** attributes) {
-   size_t scan_len;
-    size_t pos = paren->child->next->start;
-    
-    
+       size_t scan_len;
+       size_t pos = paren->child->next->start;
+
+
        size_t attr_len;
 
        // Skip whitespace
@@ -994,7 +986,7 @@ void extract_from_paren(token * paren, const char * source, char ** url, char **
 
        // Grab attributes, if present
        attr_len = scan_attributes(&source[pos]);
-       
+
        if (attr_len) {
                *attributes = my_strndup(&source[pos], attr_len);
        }
@@ -1014,7 +1006,7 @@ link * explicit_link(scratch_pad * scratch, token * bracket, token * paren, cons
                if (!(scratch->extensions & EXT_COMPATIBILITY))
                        l = link_new(source, NULL, url_char, title_char, attr_char);
        } else {
-               l = link_new(source, NULL, url_char, title_char, attr_char);            
+               l = link_new(source, NULL, url_char, title_char, attr_char);
        }
 
        free(url_char);
@@ -1167,12 +1159,12 @@ bool definition_extract(mmd_engine * e, token ** remainder) {
 
        link * l = NULL;
        footnote * f = NULL;
-       
+
        // Store label
        label = *remainder;
 
        *remainder = (*remainder)->next;
-       
+
        // Prepare for parsing
 
        // Account for settings
@@ -1202,7 +1194,7 @@ bool definition_extract(mmd_engine * e, token ** remainder) {
                                                stack_push(e->glossary_stack, f);
                                                break;
                                }
-                               
+
                                break;
                        }
                case PAIR_BRACKET:
@@ -1242,7 +1234,7 @@ bool definition_extract(mmd_engine * e, token ** remainder) {
                        if ((*remainder) && (((*remainder)->type != TEXT_NL) && ((*remainder)->type != TEXT_LINEBREAK))) {
                                if (!(e->extensions & EXT_COMPATIBILITY)) {
                                        attr_len = scan_attributes(&source[(*remainder)->start]);
-                                       
+
                                        if (attr_len) {
                                                attr_char = my_strndup(&source[(*remainder)->start], attr_len);
 
@@ -1252,7 +1244,7 @@ bool definition_extract(mmd_engine * e, token ** remainder) {
                                                while ((*remainder) && (*remainder)->start < attr_len)
                                                        *remainder = (*remainder)->next;
                                        }
-                                       
+
                                        l = link_new(e->dstr->str, label, url_char, title_char, attr_char);
                                } else {
                                        // Not valid match
@@ -1278,13 +1270,13 @@ bool definition_extract(mmd_engine * e, token ** remainder) {
        // Advance to next line
        token_skip_until_type_multiple(remainder, 2, TEXT_NL, TEXT_LINEBREAK);
        if (*remainder)
-               *remainder = (*remainder)->next;                                
+               *remainder = (*remainder)->next;
 
        // Clean up
        free(url_char);
        free(title_char);
        free(attr_char);
-       
+
        return true;
 }
 
@@ -1316,8 +1308,8 @@ void process_definition_block(mmd_engine * e, token * block) {
                                        free(f->label_text);
                                        f->label_text = f->clean_text;
                                        if (f->content->child &&
-                                               f->content->child->next &&
-                                               f->content->child->next->next) {
+                                               f->content->child->next &&
+                                               f->content->child->next->next) {
                                                f->clean_text = clean_string_from_range(e->dstr->str, f->content->child->next->next->start, block->start + block->len - f->content->child->next->next->start, false);
                                        } else {
                                                f->clean_text = NULL;
@@ -1338,7 +1330,7 @@ void process_definition_block(mmd_engine * e, token * block) {
                                        if (f && f->clean_text)
                                                memmove(f->clean_text, &(f->clean_text)[1],strlen(f->clean_text));
                                        //if (f && f->label_text)
-                               //              memmove(f->label_text, &(f->label_text)[1],strlen(f->label_text));
+                                       //              memmove(f->label_text, &(f->label_text)[1],strlen(f->label_text));
 
                                        stack_push(e->glossary_stack, f);
                                        break;
@@ -1360,8 +1352,7 @@ void process_definition_block(mmd_engine * e, token * block) {
 
 
 void process_definition_stack(mmd_engine * e) {
-       for (int i = 0; i < e->definition_stack->size; ++i)
-       {
+       for (int i = 0; i < e->definition_stack->size; ++i) {
                process_definition_block(e, stack_peek_index(e->definition_stack, i));
        }
 }
@@ -1369,7 +1360,7 @@ void process_definition_stack(mmd_engine * e) {
 token * manual_label_from_header(token * h, const char * source) {
        if (!h || !h->child)
                return NULL;
-       
+
        token * walker = h->child->tail;
        token * label = NULL;
        short count = 0;
@@ -1436,7 +1427,7 @@ void process_header_to_links(mmd_engine * e, token * h) {
                label = label_from_token(e->dstr->str, manual);
                h = manual;
        } else {
-               label = label_from_token(e->dstr->str, h);              
+               label = label_from_token(e->dstr->str, h);
        }
 
        DString * url = d_string_new("#");
@@ -1458,8 +1449,7 @@ void process_header_stack(mmd_engine * e) {
        if (e->extensions & EXT_NO_LABELS)
                return;
 
-       for (int i = 0; i < e->header_stack->size; ++i)
-       {
+       for (int i = 0; i < e->header_stack->size; ++i) {
                process_header_to_links(e, stack_peek_index(e->header_stack, i));
        }
 }
@@ -1471,7 +1461,7 @@ void process_table_to_link(mmd_engine * e, token * t) {
                token * temp_token = t->next->child;
 
                if (temp_token->next &&
-                       temp_token->next->type == PAIR_BRACKET) {
+                       temp_token->next->type == PAIR_BRACKET) {
                        temp_token = temp_token->next;
                }
 
@@ -1491,9 +1481,8 @@ void process_table_to_link(mmd_engine * e, token * t) {
 
 
 void process_table_stack(mmd_engine * e) {
-       for (int i = 0; i < e->table_stack->size; ++i)
-       {
-               process_table_to_link(e, stack_peek_index(e->table_stack, i));  
+       for (int i = 0; i < e->table_stack->size; ++i) {
+               process_table_to_link(e, stack_peek_index(e->table_stack, i));
        }
 }
 
@@ -1501,15 +1490,14 @@ void process_table_stack(mmd_engine * e) {
 /// Parse metadata
 void process_metadata_stack(mmd_engine * e, scratch_pad * scratch) {
        if ((scratch->extensions & EXT_NO_METADATA) ||
-               (scratch->extensions & EXT_COMPATIBILITY))
+               (scratch->extensions & EXT_COMPATIBILITY))
                return;
 
        meta * m;
        short header_level = -10;
        char * temp_char = NULL;
 
-       for (int i = 0; i < e->metadata_stack->size; ++i)
-       {
+       for (int i = 0; i < e->metadata_stack->size; ++i) {
                // Check for certain metadata keys
                m = stack_peek_index(e->metadata_stack, i);
 
@@ -1527,12 +1515,12 @@ void process_metadata_stack(mmd_engine * e, scratch_pad * scratch) {
                                header_level = atoi(m->value);
                } else if (strcmp(m->key, "latexheaderlevel") == 0) {
                        if ((scratch->output_format == FORMAT_LATEX) ||
-                               (scratch->output_format == FORMAT_BEAMER) ||
-                               (scratch->output_format == FORMAT_MEMOIR))
+                               (scratch->output_format == FORMAT_BEAMER) ||
+                               (scratch->output_format == FORMAT_MEMOIR))
                                header_level = atoi(m->value);
                } else if (strcmp(m->key, "odfheaderlevel") == 0) {
                        if ((scratch->output_format == FORMAT_ODT) ||
-                               (scratch->output_format == FORMAT_FODT))
+                               (scratch->output_format == FORMAT_FODT))
                                header_level = atoi(m->value);
                } else if (strcmp(m->key, "language") == 0) {
                        temp_char = label_from_string(m->value);
@@ -1574,18 +1562,18 @@ void process_metadata_stack(mmd_engine * e, scratch_pad * scratch) {
                        temp_char = label_from_string(m->value);
 
                        if ((strcmp(temp_char, "dutch") == 0) ||
-                               (strcmp(temp_char, "nl") == 0)) {
+                               (strcmp(temp_char, "nl") == 0)) {
                                scratch->quotes_lang = DUTCH;
                        } else if ((strcmp(temp_char, "french") == 0) ||
-                               (strcmp(temp_char, "fr") == 0)) {
+                                  (strcmp(temp_char, "fr") == 0)) {
                                scratch->quotes_lang = FRENCH;
                        } else if ((strcmp(temp_char, "german") == 0) ||
-                               (strcmp(temp_char, "de") == 0)) {
+                                  (strcmp(temp_char, "de") == 0)) {
                                scratch->quotes_lang = GERMAN;
                        } else if (strcmp(temp_char, "germanguillemets") == 0) {
                                scratch->quotes_lang = GERMANGUILL;
                        } else if ((strcmp(temp_char, "swedish") == 0) ||
-                               (strcmp(temp_char, "sv") == 0)) {
+                                  (strcmp(temp_char, "sv") == 0)) {
                                scratch->quotes_lang = SWEDISH;
                        } else {
                                scratch->quotes_lang = ENGLISH;
@@ -1671,13 +1659,13 @@ void automatic_search(mmd_engine * e, token * t, trie * ac) {
                        case TABLE_CELL:
                        case TABLE_ROW:
                                automatic_search(e, t->child, ac);
-                               break;                  
+                               break;
 //                     case PAIR_PAREN:
                        default:
                                break;
                }
 
-               t = t->next;            
+               t = t->next;
        }
 }
 
@@ -1694,15 +1682,13 @@ void identify_global_search_terms(mmd_engine * e, scratch_pad * scratch) {
        footnote * f;
 
        // Add abbreviations to search trie
-       for (int i = 0; i < e->abbreviation_stack->size; ++i)
-       {
+       for (int i = 0; i < e->abbreviation_stack->size; ++i) {
                f = stack_peek_index(e->abbreviation_stack, i);
                trie_insert(ac, f->label_text, PAIR_BRACKET_ABBREVIATION);
        }
 
        // Add glossary to search trie (without leading '?')
-       for (int i = 0; i < e->glossary_stack->size; ++i)
-       {
+       for (int i = 0; i < e->glossary_stack->size; ++i) {
                f = stack_peek_index(e->glossary_stack, i);
                trie_insert(ac, f->clean_text, PAIR_BRACKET_GLOSSARY);
        }
@@ -1731,7 +1717,7 @@ void mmd_engine_export_token_tree(DString * out, mmd_engine * e, short format) {
        process_metadata_stack(e, scratch);
 
        // Process abbreviations, glossary, etc.
-       if (!(e->extensions & EXT_COMPATIBILITY)) 
+       if (!(e->extensions & EXT_COMPATIBILITY))
                identify_global_search_terms(e, scratch);
 
 
@@ -1898,11 +1884,11 @@ void parse_brackets(const char * source, scratch_pad * scratch, token * bracket,
                // Don't output brackets
                if (bracket->child) {
                        bracket->child->type = TEXT_EMPTY;
-               
+
                        if (bracket->child->mate)
                                bracket->child->mate->type = TEXT_EMPTY;
                }
-               
+
                *final_link = temp_link;
 
                // Skip over second bracket if present
@@ -2083,7 +2069,7 @@ void footnote_from_bracket(const char * source, scratch_pad * scratch, token * t
        // Get text inside bracket
        char * text = text_inside_pair(source, t);
        short footnote_id = extract_footnote_from_stack(scratch, text);
-       
+
        free(text);
 
        if (footnote_id == -1) {
@@ -2113,7 +2099,7 @@ void citation_from_bracket(const char * source, scratch_pad * scratch, token * t
        // Get text inside bracket
        char * text = text_inside_pair(source, t);
        short citation_id = extract_citation_from_stack(scratch, text);
-       
+
        free(text);
 
        if (citation_id == -1) {
@@ -2152,7 +2138,7 @@ void glossary_from_bracket(const char * source, scratch_pad * scratch, token * t
 
        if (t->child) {
                text = text_inside_pair(source, t);
-        memmove(text, &text[1], strlen(text));
+               memmove(text, &text[1], strlen(text));
        } else {
                text = malloc(t->len + 1);
                memcpy(text, &source[t->start], t->len);
@@ -2160,7 +2146,7 @@ void glossary_from_bracket(const char * source, scratch_pad * scratch, token * t
        }
 
        short glossary_id = extract_glossary_from_stack(scratch, text);
-       
+
        free(text);
 
        if (glossary_id == -1) {
@@ -2211,7 +2197,7 @@ void abbreviation_from_bracket(const char * source, scratch_pad * scratch, token
        }
 
        short abbr_id = extract_abbreviation_from_stack(scratch, &text[1]);
-       
+
        free(text);
 
        if (abbr_id == -1) {
@@ -2220,7 +2206,7 @@ void abbreviation_from_bracket(const char * source, scratch_pad * scratch, token
                        t->child->type = TEXT_EMPTY;
                        t->child->mate->type = TEXT_EMPTY;
                }
-               
+
                // Create glossary
                token * label = t->child;
                while (label && label->type != PAIR_PAREN)
@@ -2257,8 +2243,8 @@ void abbreviation_from_bracket(const char * source, scratch_pad * scratch, token
 void read_table_column_alignments(const char * source, token * table, scratch_pad * scratch) {
        token * walker = table->child->child;
 
-       // Find the separator line      
-       while (walker->next) 
+       // Find the separator line
+       while (walker->next)
                walker = walker->next;
 
        walker->type = TEXT_EMPTY;
@@ -2343,12 +2329,12 @@ bool table_has_caption(token * t) {
                        t = t->next;
 
                        if (t && t->next &&
-                               t->next->type == PAIR_BRACKET)
+                               t->next->type == PAIR_BRACKET)
                                t = t->next;
 
                        if (t && t->next &&
-                               ((t->next->type == TEXT_NL) ||
-                               (t->next->type == TEXT_LINEBREAK)))
+                               ((t->next->type == TEXT_NL) ||
+                                (t->next->type == TEXT_LINEBREAK)))
                                t = t->next;
 
                        if (t && t->next == NULL)
@@ -2363,7 +2349,7 @@ bool table_has_caption(token * t) {
 /// Grab the first "word" after the end of the fence marker:
 /// ````perl
 /// or
-/// ```` perl 
+/// ```` perl
 char * get_fence_language_specifier(token * fence, const char * source) {
        char * result = NULL;
        size_t start = fence->start + fence->len;
@@ -2458,7 +2444,7 @@ bool raw_filter_text_matches(char * pattern, short format) {
        } else if (strcmp("{=*}", pattern) == 0) {
                return true;
        } else {
-               switch(format){
+               switch(format) {
                        case FORMAT_HTML:
                                if (strstr(pattern, "html"))
                                        return true;
index 33fcbedfc638826c5820177cb9795154bf523bb1..c09450ee70271ea97b23b570630a8c262a6b8ef9 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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,7 +146,7 @@ mz_bool unzip_archive_to_path(mz_zip_archive * pZip, const char * path) {
 
        if (dir) {
                // Directory 'path' exists
-               
+
                // Remember current working directory
                // Apparently PATH_MAX doesn't actually mean anything, so pick a big number
                char cwd[4096 + 1];
index 3a7e66d1cc05e36e2210763f6635ef62d1b82f53..ab11e0e6e0cfea02a1713518099e1d423fce8219 100644 (file)
@@ -8,7 +8,7 @@
 
 
        @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.
-       
-       
+
+
        ## 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 without limitation the rights
        to use, copy, modify, merge, publish, 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. IN NO EVENT SHALL THE
@@ -74,8 +74,8 @@
 
 // argtable structs
 struct arg_lit *a_help, *a_version, *a_compatibility, *a_nolabels, *a_batch,
-               *a_accept, *a_reject, *a_full, *a_snippet, *a_random, *a_meta,
-               *a_notransclude, *a_nosmart;
+              *a_accept, *a_reject, *a_full, *a_snippet, *a_random, *a_meta,
+              *a_notransclude, *a_nosmart;
 struct arg_str *a_format, *a_lang, *a_extract;
 struct arg_file *a_file, *a_o;
 struct arg_end *a_end;
@@ -180,7 +180,7 @@ int main(int argc, char** argv) {
                a_lang                  = arg_str0("l", "lang", "LANG", "language/smart quote localization, LANG = en|es|de|fr|nl|sv"),
 
                a_rem5                  = arg_rem("", ""),
-               
+
                a_meta                  = arg_lit0("m", "metadata-keys", "list all metadata keys"),
                a_extract               = arg_str0("e", "extract", "KEY", "extract specified metadata key"),
 
@@ -337,8 +337,7 @@ int main(int argc, char** argv) {
 
        if ((a_batch->count) && (a_file->count)) {
                // Batch process 1 or more files
-               for (int i = 0; i < a_file->count; ++i)
-               {
+               for (int i = 0; i < a_file->count; ++i) {
 
                        buffer = scan_file(a_file->filename[i]);
 
@@ -388,7 +387,7 @@ int main(int argc, char** argv) {
 
                        if (extensions & EXT_TRANSCLUDE) {
                                mmd_transclude_source(buffer, folder, a_file->filename[i], format, NULL, NULL);
-       
+
                                // Don't free folder -- owned by dirname
                        }
 
@@ -461,8 +460,7 @@ int main(int argc, char** argv) {
                        DString * file_buffer;
 
                        // Concatenate all input files
-                       for (int i = 0; i < a_file->count; ++i)
-                       {
+                       for (int i = 0; i < a_file->count; ++i) {
                                file_buffer = scan_file(a_file->filename[i]);
 
                                if (file_buffer == NULL) {
@@ -488,7 +486,7 @@ int main(int argc, char** argv) {
 
                if ((extensions & EXT_TRANSCLUDE) && (a_file->count == 1)) {
                        // Perform transclusion(s)
-                       
+
                        // Convert to absolute path for first file to enable proper path resolution
 #ifdef PATH_MAX
                        // If PATH_MAX defined, use it
@@ -556,12 +554,12 @@ int main(int argc, char** argv) {
                                perror(a_o->filename[0]);
                                free(result);
                                d_string_free(buffer, true);
-               
+
                                exitcode = 1;
                                goto exit;
                        }
 
-                       fwrite(result->str, result->currentStringLength, 1, output_stream);                     
+                       fwrite(result->str, result->currentStringLength, 1, output_stream);
 
                        if (output_stream != stdout)
                                fclose(output_stream);
@@ -579,7 +577,7 @@ exit:
 
        // Decrement counter and clean up token pool
        token_pool_drain();
-       
+
 #ifdef kUseObjectPool
        token_pool_free();
 #endif