rmultimarkdown 4.7.1.1 → 6.2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +2 -2
- data/README.md +7 -9
- data/Rakefile +33 -18
- data/ext/Makefile +261 -0
- data/ext/extconf.rb +23 -3
- data/ext/mmd/aho-corasick.c +596 -0
- data/ext/mmd/aho-corasick.h +120 -0
- data/ext/mmd/beamer.c +344 -0
- data/ext/mmd/beamer.h +72 -0
- data/ext/mmd/char.c +156 -0
- data/ext/mmd/char.h +111 -0
- data/ext/mmd/char_lookup.c +212 -0
- data/ext/mmd/critic_markup.c +330 -0
- data/ext/mmd/critic_markup.h +94 -0
- data/ext/mmd/d_string.c +402 -0
- data/ext/mmd/epub.c +563 -0
- data/ext/mmd/epub.h +69 -0
- data/ext/mmd/fodt.c +2288 -0
- data/ext/mmd/fodt.h +81 -0
- data/ext/mmd/html.c +2460 -0
- data/ext/mmd/html.h +81 -0
- data/ext/mmd/i18n.h +170 -0
- data/ext/mmd/include/d_string.h +182 -0
- data/ext/mmd/include/libMultiMarkdown.h +548 -0
- data/ext/mmd/include/token.h +233 -0
- data/ext/mmd/latex.c +2435 -0
- data/ext/mmd/latex.h +83 -0
- data/ext/mmd/lexer.c +3001 -0
- data/ext/mmd/lexer.h +75 -0
- data/ext/mmd/memoir.c +138 -0
- data/ext/mmd/memoir.h +67 -0
- data/ext/mmd/miniz.c +7557 -0
- data/ext/mmd/miniz.h +1328 -0
- data/ext/mmd/mmd.c +2798 -0
- data/ext/mmd/mmd.h +120 -0
- data/ext/mmd/object_pool.c +141 -0
- data/ext/mmd/object_pool.h +101 -0
- data/ext/mmd/opendocument-content.c +2071 -0
- data/ext/mmd/opendocument-content.h +135 -0
- data/ext/mmd/opendocument.c +981 -0
- data/ext/mmd/opendocument.h +118 -0
- data/ext/mmd/parser.c +1760 -0
- data/ext/mmd/parser.h +39 -0
- data/{MultiMarkdown-4 → ext/mmd}/rng.c +90 -49
- data/ext/mmd/scanners.c +77512 -0
- data/ext/mmd/scanners.h +101 -0
- data/ext/mmd/stack.c +142 -0
- data/ext/mmd/stack.h +113 -0
- data/ext/mmd/textbundle.c +455 -0
- data/ext/mmd/textbundle.h +115 -0
- data/ext/mmd/token.c +773 -0
- data/ext/mmd/token_pairs.c +263 -0
- data/ext/mmd/token_pairs.h +123 -0
- data/ext/mmd/transclude.c +549 -0
- data/ext/mmd/transclude.h +87 -0
- data/ext/mmd/uthash.h +1074 -0
- data/ext/mmd/uuid.c +154 -0
- data/ext/mmd/uuid.h +77 -0
- data/ext/mmd/version.h +111 -0
- data/ext/mmd/writer.c +2652 -0
- data/ext/mmd/writer.h +260 -0
- data/ext/mmd/zip.c +210 -0
- data/ext/mmd/zip.h +120 -0
- data/ext/{multi_markdown.c → ruby_multi_markdown.c} +87 -18
- data/lib/multi_markdown.bundle +0 -0
- data/lib/multi_markdown.rb +5 -8
- data/lib/multi_markdown/version.rb +1 -1
- data/rmultimarkdown.gemspec +2 -2
- data/test/{extensions_test.rb.rb → extensions_test.rb} +10 -54
- data/test/multi_markdown_test.rb +13 -0
- metadata +67 -47
- data/MultiMarkdown-4/GLibFacade.c +0 -310
- data/MultiMarkdown-4/GLibFacade.h +0 -100
- data/MultiMarkdown-4/beamer.c +0 -182
- data/MultiMarkdown-4/beamer.h +0 -11
- data/MultiMarkdown-4/critic.c +0 -111
- data/MultiMarkdown-4/critic.h +0 -15
- data/MultiMarkdown-4/glib.h +0 -11
- data/MultiMarkdown-4/html.c +0 -1117
- data/MultiMarkdown-4/html.h +0 -14
- data/MultiMarkdown-4/latex.c +0 -1217
- data/MultiMarkdown-4/latex.h +0 -16
- data/MultiMarkdown-4/libMultiMarkdown.h +0 -177
- data/MultiMarkdown-4/lyx.c +0 -2265
- data/MultiMarkdown-4/lyx.h +0 -37
- data/MultiMarkdown-4/lyxbeamer.c +0 -265
- data/MultiMarkdown-4/lyxbeamer.h +0 -11
- data/MultiMarkdown-4/memoir.c +0 -80
- data/MultiMarkdown-4/memoir.h +0 -10
- data/MultiMarkdown-4/multimarkdown.c +0 -518
- data/MultiMarkdown-4/odf.c +0 -1222
- data/MultiMarkdown-4/odf.h +0 -18
- data/MultiMarkdown-4/opml.c +0 -189
- data/MultiMarkdown-4/opml.h +0 -15
- data/MultiMarkdown-4/parse_utilities.c +0 -884
- data/MultiMarkdown-4/parser.c +0 -16656
- data/MultiMarkdown-4/parser.h +0 -188
- data/MultiMarkdown-4/rtf.c +0 -665
- data/MultiMarkdown-4/rtf.h +0 -17
- data/MultiMarkdown-4/strtok.c +0 -56
- data/MultiMarkdown-4/strtok.h +0 -9
- data/MultiMarkdown-4/text.c +0 -53
- data/MultiMarkdown-4/text.h +0 -11
- data/MultiMarkdown-4/toc.c +0 -142
- data/MultiMarkdown-4/toc.h +0 -15
- data/MultiMarkdown-4/transclude.c +0 -307
- data/MultiMarkdown-4/transclude.h +0 -28
- data/MultiMarkdown-4/writer.c +0 -731
- data/MultiMarkdown-4/writer.h +0 -38
data/ext/mmd/html.h
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
MultiMarkdown 6 -- Lightweight markup processor to produce HTML, LaTeX, and more.
|
|
4
|
+
|
|
5
|
+
@file html.h
|
|
6
|
+
|
|
7
|
+
@brief Convert token tree to HTML output.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@author Fletcher T. Penney
|
|
11
|
+
@bug
|
|
12
|
+
|
|
13
|
+
**/
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
|
|
17
|
+
Copyright © 2016 - 2017 Fletcher T. Penney.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
The `MultiMarkdown 6` project is released under the MIT License..
|
|
21
|
+
|
|
22
|
+
GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
|
|
23
|
+
|
|
24
|
+
https://github.com/fletcher/MultiMarkdown-4/
|
|
25
|
+
|
|
26
|
+
MMD 4 is released under both the MIT License and GPL.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
CuTest is released under the zlib/libpng license. See CuTest.c for the text
|
|
30
|
+
of the license.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## The MIT License ##
|
|
34
|
+
|
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
36
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
37
|
+
in the Software without restriction, including without limitation the rights
|
|
38
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
39
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
40
|
+
furnished to do so, subject to the following conditions:
|
|
41
|
+
|
|
42
|
+
The above copyright notice and this permission notice shall be included in
|
|
43
|
+
all copies or substantial portions of the Software.
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
48
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
49
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
51
|
+
THE SOFTWARE.
|
|
52
|
+
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
#ifndef HTML_MULTIMARKDOWN_H
|
|
57
|
+
#define HTML_MULTIMARKDOWN_H
|
|
58
|
+
|
|
59
|
+
#include "d_string.h"
|
|
60
|
+
#include "token.h"
|
|
61
|
+
#include "writer.h"
|
|
62
|
+
|
|
63
|
+
void mmd_export_token_html(DString * out, const char * source, token * t, scratch_pad * scratch);
|
|
64
|
+
void mmd_export_token_tree_html(DString * out, const char * source, token * t, scratch_pad * scratch);
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
void mmd_export_token_html_raw(DString * out, const char * source, token * t, scratch_pad * scratch);
|
|
68
|
+
void mmd_export_token_tree_html_raw(DString * out, const char * source, token * t, scratch_pad * scratch);
|
|
69
|
+
void mmd_export_token_tree_html_math(DString * out, const char * source, token * t, scratch_pad * scratch);
|
|
70
|
+
|
|
71
|
+
void mmd_export_citation_list_html(DString * out, const char * source, scratch_pad * scratch);
|
|
72
|
+
void mmd_export_footnote_list_html(DString * out, const char * source, scratch_pad * scratch);
|
|
73
|
+
void mmd_export_glossary_list_html(DString * out, const char * source, scratch_pad * scratch);
|
|
74
|
+
|
|
75
|
+
void mmd_start_complete_html(DString * out, const char * source, scratch_pad * scratch);
|
|
76
|
+
void mmd_end_complete_html(DString * out, const char * source, scratch_pad * scratch);
|
|
77
|
+
|
|
78
|
+
void mmd_print_string_html(DString * out, const char * str, bool obfuscate);
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
#endif
|
data/ext/mmd/i18n.h
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
MultiMarkdown 6 -- MultiMarkdown - lightweight markup processor.
|
|
4
|
+
|
|
5
|
+
@file i18n.h
|
|
6
|
+
|
|
7
|
+
@brief Provide rudimentary ability to provide translation string functionality.
|
|
8
|
+
This file enables calculating hash values of built in strings in order to allow
|
|
9
|
+
swapping out certain strings based on user-specified languages at runtime.
|
|
10
|
+
|
|
11
|
+
This does slow down compiling, as multiple hash strings are compiled (seemingly
|
|
12
|
+
quite slowly). But, to my understanding and testing, it does not affect the
|
|
13
|
+
speed when actually running MMD. This should allow translating an arbitrary
|
|
14
|
+
number of strings into an arbitrary number of languages without a performance
|
|
15
|
+
penalty.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@author Fletcher T. Penney
|
|
19
|
+
@bug
|
|
20
|
+
|
|
21
|
+
**/
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
|
|
25
|
+
Copyright © 2016 - 2017 Fletcher T. Penney.
|
|
26
|
+
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#ifndef I18N_MULTIMARKDOWN_6_H
|
|
31
|
+
#define I18N_MULTIMARKDOWN_6_H
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#include <string.h>
|
|
35
|
+
#include <stdint.h>
|
|
36
|
+
#include <stdio.h>
|
|
37
|
+
#include <stdlib.h>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
#define kNumberOfLanguages 7
|
|
41
|
+
#define kNumberOfStrings 4
|
|
42
|
+
#define kLanguage 0
|
|
43
|
+
|
|
44
|
+
//!< #define this in order to disable translations -- speeds up compiling
|
|
45
|
+
// #define I18N_DISABLED
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Hash function from http://lolengine.net/blog/2011/12/20/cpp-constant-string-hash
|
|
49
|
+
// via http://stackoverflow.com/questions/2826559/compile-time-preprocessor-hashing-of-string
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
#ifdef I18N_DISABLED
|
|
53
|
+
#define LC(x) x
|
|
54
|
+
#define LANG_FROM_STR(x) 0
|
|
55
|
+
#else
|
|
56
|
+
#define H1(s,i,x) (x*65599u+(uint8_t)s[(i)<strlen(s)?strlen(s)-1-(i):strlen(s)])
|
|
57
|
+
#define H4(s,i,x) H1(s,i,H1(s,i+1,H1(s,i+2,H1(s,i+3,x))))
|
|
58
|
+
#define H16(s,i,x) H4(s,i,H4(s,i+4,H4(s,i+8,H4(s,i+12,x))))
|
|
59
|
+
#define H64(s,i,x) H16(s,i,H16(s,i+16,H16(s,i+32,H16(s,i+48,x))))
|
|
60
|
+
#define H256(s,i,x) H64(s,i,H64(s,i+64,H64(s,i+128,H64(s,i+192,x))))
|
|
61
|
+
|
|
62
|
+
#define HASH(s) ((uint32_t)(H256(s,0,0)^(H256(s,0,0)>>16)))
|
|
63
|
+
|
|
64
|
+
#define LC(x) Translate(HASH(x), scratch->language)
|
|
65
|
+
|
|
66
|
+
//#define LC(x) TranslateTest(__COUNTER__, __FILE__, __LINE__, __FUNCTION__ , x)
|
|
67
|
+
|
|
68
|
+
#define LANG_FROM_STR(x) i18n_language_from_string(x)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// Create the dictionary array
|
|
72
|
+
static const char * lc_lookup[kNumberOfLanguages * kNumberOfStrings] = {
|
|
73
|
+
"return to body", // English
|
|
74
|
+
"Regresar al texto", // Español
|
|
75
|
+
"Zum Haupttext", // Deutsch
|
|
76
|
+
"Retour au texte principal", // Français
|
|
77
|
+
"Ga terug naar tekstlichaam", // Nederlands
|
|
78
|
+
"Återgå till textkroppen", // Svenska
|
|
79
|
+
"חזור/י לגוף הטקסט", // Hebrew - עברית
|
|
80
|
+
|
|
81
|
+
"see footnote", // English
|
|
82
|
+
"Ver nota a pie de página", // Español
|
|
83
|
+
"Siehe Fußnote", // Deutsch
|
|
84
|
+
"Voir note de bas de page", // Français
|
|
85
|
+
"Zie vootnot", // Nederlands
|
|
86
|
+
"Se fotnot", // Svenska
|
|
87
|
+
"ראה/י הערה", // Hebrew - עברית
|
|
88
|
+
|
|
89
|
+
"see citation", // English
|
|
90
|
+
"Ver referencia", // Español
|
|
91
|
+
"Siehe Zitat", // Deutsch
|
|
92
|
+
"Voir citation", // Français
|
|
93
|
+
"Zie citaat", // Nederlands
|
|
94
|
+
"Se citat", // Svenska
|
|
95
|
+
"ראה/י ציטוט", // Hebrew - עברית
|
|
96
|
+
|
|
97
|
+
"see glossary", // English
|
|
98
|
+
"Ver glosario", // Español
|
|
99
|
+
"Siehe Glossar", // Deutsch
|
|
100
|
+
"Voir glossaire", // Français
|
|
101
|
+
"Zie woordenlijst", // Nederlands
|
|
102
|
+
"Se ordlista", // Svenska
|
|
103
|
+
"ראה/י מילון מונחים", // Hebrew - עברית
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// Used for development when a new string is added to the dictionary and
|
|
108
|
+
// we need to know the hash
|
|
109
|
+
static inline const char * TranslateTest(int c, char * file, int line, const char func[], char * x) {
|
|
110
|
+
fprintf(stderr, "%s: %d (%s) -> %d\n", file, line, func, c);
|
|
111
|
+
unsigned long h = HASH(x);
|
|
112
|
+
fprintf(stderr, "hash '%s' -> %lu\n", x, h);
|
|
113
|
+
|
|
114
|
+
return lc_lookup[(c * kNumberOfLanguages) + kLanguage];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
// Given a hash and language, return the proper string
|
|
119
|
+
static inline const char * Translate(unsigned long x, int l) {
|
|
120
|
+
switch (x) {
|
|
121
|
+
case 3219553713:
|
|
122
|
+
return lc_lookup[0 * kNumberOfLanguages + l];
|
|
123
|
+
case 657226305:
|
|
124
|
+
return lc_lookup[1 * kNumberOfLanguages + l];
|
|
125
|
+
case 2977473004:
|
|
126
|
+
return lc_lookup[2 * kNumberOfLanguages + l];
|
|
127
|
+
case 3851221863:
|
|
128
|
+
return lc_lookup[3 * kNumberOfLanguages + l];
|
|
129
|
+
default:
|
|
130
|
+
return "localization error";
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
#endif
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// Based on ISO 639-1 names
|
|
139
|
+
// https://en.wikipedia.org/wiki/ISO_639-1
|
|
140
|
+
enum lc_languages {
|
|
141
|
+
LC_EN = 0, //!< English is default
|
|
142
|
+
LC_ES, //!< Español
|
|
143
|
+
LC_DE, //!< Deutsch
|
|
144
|
+
LC_FR, //!< Français
|
|
145
|
+
LC_NL, //!< Nederlands
|
|
146
|
+
LC_SV, //!< Svenska
|
|
147
|
+
LC_HE, //!< Hebrew - עברית
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
// MMD expects a lower case 2 letter code in the metadata or command-line arguments
|
|
152
|
+
static inline short i18n_language_from_string(const char * l) {
|
|
153
|
+
if (strcmp(l, "es") == 0) {
|
|
154
|
+
return LC_ES;
|
|
155
|
+
} else if (strcmp(l, "de") == 0) {
|
|
156
|
+
return LC_DE;
|
|
157
|
+
} else if (strcmp(l, "fr") == 0) {
|
|
158
|
+
return LC_FR;
|
|
159
|
+
} else if (strcmp(l, "he") == 0) {
|
|
160
|
+
return LC_HE;
|
|
161
|
+
} else if (strcmp(l, "nl") == 0) {
|
|
162
|
+
return LC_NL;
|
|
163
|
+
} else if (strcmp(l, "sv") == 0) {
|
|
164
|
+
return LC_SV;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
#endif
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
MultiMarkdown 6 -- Lightweight markup processor to produce HTML, LaTeX, and more.
|
|
4
|
+
|
|
5
|
+
@file d_string.h
|
|
6
|
+
|
|
7
|
+
@brief Dynamic string -- refactoring of old GLibFacade. Provides a string
|
|
8
|
+
"object" that can grow to accomodate any size content that is appended.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@author Daniel Jalkut, modified by Fletcher T. Penney and Dan Lowe
|
|
12
|
+
|
|
13
|
+
@bug
|
|
14
|
+
|
|
15
|
+
**/
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
|
|
19
|
+
Copyright © 2011 Daniel Jalkut.
|
|
20
|
+
Modifications by Fletcher T. Penney, Copyright © 2011-2017 Fletcher T. Penney.
|
|
21
|
+
Modifications by Dan Lowe, Copyright © 2011 Dan Lowe.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
The `MultiMarkdown 6` project is released under the MIT License..
|
|
25
|
+
|
|
26
|
+
GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
|
|
27
|
+
|
|
28
|
+
https://github.com/fletcher/MultiMarkdown-4/
|
|
29
|
+
|
|
30
|
+
MMD 4 is released under both the MIT License and GPL.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
CuTest is released under the zlib/libpng license. See CuTest.c for the text
|
|
34
|
+
of the license.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## The MIT License ##
|
|
38
|
+
|
|
39
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
40
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
41
|
+
in the Software without restriction, including without limitation the rights
|
|
42
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
43
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
44
|
+
furnished to do so, subject to the following conditions:
|
|
45
|
+
|
|
46
|
+
The above copyright notice and this permission notice shall be included in
|
|
47
|
+
all copies or substantial portions of the Software.
|
|
48
|
+
|
|
49
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
50
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
51
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
52
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
53
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
54
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
55
|
+
THE SOFTWARE.
|
|
56
|
+
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#ifndef D_STRING_SMART_STRING_H
|
|
61
|
+
#define D_STRING_SMART_STRING_H
|
|
62
|
+
|
|
63
|
+
#include <stdbool.h>
|
|
64
|
+
#include <stdlib.h>
|
|
65
|
+
|
|
66
|
+
/* WE implement minimal mirror implementations of GLib's GString
|
|
67
|
+
* sufficient to cover the functionality required by MultiMarkdown.
|
|
68
|
+
*
|
|
69
|
+
* NOTE: THese are 100% clean, from-scratch implementations using only the
|
|
70
|
+
* GLib function prototype as guide for behavior.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/// Structure for dynamic string
|
|
75
|
+
typedef struct
|
|
76
|
+
{
|
|
77
|
+
char * str; //!< Pointer to UTF-8 byte stream for string
|
|
78
|
+
unsigned long currentStringBufferSize; //!< Size of buffer currently allocated
|
|
79
|
+
unsigned long currentStringLength; //!< Size of current string
|
|
80
|
+
} DString;
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/// Create a new dynamic string
|
|
84
|
+
DString * d_string_new(
|
|
85
|
+
const char * startingString //!< Initial contents for string
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/// Free dynamic string
|
|
90
|
+
char * d_string_free(
|
|
91
|
+
DString * ripString, //!< DString to be freed
|
|
92
|
+
bool freeCharacterData //!< Should the underlying str be freed as well?
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/// Append null-terminated string to end of dynamic string
|
|
97
|
+
void d_string_append(
|
|
98
|
+
DString * baseString, //!< DString to be appended
|
|
99
|
+
const char * appendedString //!< String to be appended
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/// Append single character to end of dynamic string
|
|
104
|
+
void d_string_append_c(
|
|
105
|
+
DString * baseString, //!< DString to be appended
|
|
106
|
+
char appendedCharacter //!< Character to append
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
/// Append array of characters to end of dynamic string
|
|
111
|
+
void d_string_append_c_array(
|
|
112
|
+
DString * baseString, //!< DString to be appended
|
|
113
|
+
const char * appendedChars, //!< String to be appended
|
|
114
|
+
size_t bytes //!< Number of bytes to append
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
/// Append to end of dynamic string using format specifier
|
|
119
|
+
void d_string_append_printf(
|
|
120
|
+
DString * baseString, //!< DString to be appended
|
|
121
|
+
const char * format, //!< Format specifier for appending
|
|
122
|
+
... //!< Arguments for format specifier
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
/// Prepend null-terminated string to end of dynamic string
|
|
127
|
+
void d_string_prepend(
|
|
128
|
+
DString * baseString, //!< DString to be appended
|
|
129
|
+
const char * prependedString //!< String to be prepended
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/// Insert null-terminated string inside dynamic string
|
|
134
|
+
void d_string_insert(
|
|
135
|
+
DString * baseString, //!< DString to be appended
|
|
136
|
+
size_t pos, //!< Offset at which to insert string
|
|
137
|
+
const char * insertedString //!< String to be inserted
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
/// Insert single character inside dynamic string
|
|
142
|
+
void d_string_insert_c(
|
|
143
|
+
DString * baseString, //!< DString to be appended
|
|
144
|
+
size_t pos, //!< Offset at which to insert string
|
|
145
|
+
char insertedCharacter //!< Character to insert
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
/// Insert inside dynamic string using format specifier
|
|
150
|
+
void d_string_insert_printf(
|
|
151
|
+
DString * baseString, //!< DString to be appended
|
|
152
|
+
size_t pos, //!< Offset at which to insert string
|
|
153
|
+
const char * format, //!< Format specifier for appending
|
|
154
|
+
... //!< Arguments for format specifier
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
/// Erase portion of dynamic string
|
|
159
|
+
void d_string_erase(
|
|
160
|
+
DString * baseString, //!< DString to be appended
|
|
161
|
+
size_t pos, //!< Offset at which to erase portion of string
|
|
162
|
+
size_t len //!< Character to append
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
/// Copy a portion of dynamic string
|
|
166
|
+
char * d_string_copy_substring(
|
|
167
|
+
DString * d, //!< DString to copy
|
|
168
|
+
size_t start, //!< Start position for copy
|
|
169
|
+
size_t len //!< How many characters(bytes) to copy
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
/// Replace occurences of "original" with "replace" inside the specified range
|
|
173
|
+
/// Returns the change in overall length
|
|
174
|
+
long d_string_replace_text_in_range(
|
|
175
|
+
DString * d,
|
|
176
|
+
size_t pos,
|
|
177
|
+
size_t len,
|
|
178
|
+
const char * original,
|
|
179
|
+
const char * replace
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
#endif
|
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
MultiMarkdown 6 -- Lightweight markup processor to produce HTML, LaTeX, and more.
|
|
4
|
+
|
|
5
|
+
@file mmd.h
|
|
6
|
+
|
|
7
|
+
@brief Header file for libMultiMarkdown.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@author Fletcher T. Penney
|
|
11
|
+
@bug
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
******IMPORTANT******
|
|
15
|
+
|
|
16
|
+
If you are using libMultiMarkdown in your own project, you need to either:
|
|
17
|
+
|
|
18
|
+
1. Disable kUseObjectPool in `token.h`
|
|
19
|
+
|
|
20
|
+
2. Properly manage the `token_pool_init` and `token_pool_free` functions.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
I recommend option #1, unless you absolutely need the best performance for
|
|
24
|
+
long documents. Doing #2 properly is tricky in any program that can handle
|
|
25
|
+
multiple MMD text strings at overlapping times.
|
|
26
|
+
|
|
27
|
+
**/
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
|
|
31
|
+
Copyright © 2016 - 2017 Fletcher T. Penney.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
The `MultiMarkdown 6` project is released under the MIT License..
|
|
35
|
+
|
|
36
|
+
GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
|
|
37
|
+
|
|
38
|
+
https://github.com/fletcher/MultiMarkdown-4/
|
|
39
|
+
|
|
40
|
+
MMD 4 is released under both the MIT License and GPL.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
CuTest is released under the zlib/libpng license. See CuTest.c for the text
|
|
44
|
+
of the license.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## The MIT License ##
|
|
48
|
+
|
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
+
in the Software without restriction, including without limitation the rights
|
|
52
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
+
furnished to do so, subject to the following conditions:
|
|
55
|
+
|
|
56
|
+
The above copyright notice and this permission notice shall be included in
|
|
57
|
+
all copies or substantial portions of the Software.
|
|
58
|
+
|
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
65
|
+
THE SOFTWARE.
|
|
66
|
+
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
#ifndef MMD6_H
|
|
71
|
+
#define MMD6_H
|
|
72
|
+
|
|
73
|
+
#include <stdbool.h>
|
|
74
|
+
#include <stdlib.h>
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
#include "d_string.h"
|
|
78
|
+
#include "token.h"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/// There are 3 main versions of the primary functions:
|
|
82
|
+
///
|
|
83
|
+
/// * `mmd_string...` -- start from source text in c string
|
|
84
|
+
/// * `mmd_d_string...` -- start from a DString (Useful if you already use DString's for your text)
|
|
85
|
+
/// * `mmd_engine...` -- useful when you are processing the same source multiple times
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
C string variants
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/// Convert MMD text to specified format, with specified extensions, and language
|
|
93
|
+
/// Returned char * must be freed
|
|
94
|
+
char * mmd_string_convert(const char * source, unsigned long extensions, short format, short language);
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/// Convert MMD text to specified format using DString as a container for block of data
|
|
98
|
+
/// and length of that block. Must be used for "complex" output formats such as EPUB.
|
|
99
|
+
/// Returned DString * must be freed
|
|
100
|
+
DString * mmd_string_convert_to_data(const char * source, unsigned long extensions, short format, short language, const char * directory);
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/// Convert MMD text and write results to specified file -- used for "complex" output formats requiring
|
|
104
|
+
/// multiple documents (e.g. EPUB)
|
|
105
|
+
void mmd_string_convert_to_file(const char * source, unsigned long extensions, short format, short language, const char * directory, const char * filepath);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
/// Does the text have metadata?
|
|
109
|
+
bool mmd_string_has_metadata(char * source, size_t * end);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
/// Return metadata keys, one per line
|
|
113
|
+
/// Returned char * must be freed
|
|
114
|
+
char * mmd_string_metadata_keys(char * source);
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/// Extract desired metadata as string value
|
|
118
|
+
/// Returned char * must be freed
|
|
119
|
+
char * mmd_string_metavalue_for_key(char * source, const char * key);
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/// Insert/replace metadata in string, returning new string
|
|
123
|
+
char * mmd_string_update_metavalue_for_key(const char * source, const char * key, const char * value);
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
/// Grab list of all transcluded files, but we need to know directory to search,
|
|
127
|
+
/// as well as the path to the file
|
|
128
|
+
/// Returned stack needs to be freed
|
|
129
|
+
struct stack * mmd_string_transclusion_manifest(const char * source, const char * search_path, const char * source_path);
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
/*
|
|
135
|
+
DString variants - DString ("dynamic string") is a mutable string implementation used in this project
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/// Convert MMD text to specified format, with specified extensions, and language
|
|
139
|
+
/// Returned char * must be freed
|
|
140
|
+
char * mmd_d_string_convert(DString * source, unsigned long extensions, short format, short language);
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
/// Convert MMD text to specified format using DString as a container for block of data
|
|
144
|
+
/// and length of that block. Must be used for "complex" output formats such as EPUB.
|
|
145
|
+
/// Returned DString * must be freed
|
|
146
|
+
DString * mmd_d_string_convert_to_data(DString * source, unsigned long extensions, short format, short language, const char * directory);
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
/// Convert MMD text and write results to specified file -- used for "complex" output formats requiring
|
|
150
|
+
/// multiple documents (e.g. EPUB)
|
|
151
|
+
void mmd_d_string_convert_to_file(DString * source, unsigned long extensions, short format, short language, const char * directory, const char * filepath);
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
/// Does the text have metadata?
|
|
155
|
+
bool mmd_d_string_has_metadata(DString * source, size_t * end);
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
/// Return metadata keys, one per line
|
|
159
|
+
/// Returned char * must be freed
|
|
160
|
+
char * mmd_d_string_metadata_keys(DString * source);
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
/// Extract desired metadata as string value
|
|
164
|
+
/// Returned char * must be freed
|
|
165
|
+
char * mmd_d_string_metavalue_for_key(DString * source, const char * key);
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
/// Insert/replace metadata value in DString
|
|
169
|
+
void mmd_d_string_update_metavalue_for_key(DString * source, const char * key, const char * value);
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
/// Grab list of all transcluded files, but we need to know directory to search,
|
|
173
|
+
/// as well as the path to the file
|
|
174
|
+
/// Returned stack needs to be freed
|
|
175
|
+
struct stack * mmd_d_string_transclusion_manifest(DString * source, const char * search_path, const char * source_path);
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
/*
|
|
181
|
+
MMD Engine variants
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
/// MMD Engine is used for storing configuration information for MMD parser
|
|
185
|
+
typedef struct mmd_engine mmd_engine;
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
/// Create MMD Engine using an existing DString (A new copy is *not* made)
|
|
189
|
+
mmd_engine * mmd_engine_create_with_dstring(
|
|
190
|
+
DString * d,
|
|
191
|
+
unsigned long extensions
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
/// Create MMD Engine using a C string (A private copy of the string will be
|
|
196
|
+
/// made. The one passed here can be freed by the calling function)
|
|
197
|
+
mmd_engine * mmd_engine_create_with_string(
|
|
198
|
+
const char * str,
|
|
199
|
+
unsigned long extensions
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
/// Reset engine when finished parsing. (Usually not necessary to use this.)
|
|
204
|
+
void mmd_engine_reset(mmd_engine * e);
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
/// Free an existing MMD Engine
|
|
208
|
+
void mmd_engine_free(
|
|
209
|
+
mmd_engine * e,
|
|
210
|
+
bool freeDString
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
/// Set language and smart quotes language
|
|
215
|
+
void mmd_engine_set_language(mmd_engine * e, short language);
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
/// Parse part of the string into a token tree
|
|
219
|
+
token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byte_len);
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
/// Parse the entire string into a token tree
|
|
223
|
+
void mmd_engine_parse_string(mmd_engine * e);
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
/// Export parsed token tree to output format
|
|
227
|
+
void mmd_engine_export_token_tree(DString * out, mmd_engine * e, short format);
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
/// Convert MMD text to specified format, with specified extensions, and language
|
|
231
|
+
/// Returned char * must be freed
|
|
232
|
+
char * mmd_engine_convert(mmd_engine * e, short format);
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
/// Convert MMD text and write results to specified file -- used for "complex" output formats requiring
|
|
236
|
+
/// multiple documents (e.g. EPUB)
|
|
237
|
+
void mmd_engine_convert_to_file(mmd_engine * e, short format, const char * directory, const char * filepath);
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
/// Convert MMD text to specified format using DString as a container for block of data
|
|
241
|
+
/// and length of that block. Must be used for "complex" output formats such as EPUB.
|
|
242
|
+
/// Returned DString * must be freed
|
|
243
|
+
DString * mmd_engine_convert_to_data(mmd_engine * e, short format, const char * directory);
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
/// Does the text have metadata?
|
|
247
|
+
bool mmd_engine_has_metadata(mmd_engine * e, size_t * end);
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
/// Return metadata keys, one per line
|
|
251
|
+
/// Returned char * must be freed
|
|
252
|
+
char * mmd_engine_metadata_keys(mmd_engine * e);
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
/// Extract desired metadata as string value
|
|
256
|
+
char * mmd_engine_metavalue_for_key(mmd_engine * e, const char * key);
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
/// Insert/replace metadata value in mmd_engine
|
|
260
|
+
void mmd_engine_update_metavalue_for_key(mmd_engine * e, const char * key, const char * value);
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
/// Grab list of all transcluded files, but we need to know directory to search,
|
|
264
|
+
/// as well as the path to the file
|
|
265
|
+
/// Returned stack needs to be freed
|
|
266
|
+
struct stack * mmd_engine_transclusion_manifest(mmd_engine * e, const char * search_path, const char * source_path);
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
/*
|
|
272
|
+
Utility functions
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
/// Return the version string for this build of libMultiMarkdown
|
|
276
|
+
/// The returned `char *` will need to be freed after it is no longer needed.
|
|
277
|
+
char * mmd_version(void);
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
// Read file into memory
|
|
281
|
+
DString * scan_file(const char * fname);
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
/// MMD Engine is used for storing configuration information for MMD parser
|
|
285
|
+
typedef struct stack stack;
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
/// Recursively transclude source text, given a search directory.
|
|
289
|
+
/// Track files to prevent infinite recursive loops
|
|
290
|
+
void mmd_transclude_source(DString * source, const char * search_path, const char * source_path, short format, struct stack * parsed, struct stack * manifest);
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
/// If MMD Header metadata used, insert it into appropriate place
|
|
294
|
+
void mmd_prepend_mmd_header(DString * source);
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
/// If MMD Footer metadata used, insert it into appropriate place
|
|
298
|
+
void mmd_append_mmd_footer(DString * source);
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
/// Accept all CriticMarkup changes in the source string
|
|
302
|
+
void mmd_critic_markup_accept(DString * d);
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
/// Reject all CriticMarkup changes in the source string
|
|
306
|
+
void mmd_critic_markup_reject(DString * d);
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
/// Token types for parse tree
|
|
310
|
+
enum token_types {
|
|
311
|
+
DOC_START_TOKEN = 0, //!< DOC_START_TOKEN must be type 0
|
|
312
|
+
|
|
313
|
+
BLOCK_BLOCKQUOTE = 50, //!< This must start *after* the largest number in parser.h
|
|
314
|
+
BLOCK_CODE_FENCED,
|
|
315
|
+
BLOCK_CODE_INDENTED,
|
|
316
|
+
BLOCK_DEFLIST,
|
|
317
|
+
BLOCK_DEFINITION,
|
|
318
|
+
BLOCK_DEF_ABBREVIATION,
|
|
319
|
+
BLOCK_DEF_CITATION,
|
|
320
|
+
BLOCK_DEF_GLOSSARY,
|
|
321
|
+
BLOCK_DEF_FOOTNOTE,
|
|
322
|
+
BLOCK_DEF_LINK,
|
|
323
|
+
BLOCK_EMPTY,
|
|
324
|
+
BLOCK_HEADING, //!< Placeholder for theme cascading
|
|
325
|
+
BLOCK_H1, //!< Leave H1, H2, etc. in order
|
|
326
|
+
BLOCK_H2,
|
|
327
|
+
BLOCK_H3,
|
|
328
|
+
BLOCK_H4,
|
|
329
|
+
BLOCK_H5,
|
|
330
|
+
BLOCK_H6,
|
|
331
|
+
BLOCK_HR,
|
|
332
|
+
BLOCK_HTML,
|
|
333
|
+
BLOCK_LIST_BULLETED,
|
|
334
|
+
BLOCK_LIST_BULLETED_LOOSE,
|
|
335
|
+
BLOCK_LIST_ENUMERATED,
|
|
336
|
+
BLOCK_LIST_ENUMERATED_LOOSE,
|
|
337
|
+
BLOCK_LIST_ITEM,
|
|
338
|
+
BLOCK_LIST_ITEM_TIGHT,
|
|
339
|
+
BLOCK_META,
|
|
340
|
+
BLOCK_PARA,
|
|
341
|
+
BLOCK_SETEXT_1,
|
|
342
|
+
BLOCK_SETEXT_2,
|
|
343
|
+
BLOCK_TABLE,
|
|
344
|
+
BLOCK_TABLE_HEADER,
|
|
345
|
+
BLOCK_TABLE_SECTION,
|
|
346
|
+
BLOCK_TERM,
|
|
347
|
+
BLOCK_TOC,
|
|
348
|
+
|
|
349
|
+
CRITIC_ADD_OPEN,
|
|
350
|
+
CRITIC_ADD_CLOSE,
|
|
351
|
+
CRITIC_DEL_OPEN,
|
|
352
|
+
CRITIC_DEL_CLOSE,
|
|
353
|
+
CRITIC_COM_OPEN,
|
|
354
|
+
CRITIC_COM_CLOSE,
|
|
355
|
+
CRITIC_SUB_OPEN,
|
|
356
|
+
CRITIC_SUB_DIV,
|
|
357
|
+
CRITIC_SUB_DIV_A,
|
|
358
|
+
CRITIC_SUB_DIV_B,
|
|
359
|
+
CRITIC_SUB_CLOSE,
|
|
360
|
+
CRITIC_HI_OPEN,
|
|
361
|
+
CRITIC_HI_CLOSE,
|
|
362
|
+
|
|
363
|
+
PAIR_CRITIC_ADD,
|
|
364
|
+
PAIR_CRITIC_DEL,
|
|
365
|
+
PAIR_CRITIC_COM,
|
|
366
|
+
PAIR_CRITIC_SUB_ADD,
|
|
367
|
+
PAIR_CRITIC_SUB_DEL,
|
|
368
|
+
PAIR_CRITIC_HI,
|
|
369
|
+
|
|
370
|
+
PAIRS, //!< Placeholder for theme cascading
|
|
371
|
+
PAIR_ANGLE,
|
|
372
|
+
PAIR_BACKTICK,
|
|
373
|
+
PAIR_BRACKET,
|
|
374
|
+
PAIR_BRACKET_ABBREVIATION,
|
|
375
|
+
PAIR_BRACKET_FOOTNOTE,
|
|
376
|
+
PAIR_BRACKET_GLOSSARY,
|
|
377
|
+
PAIR_BRACKET_CITATION,
|
|
378
|
+
PAIR_BRACKET_IMAGE,
|
|
379
|
+
PAIR_BRACKET_VARIABLE,
|
|
380
|
+
PAIR_BRACE,
|
|
381
|
+
PAIR_EMPH,
|
|
382
|
+
PAIR_MATH,
|
|
383
|
+
PAIR_PAREN,
|
|
384
|
+
PAIR_QUOTE_SINGLE,
|
|
385
|
+
PAIR_QUOTE_DOUBLE,
|
|
386
|
+
PAIR_QUOTE_ALT,
|
|
387
|
+
PAIR_RAW_FILTER,
|
|
388
|
+
PAIR_SUBSCRIPT,
|
|
389
|
+
PAIR_SUPERSCRIPT,
|
|
390
|
+
PAIR_STAR,
|
|
391
|
+
PAIR_STRONG,
|
|
392
|
+
PAIR_UL,
|
|
393
|
+
PAIR_BRACES,
|
|
394
|
+
|
|
395
|
+
STAR,
|
|
396
|
+
UL,
|
|
397
|
+
EMPH_START,
|
|
398
|
+
EMPH_STOP,
|
|
399
|
+
STRONG_START,
|
|
400
|
+
STRONG_STOP,
|
|
401
|
+
|
|
402
|
+
BRACKET_LEFT,
|
|
403
|
+
BRACKET_RIGHT,
|
|
404
|
+
BRACKET_ABBREVIATION_LEFT,
|
|
405
|
+
BRACKET_FOOTNOTE_LEFT,
|
|
406
|
+
BRACKET_GLOSSARY_LEFT,
|
|
407
|
+
BRACKET_CITATION_LEFT,
|
|
408
|
+
BRACKET_IMAGE_LEFT,
|
|
409
|
+
BRACKET_VARIABLE_LEFT,
|
|
410
|
+
|
|
411
|
+
PAREN_LEFT,
|
|
412
|
+
PAREN_RIGHT,
|
|
413
|
+
|
|
414
|
+
ANGLE_LEFT,
|
|
415
|
+
ANGLE_RIGHT,
|
|
416
|
+
|
|
417
|
+
BRACE_DOUBLE_LEFT,
|
|
418
|
+
BRACE_DOUBLE_RIGHT,
|
|
419
|
+
|
|
420
|
+
AMPERSAND,
|
|
421
|
+
AMPERSAND_LONG,
|
|
422
|
+
APOSTROPHE,
|
|
423
|
+
BACKTICK,
|
|
424
|
+
CODE_FENCE,
|
|
425
|
+
COLON,
|
|
426
|
+
DASH_M,
|
|
427
|
+
DASH_N,
|
|
428
|
+
ELLIPSIS,
|
|
429
|
+
QUOTE_SINGLE,
|
|
430
|
+
QUOTE_DOUBLE,
|
|
431
|
+
QUOTE_LEFT_SINGLE,
|
|
432
|
+
QUOTE_RIGHT_SINGLE,
|
|
433
|
+
QUOTE_LEFT_DOUBLE,
|
|
434
|
+
QUOTE_RIGHT_DOUBLE,
|
|
435
|
+
QUOTE_RIGHT_ALT,
|
|
436
|
+
|
|
437
|
+
ESCAPED_CHARACTER,
|
|
438
|
+
|
|
439
|
+
HTML_ENTITY,
|
|
440
|
+
HTML_COMMENT_START,
|
|
441
|
+
HTML_COMMENT_STOP,
|
|
442
|
+
PAIR_HTML_COMMENT,
|
|
443
|
+
|
|
444
|
+
MATH_PAREN_OPEN,
|
|
445
|
+
MATH_PAREN_CLOSE,
|
|
446
|
+
MATH_BRACKET_OPEN,
|
|
447
|
+
MATH_BRACKET_CLOSE,
|
|
448
|
+
MATH_DOLLAR_SINGLE,
|
|
449
|
+
MATH_DOLLAR_DOUBLE,
|
|
450
|
+
|
|
451
|
+
EQUAL,
|
|
452
|
+
PIPE,
|
|
453
|
+
PLUS,
|
|
454
|
+
SLASH,
|
|
455
|
+
|
|
456
|
+
SUPERSCRIPT,
|
|
457
|
+
SUBSCRIPT,
|
|
458
|
+
|
|
459
|
+
INDENT_TAB,
|
|
460
|
+
INDENT_SPACE,
|
|
461
|
+
NON_INDENT_SPACE,
|
|
462
|
+
|
|
463
|
+
HASH1, //!< Leave HASH1, HASH2, etc. in order
|
|
464
|
+
HASH2,
|
|
465
|
+
HASH3,
|
|
466
|
+
HASH4,
|
|
467
|
+
HASH5,
|
|
468
|
+
HASH6,
|
|
469
|
+
MARKER_BLOCKQUOTE,
|
|
470
|
+
MARKER_H1, //!< Leave MARKER_H1, MARKER_H2, etc. in order
|
|
471
|
+
MARKER_H2,
|
|
472
|
+
MARKER_H3,
|
|
473
|
+
MARKER_H4,
|
|
474
|
+
MARKER_H5,
|
|
475
|
+
MARKER_H6,
|
|
476
|
+
MARKER_LIST_BULLET,
|
|
477
|
+
MARKER_LIST_ENUMERATOR,
|
|
478
|
+
|
|
479
|
+
TABLE_ROW,
|
|
480
|
+
TABLE_CELL,
|
|
481
|
+
TABLE_DIVIDER,
|
|
482
|
+
|
|
483
|
+
TOC,
|
|
484
|
+
|
|
485
|
+
TEXT_BACKSLASH,
|
|
486
|
+
RAW_FILTER_LEFT,
|
|
487
|
+
TEXT_BRACE_LEFT,
|
|
488
|
+
TEXT_BRACE_RIGHT,
|
|
489
|
+
TEXT_EMPTY,
|
|
490
|
+
TEXT_HASH,
|
|
491
|
+
TEXT_LINEBREAK,
|
|
492
|
+
TEXT_LINEBREAK_SP,
|
|
493
|
+
TEXT_NL,
|
|
494
|
+
TEXT_NL_SP,
|
|
495
|
+
TEXT_NUMBER_POSS_LIST,
|
|
496
|
+
TEXT_PERCENT,
|
|
497
|
+
TEXT_PERIOD,
|
|
498
|
+
TEXT_PLAIN,
|
|
499
|
+
|
|
500
|
+
MANUAL_LABEL,
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
/// Define smart typography languages -- first in list is default
|
|
505
|
+
enum smart_quotes_language {
|
|
506
|
+
ENGLISH = 0,
|
|
507
|
+
DUTCH,
|
|
508
|
+
FRENCH,
|
|
509
|
+
GERMAN,
|
|
510
|
+
GERMANGUILL,
|
|
511
|
+
SWEDISH,
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
enum output_format {
|
|
516
|
+
FORMAT_HTML,
|
|
517
|
+
FORMAT_EPUB,
|
|
518
|
+
FORMAT_LATEX,
|
|
519
|
+
FORMAT_BEAMER,
|
|
520
|
+
FORMAT_MEMOIR,
|
|
521
|
+
FORMAT_FODT,
|
|
522
|
+
FORMAT_ODT,
|
|
523
|
+
FORMAT_TEXTBUNDLE,
|
|
524
|
+
FORMAT_TEXTBUNDLE_COMPRESSED,
|
|
525
|
+
FORMAT_MMD,
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
enum parser_extensions {
|
|
530
|
+
EXT_COMPATIBILITY = 1 << 0, //!< Markdown compatibility mode
|
|
531
|
+
EXT_COMPLETE = 1 << 1, //!< Create complete document
|
|
532
|
+
EXT_SNIPPET = 1 << 2, //!< Create snippet only
|
|
533
|
+
EXT_SMART = 1 << 3, //!< Enable Smart quotes
|
|
534
|
+
EXT_NOTES = 1 << 4, //!< Enable Footnotes
|
|
535
|
+
EXT_NO_LABELS = 1 << 5, //!< Don't add anchors to headers, etc.
|
|
536
|
+
EXT_PROCESS_HTML = 1 << 6, //!< Process Markdown inside HTML
|
|
537
|
+
EXT_NO_METADATA = 1 << 7, //!< Don't parse Metadata
|
|
538
|
+
EXT_OBFUSCATE = 1 << 8, //!< Mask email addresses
|
|
539
|
+
EXT_CRITIC = 1 << 9, //!< Critic Markup Support
|
|
540
|
+
EXT_CRITIC_ACCEPT = 1 << 10, //!< Accept all proposed changes
|
|
541
|
+
EXT_CRITIC_REJECT = 1 << 11, //!< Reject all proposed changes
|
|
542
|
+
EXT_RANDOM_FOOT = 1 << 12, //!< Use random numbers for footnote links
|
|
543
|
+
EXT_TRANSCLUDE = 1 << 13, //!< Perform transclusion(s)
|
|
544
|
+
EXT_FAKE = 1 << 31, //!< 31 is highest number allowed
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
#endif
|