--- /dev/null
+# 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
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"
@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
// 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);
/// 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;
}
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
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);
}
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;
}
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);
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:
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");
@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
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) {
temp_char = label_from_token(source, t);
}
printf("}\n\\label{%s}", temp_char);
-
+
if (temp_char)
free(temp_char);
}
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);
@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
};
#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]));
// 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?
// 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;
}
@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
// 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);
}
// 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]);
}
@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.
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.
-
+
*/
@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
/// 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;
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) {
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;
}
/// 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);
/// 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);
/// 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);
/// 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);
/// 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);
}
/// 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;
}
@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.
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.
-
+
*/
char * result = container->str;
d_string_free(container, false);
- return result;
+ return result;
}
// 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);
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");
// 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");
(*counter)--;
break;
}
-
+
// Increment counter
(*counter)++;
}
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");
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;
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);
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) {
@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.
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.
-
+
*/
void mmd_print_string_odf(DString * out, const char * str) {
if (str == NULL)
return;
-
+
while (*str != '\0') {
mmd_print_char_odf(out, *str);
str++;
break;
default:
print_const("‘");
- }
+ }
break;
case QUOTE_RIGHT_SINGLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("’");
- }
+ }
break;
case QUOTE_LEFT_DOUBLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("“");
- }
+ }
break;
case QUOTE_RIGHT_DOUBLE:
switch (scratch->quotes_lang) {
case DUTCH:
default:
print_const("”");
- }
+ }
break;
}
}
text->child->next->start--;
text->child->next->len++;
}
-
+
mmd_export_token_tree_odf(out, source, text->child, scratch);
print_const("</text:a>");
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;
}
(*counter)--;
break;
}
-
+
// Increment counter
(*counter)++;
}
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>");
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;
}
}
break;
}
}
-
+
free(temp_char);
print_const("<text:p text:style-name=\"Preformatted Text\">");
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;
// 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);
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;
case PAIR_BRACKET_GLOSSARY:
print_const(" text:style-name=\"Footnote\">");
break;
- default:
+ default:
print_const(" text:style-name=\"Standard\">");
break;
}
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':
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;
}
print_const("[#");
break;
case BRACKET_LEFT:
- print_const("[");
+ print_const("[");
break;
case BRACKET_RIGHT:
print_const("]");
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]);
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;
}
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;
}
mmd_export_image_odf(out, source, t, temp_link, scratch, true);
}
}
-
+
if (temp_bool) {
link_free(temp_link);
}
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
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\" ");
}
}
} 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) {
// 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(")");
}
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);
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:
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;
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;
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) {
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) {
print_const("</text:span>");
} else {
print_const("^");
- }
+ }
break;
case TABLE_CELL:
print_const("<table:table-cell");
scratch->table_cell_count += t->next->len;
else
scratch->table_cell_count++;
-
+
break;
case TABLE_DIVIDER:
break;
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)
@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
break;
default:
print_const("‘");
- }
+ }
break;
case QUOTE_RIGHT_SINGLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("’");
- }
+ }
break;
case QUOTE_LEFT_DOUBLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("“");
- }
+ }
break;
case QUOTE_RIGHT_DOUBLE:
switch (scratch->quotes_lang) {
case DUTCH:
default:
print_const("”");
- }
+ }
break;
}
}
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;
return result;
}
}
-
+
return result;
}
(*counter)--;
break;
}
-
+
// Increment counter
(*counter)++;
}
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>");
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);
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;
}
}
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--;
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;
}
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");
print_const("}}");
break;
case BRACKET_LEFT:
- print_const("[");
+ print_const("[");
break;
case BRACKET_ABBREVIATION_LEFT:
print_const("[>");
break;
case ESCAPED_CHARACTER:
if (!(scratch->extensions & EXT_COMPATIBILITY) &&
- (source[t->start + 1] == ' ')) {
+ (source[t->start + 1] == ' ')) {
print_const(" ");
} else {
mmd_print_char_html(out, source[t->start + 1], false);
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;
}
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;
}
mmd_export_image_html(out, source, t, temp_link, scratch, true);
}
}
-
+
if (temp_bool) {
link_free(temp_link);
}
}
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
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
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 {
}
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
}
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
// 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;
}
// 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 {
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>");
}
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:
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;
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;
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) {
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) {
print_const("</sup>");
} else {
print_const("^");
- }
+ }
break;
case TABLE_CELL:
if (scratch->in_table_header) {
scratch->table_cell_count += t->next->len;
else
scratch->table_cell_count++;
-
+
break;
case TABLE_DIVIDER:
break;
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);
while(content) {
if (content->type == BLOCK_PARA)
scratch->footnote_para_counter++;
-
+
content = content->next;
}
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);
while(content) {
if (content->type == BLOCK_PARA)
scratch->footnote_para_counter++;
-
+
content = content->next;
}
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);
while(content) {
if (content->type == BLOCK_PARA)
scratch->footnote_para_counter++;
-
+
content = content->next;
}
@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
void mmd_print_string_latex(DString * out, const char * str) {
if (str == NULL)
return;
-
+
while (*str != '\0') {
mmd_print_char_latex(out, *str);
str++;
break;
default:
print_const("`");
- }
+ }
break;
case QUOTE_RIGHT_SINGLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("'");
- }
+ }
break;
case QUOTE_LEFT_DOUBLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("``");
- }
+ }
break;
case QUOTE_RIGHT_DOUBLE:
switch (scratch->quotes_lang) {
case DUTCH:
default:
print_const("''");
- }
+ }
break;
}
}
}
return;
} else {
- printf("\\href{%s}", link->url);
+ printf("\\href{%s}", link->url);
}
} else
print_const("\\href{}");
text->child->next->start--;
text->child->next->len++;
}
-
+
mmd_export_token_tree_latex(out, source, text->child, scratch);
print_const("}");
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;
}
(*counter)--;
break;
}
-
+
// Increment counter
(*counter)++;
}
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;
}
}
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);
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;
}
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':
print_const("\\}\\}");
break;
case BRACKET_LEFT:
- print_const("[");
+ print_const("[");
break;
case BRACKET_ABBREVIATION_LEFT:
print_const("[>");
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]);
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('#');
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;
}
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;
}
mmd_export_image_latex(out, source, t, temp_link, scratch, true);
}
}
-
+
if (temp_bool) {
link_free(temp_link);
}
}
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
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) {
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??
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
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{");
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:
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;
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;
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) {
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) {
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;
print_const("}");
} else {
print_const("\\^{}");
- }
+ }
break;
case TABLE_CELL:
if (t->next && t->next->type == TABLE_DIVIDER) {
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);
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);
@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
@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
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);
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);
}
const char * source = e->dstr->str;
-
+
token * t = NULL;
short temp_short;
size_t scan_len;
line->type = LINE_EMPTY;
return;
}
-
+
switch (line->child->type) {
case INDENT_TAB:
if (line_is_empty(line->child)) {
// 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;
}
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;
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;
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;
}
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;
void deindent_line(token * line) {
if (!line || !line->child)
return;
-
+
token * t;
switch (line->child->type) {
return;
token * t;
-
+
switch (line->child->type) {
case MARKER_BLOCKQUOTE:
case NON_INDENT_SPACE:
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;
line->child->prev = NULL;
line->child->tail = t->tail;
}
-
+
token_free(t);
}
}
// 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;
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));
last_stop = s.cur;
} while (type != 0);
-
+
return root;
}
/// 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
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;
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;
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
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;
// 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;
// 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;
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;
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;
}
}
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;
break;
}
-
+
t = t->next;
}
/// 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) {
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);
token_prune_graft(t, closer, PAIR_EMPH);
}
break;
-
+
default:
break;
}
}
-
+
if (t->child != NULL) {
switch(t->type) {
case PAIR_BACKTICK:
break;
}
}
-
+
t = t->next;
}
}
void is_list_loose(token * list) {
bool loose = false;
-
+
token * walker = list->child;
if (walker == NULL)
walker->type = BLOCK_LIST_ITEM_TIGHT;
}
}
-
+
walker = walker->next;
}
/// 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;
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;
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);
}
while (l) {
switch (l->type) {
case LINE_META:
- meta:
+meta:
if (m) {
meta_set_value(m, d->str);
d_string_erase(d, 0, -1);
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;
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;
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:
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);
}
// 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);
/// 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);
}
}
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;
}
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);
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);
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);
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) {
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) {
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
DString * result = NULL;
mmd_engine_parse_string(e);
-
+
mmd_engine_export_token_tree(output, e, format);
switch (format) {
break;
case FORMAT_FODT:
result = opendocument_flat_text_create(output->str, e, directory);
-
+
d_string_free(output, true);
break;
default:
@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
@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:
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
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.
-
+
*/
void mmd_print_string_opendocument(DString * out, const char * str) {
if (str == NULL)
return;
-
+
while (*str != '\0') {
mmd_print_char_opendocument(out, *str);
str++;
break;
default:
print_const("‘");
- }
+ }
break;
case QUOTE_RIGHT_SINGLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("’");
- }
+ }
break;
case QUOTE_LEFT_DOUBLE:
switch (scratch->quotes_lang) {
break;
default:
print_const("“");
- }
+ }
break;
case QUOTE_RIGHT_DOUBLE:
switch (scratch->quotes_lang) {
case DUTCH:
default:
print_const("”");
- }
+ }
break;
}
}
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;
}
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);
}
}
(*counter)--;
break;
}
-
+
// Increment counter
(*counter)++;
}
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>");
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;
}
}
break;
}
}
-
+
free(temp_char);
print_const("<text:p text:style-name=\"Preformatted Text\">");
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;
// 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);
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;
case PAIR_BRACKET_GLOSSARY:
print_const(" text:style-name=\"Footnote\">");
break;
- default:
+ default:
print_const(" text:style-name=\"Standard\">");
break;
}
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':
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;
}
print_const("[#");
break;
case BRACKET_LEFT:
- print_const("[");
+ print_const("[");
break;
case BRACKET_RIGHT:
print_const("]");
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]);
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;
}
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;
}
mmd_export_image_opendocument(out, source, t, temp_link, scratch, true);
}
}
-
+
if (temp_bool) {
link_free(temp_link);
}
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
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\" ");
}
}
} 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) {
// 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(")");
}
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);
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:
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;
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;
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) {
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) {
print_const("</text:span>");
} else {
print_const("^");
- }
+ }
break;
case TABLE_CELL:
print_const("<table:table-cell");
scratch->table_cell_count += t->next->len;
else
scratch->table_cell_count++;
-
+
break;
case TABLE_DIVIDER:
break;
@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:
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
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.
-
+
*/
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;
}
d_string_append(out, "</office:meta>");
-
+
char * result = out->str;
d_string_free(out, false);
return result;
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);
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);
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);
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) {
/// 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\"");
}
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 */
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 */
return 0;
} */
-long ran_num_next()
-{
+long ran_num_next() {
return ran_arr_next();
}
@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
/// initial capacity (0 to use default capacity)
stack * stack_new(int startingSize) {
stack * s = malloc(sizeof(stack));
-
+
if (s) {
if (startingSize <= 0)
startingSize = kStackStartingSize;
@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:
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
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.
-
+
*/
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;
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);
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) {
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
@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
if (child == NULL) {
return token_new(type, 0, 0);
}
-
+
token * t = token_new(type, child->start, 0);
t->child = child;
child->prev = NULL;
/// 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
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);
}
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;
#else
if (t == NULL)
return;
-
+
token_tree_free(t->child);
free(t);
/// 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) {
/// 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;
}
if (walker->start > offset)
return NULL;
-
+
walker = walker->next;
}
/// 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;
/// 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;
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;
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;
}
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;
}
// 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;
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
/// 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;
// 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;
goto open;
}
- close:
+close:
// Find matching opener for this closer
while (i > start_counter) {
peek = stack_peek_index(s, i - 1);
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;
}
}
- 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
}
@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
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;
memcpy(result, source, len);
result[len] = '\0';
}
-
+
return result;
}
#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]));
///
/// 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
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
}
// 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
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
// 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);
// Remove this file from stack
stack_pop(parse_stack);
- finish_file:
+finish_file:
d_string_free(file_path, true);
} else {
start = strstr(source->str + last_match, "{{");
}
- exit:
+exit:
if (parsed == NULL) {
// Free temp stack
@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.
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.
-
+
*/
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;
}
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;
}
// 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;
}
@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
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;
memcpy(result, source, len);
result[len] = '\0';
}
-
+
return result;
}
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);
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);
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);
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);
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);
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;
}
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;
// 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
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));
}
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;
// Get key
scan_len = scan_key(&source[pos]);
key = my_strndup(&source[pos], scan_len);
-
+
// Skip '='
pos += scan_len + 1;
new->title = l->title;
new->attributes = l->attributes;
}
-
+
return new;
}
// 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);
if (*remainder == NULL)
return url;
-
+
switch ((*remainder)->type) {
case PAIR_PAREN:
case PAIR_ANGLE:
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++;
// Advance remainder to end of destination
while ((*remainder)->next &&
- (*remainder)->next->start < start + scan_len) {
+ (*remainder)->next->start < start + scan_len) {
*remainder = (*remainder)->next;
}
// Is this a valid URL?
clean = clean_string(url, false);
-
+
if (validate && !validate_url(clean)) {
free(clean);
clean = NULL;
// Is this <foo>?
if ((source[start] == '<') &&
- (source[start + scan_len - 1] == '>')) {
+ (source[start + scan_len - 1] == '>')) {
// Strip '<' and '>'
start++;
scan_len -= 2;
/// 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
// Grab attributes, if present
attr_len = scan_attributes(&source[pos]);
-
+
if (attr_len) {
*attributes = my_strndup(&source[pos], attr_len);
}
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);
link * l = NULL;
footnote * f = NULL;
-
+
// Store label
label = *remainder;
*remainder = (*remainder)->next;
-
+
// Prepare for parsing
// Account for settings
stack_push(e->glossary_stack, f);
break;
}
-
+
break;
}
case PAIR_BRACKET:
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);
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
// 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;
}
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;
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;
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));
}
}
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;
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("#");
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));
}
}
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;
}
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));
}
}
/// 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);
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);
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;
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;
}
}
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);
}
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);
// 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
// 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) {
// 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) {
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);
}
short glossary_id = extract_glossary_from_stack(scratch, text);
-
+
free(text);
if (glossary_id == -1) {
}
short abbr_id = extract_abbreviation_from_stack(scratch, &text[1]);
-
+
free(text);
if (abbr_id == -1) {
t->child->type = TEXT_EMPTY;
t->child->mate->type = TEXT_EMPTY;
}
-
+
// Create glossary
token * label = t->child;
while (label && label->type != PAIR_PAREN)
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;
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)
/// 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;
} else if (strcmp("{=*}", pattern) == 0) {
return true;
} else {
- switch(format){
+ switch(format) {
case FORMAT_HTML:
if (strstr(pattern, "html"))
return true;
@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:
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
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.
-
+
*/
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];
@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
// 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;
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"),
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]);
if (extensions & EXT_TRANSCLUDE) {
mmd_transclude_source(buffer, folder, a_file->filename[i], format, NULL, NULL);
-
+
// Don't free folder -- owned by dirname
}
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) {
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
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);
// Decrement counter and clean up token pool
token_pool_drain();
-
+
#ifdef kUseObjectPool
token_pool_free();
#endif