rpeg-multimarkdown2 2.0.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.
- data/LICENSE +96 -0
- data/README.markdown +52 -0
- data/Rakefile +167 -0
- data/bin/rpeg-multimarkdown2 +128 -0
- data/ext/extconf.h +3 -0
- data/ext/extconf.rb +15 -0
- data/ext/markdown.c +102 -0
- data/ext/markdown_lib.c +265 -0
- data/ext/markdown_lib.h +33 -0
- data/ext/markdown_output.c +2832 -0
- data/ext/markdown_parser.c +9091 -0
- data/ext/markdown_peg.h +144 -0
- data/ext/odf.c +183 -0
- data/ext/odf.h +3 -0
- data/ext/parsing_functions.c +199 -0
- data/ext/utility_functions.c +566 -0
- data/lib/multimarkdown2.rb +1 -0
- data/lib/peg_multimarkdown.rb +74 -0
- data/test/MultiMarkdownTest/BeamerTests/Beamer-Tables.html +76 -0
- data/test/MultiMarkdownTest/BeamerTests/Beamer-Tables.tex +64 -0
- data/test/MultiMarkdownTest/BeamerTests/Beamer-Tables.text +38 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Automatic Labels.html +35 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Automatic Labels.text +45 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Base Header Level.html +14 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Base Header Level.text +16 -0
- data/test/MultiMarkdownTest/CompatibilityTests/BibTeX.html +9 -0
- data/test/MultiMarkdownTest/CompatibilityTests/BibTeX.text +10 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Citations.html +40 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Citations.text +42 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Definition Lists.html +40 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Definition Lists.text +39 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Dutch.html +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Dutch.text +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Email.html +40 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Email.text +31 -0
- data/test/MultiMarkdownTest/CompatibilityTests/English.html +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/English.text +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Errors.html +9 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Errors.text +11 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Footnotes.html +23 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Footnotes.text +25 -0
- data/test/MultiMarkdownTest/CompatibilityTests/French.html +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/French.text +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/German.html +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/German.text +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/GermanGuillemets.html +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/GermanGuillemets.text +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Glossary.html +29 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Glossary.text +28 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Headers.html +42 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Headers.text +51 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Line Breaks.html +13 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Line Breaks.text +15 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Link Attributes.html +35 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Link Attributes.text +51 -0
- data/test/MultiMarkdownTest/CompatibilityTests/List Parsing.html +13 -0
- data/test/MultiMarkdownTest/CompatibilityTests/List Parsing.text +11 -0
- data/test/MultiMarkdownTest/CompatibilityTests/MarkdownInHTML.html +13 -0
- data/test/MultiMarkdownTest/CompatibilityTests/MarkdownInHTML.text +19 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Math.html +14 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Math.text +15 -0
- data/test/MultiMarkdownTest/CompatibilityTests/MetaData.html +14 -0
- data/test/MultiMarkdownTest/CompatibilityTests/MetaData.text +14 -0
- data/test/MultiMarkdownTest/CompatibilityTests/NotMetaData.html +3 -0
- data/test/MultiMarkdownTest/CompatibilityTests/NotMetaData.text +4 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Sanity.html +77 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Sanity.text +77 -0
- data/test/MultiMarkdownTest/CompatibilityTests/SmartQuotes.html +22 -0
- data/test/MultiMarkdownTest/CompatibilityTests/SmartQuotes.text +22 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Swedish.html +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Swedish.text +17 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Tables.html +65 -0
- data/test/MultiMarkdownTest/CompatibilityTests/Tables.text +71 -0
- data/test/MultiMarkdownTest/MarkdownTest.pl +182 -0
- data/test/MultiMarkdownTest/MemoirTests/Automatic Labels.html +42 -0
- data/test/MultiMarkdownTest/MemoirTests/Automatic Labels.tex +47 -0
- data/test/MultiMarkdownTest/MemoirTests/Automatic Labels.text +46 -0
- data/test/MultiMarkdownTest/MemoirTests/Base Header Level.html +20 -0
- data/test/MultiMarkdownTest/MemoirTests/Base Header Level.tex +19 -0
- data/test/MultiMarkdownTest/MemoirTests/Base Header Level.text +16 -0
- data/test/MultiMarkdownTest/MemoirTests/BibTeX.html +17 -0
- data/test/MultiMarkdownTest/MemoirTests/BibTeX.tex +12 -0
- data/test/MultiMarkdownTest/MemoirTests/BibTeX.text +11 -0
- data/test/MultiMarkdownTest/MemoirTests/Citations.html +63 -0
- data/test/MultiMarkdownTest/MemoirTests/Citations.tex +48 -0
- data/test/MultiMarkdownTest/MemoirTests/Citations.text +43 -0
- data/test/MultiMarkdownTest/MemoirTests/Definition Lists.html +61 -0
- data/test/MultiMarkdownTest/MemoirTests/Definition Lists.tex +58 -0
- data/test/MultiMarkdownTest/MemoirTests/Definition Lists.text +40 -0
- data/test/MultiMarkdownTest/MemoirTests/Dutch.html +23 -0
- data/test/MultiMarkdownTest/MemoirTests/Dutch.tex +18 -0
- data/test/MultiMarkdownTest/MemoirTests/Dutch.text +17 -0
- data/test/MultiMarkdownTest/MemoirTests/Email.html +48 -0
- data/test/MultiMarkdownTest/MemoirTests/Email.tex +61 -0
- data/test/MultiMarkdownTest/MemoirTests/Email.text +32 -0
- data/test/MultiMarkdownTest/MemoirTests/English.html +23 -0
- data/test/MultiMarkdownTest/MemoirTests/English.tex +18 -0
- data/test/MultiMarkdownTest/MemoirTests/English.text +17 -0
- data/test/MultiMarkdownTest/MemoirTests/Footnotes.html +47 -0
- data/test/MultiMarkdownTest/MemoirTests/Footnotes.tex +28 -0
- data/test/MultiMarkdownTest/MemoirTests/Footnotes.text +26 -0
- data/test/MultiMarkdownTest/MemoirTests/French.html +23 -0
- data/test/MultiMarkdownTest/MemoirTests/French.tex +18 -0
- data/test/MultiMarkdownTest/MemoirTests/French.text +17 -0
- data/test/MultiMarkdownTest/MemoirTests/German.html +23 -0
- data/test/MultiMarkdownTest/MemoirTests/German.tex +18 -0
- data/test/MultiMarkdownTest/MemoirTests/German.text +17 -0
- data/test/MultiMarkdownTest/MemoirTests/GermanGuillemets.html +23 -0
- data/test/MultiMarkdownTest/MemoirTests/GermanGuillemets.tex +18 -0
- data/test/MultiMarkdownTest/MemoirTests/GermanGuillemets.text +17 -0
- data/test/MultiMarkdownTest/MemoirTests/Glossary.html +47 -0
- data/test/MultiMarkdownTest/MemoirTests/Glossary.tex +30 -0
- data/test/MultiMarkdownTest/MemoirTests/Glossary.text +29 -0
- data/test/MultiMarkdownTest/MemoirTests/Line Breaks.html +21 -0
- data/test/MultiMarkdownTest/MemoirTests/Line Breaks.tex +16 -0
- data/test/MultiMarkdownTest/MemoirTests/Line Breaks.text +16 -0
- data/test/MultiMarkdownTest/MemoirTests/Link Attributes.html +40 -0
- data/test/MultiMarkdownTest/MemoirTests/Link Attributes.tex +61 -0
- data/test/MultiMarkdownTest/MemoirTests/Link Attributes.text +51 -0
- data/test/MultiMarkdownTest/MemoirTests/Math.html +22 -0
- data/test/MultiMarkdownTest/MemoirTests/Math.tex +16 -0
- data/test/MultiMarkdownTest/MemoirTests/Math.text +16 -0
- data/test/MultiMarkdownTest/MemoirTests/Memoir Mode.html +24 -0
- data/test/MultiMarkdownTest/MemoirTests/Memoir Mode.tex +23 -0
- data/test/MultiMarkdownTest/MemoirTests/Memoir Mode.text +20 -0
- data/test/MultiMarkdownTest/MemoirTests/MetaData.html +22 -0
- data/test/MultiMarkdownTest/MemoirTests/MetaData.tex +14 -0
- data/test/MultiMarkdownTest/MemoirTests/MetaData.text +15 -0
- data/test/MultiMarkdownTest/MemoirTests/Sanity.html +100 -0
- data/test/MultiMarkdownTest/MemoirTests/Sanity.tex +101 -0
- data/test/MultiMarkdownTest/MemoirTests/Sanity.text +78 -0
- data/test/MultiMarkdownTest/MemoirTests/SmartQuotes.html +26 -0
- data/test/MultiMarkdownTest/MemoirTests/SmartQuotes.tex +21 -0
- data/test/MultiMarkdownTest/MemoirTests/SmartQuotes.text +19 -0
- data/test/MultiMarkdownTest/MemoirTests/Swedish.html +23 -0
- data/test/MultiMarkdownTest/MemoirTests/Swedish.tex +18 -0
- data/test/MultiMarkdownTest/MemoirTests/Swedish.text +17 -0
- data/test/MultiMarkdownTest/MemoirTests/Tables.html +221 -0
- data/test/MultiMarkdownTest/MemoirTests/Tables.tex +134 -0
- data/test/MultiMarkdownTest/MemoirTests/Tables.text +64 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Automatic Labels.html +43 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Automatic Labels.tex +46 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Automatic Labels.text +45 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Base Header Level.html +22 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Base Header Level.tex +19 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Base Header Level.text +16 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/BibTeX.html +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/BibTeX.tex +11 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/BibTex.text +10 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Citations.html +64 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Citations.tex +47 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Citations.text +42 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Definition Lists.html +57 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Definition Lists.tex +57 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Definition Lists.text +39 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Dutch.html +25 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Dutch.tex +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Dutch.text +17 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Email.html +49 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Email.tex +54 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Email.text +31 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/English.html +25 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/English.tex +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/English.text +17 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Errors.html +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Errors.tex +11 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Errors.text +11 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Footnotes.html +48 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Footnotes.tex +24 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Footnotes.text +25 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/French.html +25 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/French.tex +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/French.text +17 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/German.html +25 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/German.tex +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/German.text +17 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/GermanGuillemets.html +25 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/GermanGuillemets.tex +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/GermanGuillemets.text +17 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Glossary.html +48 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Glossary.tex +26 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Glossary.text +28 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Headers.html +50 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Headers.tex +54 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Headers.text +51 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Line Breaks.html +22 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Line Breaks.tex +15 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Line Breaks.text +15 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Link Attributes.html +56 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Link Attributes.tex +60 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Link Attributes.text +50 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/List Parsing.html +22 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/List Parsing.tex +17 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/List Parsing.text +11 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/MarkdownInHTML.html +21 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/MarkdownInHTML.tex +13 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/MarkdownInHTML.text +19 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Math.html +23 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Math.tex +15 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Math.text +15 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/MetaData.html +23 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/MetaData.tex +13 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/MetaData.text +14 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/NotMetaData.html +3 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/NotMetaData.tex +3 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/NotMetaData.text +4 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Sanity.html +106 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Sanity.tex +100 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Sanity.text +77 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/SmartQuotes.html +31 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/SmartQuotes.tex +24 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/SmartQuotes.text +22 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Swedish.html +25 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Swedish.tex +18 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Swedish.text +17 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Tables.html +273 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Tables.tex +155 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/Tables.text +71 -0
- data/test/MultiMarkdownTest/MultiMarkdownTests/bibtex.bib +119 -0
- data/test/MultiMarkdownTest/README.md +58 -0
- data/test/MultiMarkdownTest/Tests/Amps and angle encoding.html +17 -0
- data/test/MultiMarkdownTest/Tests/Amps and angle encoding.text +21 -0
- data/test/MultiMarkdownTest/Tests/Auto links.html +18 -0
- data/test/MultiMarkdownTest/Tests/Auto links.text +13 -0
- data/test/MultiMarkdownTest/Tests/Backslash escapes.html +118 -0
- data/test/MultiMarkdownTest/Tests/Backslash escapes.text +120 -0
- data/test/MultiMarkdownTest/Tests/Blockquotes with code blocks.html +15 -0
- data/test/MultiMarkdownTest/Tests/Blockquotes with code blocks.text +11 -0
- data/test/MultiMarkdownTest/Tests/Code Blocks.html +18 -0
- data/test/MultiMarkdownTest/Tests/Code Blocks.text +14 -0
- data/test/MultiMarkdownTest/Tests/Code Spans.html +6 -0
- data/test/MultiMarkdownTest/Tests/Code Spans.text +6 -0
- data/test/MultiMarkdownTest/Tests/Compatibility.html +5 -0
- data/test/MultiMarkdownTest/Tests/Compatibility.text +9 -0
- data/test/MultiMarkdownTest/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
- data/test/MultiMarkdownTest/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/test/MultiMarkdownTest/Tests/Horizontal rules.html +71 -0
- data/test/MultiMarkdownTest/Tests/Horizontal rules.text +67 -0
- data/test/MultiMarkdownTest/Tests/Inline HTML (Advanced).html +15 -0
- data/test/MultiMarkdownTest/Tests/Inline HTML (Advanced).text +15 -0
- data/test/MultiMarkdownTest/Tests/Inline HTML (Simple).html +72 -0
- data/test/MultiMarkdownTest/Tests/Inline HTML (Simple).text +69 -0
- data/test/MultiMarkdownTest/Tests/Inline HTML comments.html +13 -0
- data/test/MultiMarkdownTest/Tests/Inline HTML comments.text +13 -0
- data/test/MultiMarkdownTest/Tests/Links, inline style.html +11 -0
- data/test/MultiMarkdownTest/Tests/Links, inline style.text +12 -0
- data/test/MultiMarkdownTest/Tests/Links, reference style.html +52 -0
- data/test/MultiMarkdownTest/Tests/Links, reference style.text +71 -0
- data/test/MultiMarkdownTest/Tests/Links, shortcut references.html +9 -0
- data/test/MultiMarkdownTest/Tests/Links, shortcut references.text +20 -0
- data/test/MultiMarkdownTest/Tests/Literal quotes in titles.html +3 -0
- data/test/MultiMarkdownTest/Tests/Literal quotes in titles.text +7 -0
- data/test/MultiMarkdownTest/Tests/Markdown Documentation - Basics.html +314 -0
- data/test/MultiMarkdownTest/Tests/Markdown Documentation - Basics.text +306 -0
- data/test/MultiMarkdownTest/Tests/Markdown Documentation - Syntax.html +942 -0
- data/test/MultiMarkdownTest/Tests/Markdown Documentation - Syntax.text +888 -0
- data/test/MultiMarkdownTest/Tests/Nested blockquotes.html +9 -0
- data/test/MultiMarkdownTest/Tests/Nested blockquotes.text +5 -0
- data/test/MultiMarkdownTest/Tests/Ordered and unordered lists.html +148 -0
- data/test/MultiMarkdownTest/Tests/Ordered and unordered lists.text +131 -0
- data/test/MultiMarkdownTest/Tests/Strong and em together.html +7 -0
- data/test/MultiMarkdownTest/Tests/Strong and em together.text +7 -0
- data/test/MultiMarkdownTest/Tests/Tabs.html +25 -0
- data/test/MultiMarkdownTest/Tests/Tabs.text +21 -0
- data/test/MultiMarkdownTest/Tests/Tidyness.html +8 -0
- data/test/MultiMarkdownTest/Tests/Tidyness.text +5 -0
- data/test/benchmark.rb +49 -0
- data/test/multimarkdown_test.rb +89 -0
- metadata +318 -0
data/ext/markdown_peg.h
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
/* markdown_peg.h */
|
2
|
+
#include "markdown_lib.h"
|
3
|
+
#include "glib.h"
|
4
|
+
|
5
|
+
#ifndef strdup
|
6
|
+
extern char *strdup(const char *string);
|
7
|
+
#endif
|
8
|
+
|
9
|
+
/* Information (label, URL and title) for a link. */
|
10
|
+
struct Link {
|
11
|
+
struct Element *label;
|
12
|
+
char *url;
|
13
|
+
char *title;
|
14
|
+
struct Element *attr;
|
15
|
+
char *identifier;
|
16
|
+
};
|
17
|
+
|
18
|
+
typedef struct Link link;
|
19
|
+
|
20
|
+
/* Union for contents of an Element (string, list, or link). */
|
21
|
+
union Contents {
|
22
|
+
char *str;
|
23
|
+
struct Link *link;
|
24
|
+
};
|
25
|
+
|
26
|
+
/* Types of semantic values returned by parsers. */
|
27
|
+
enum keys { LIST, /* A generic list of values. For ordered and bullet lists, see below. */
|
28
|
+
RAW, /* Raw markdown to be processed further */
|
29
|
+
SPACE,
|
30
|
+
LINEBREAK,
|
31
|
+
ELLIPSIS,
|
32
|
+
EMDASH,
|
33
|
+
ENDASH,
|
34
|
+
APOSTROPHE,
|
35
|
+
SINGLEQUOTED,
|
36
|
+
DOUBLEQUOTED,
|
37
|
+
STR,
|
38
|
+
LINK,
|
39
|
+
IMAGE,
|
40
|
+
IMAGEBLOCK,
|
41
|
+
CODE,
|
42
|
+
HTML,
|
43
|
+
EMPH,
|
44
|
+
STRONG,
|
45
|
+
PLAIN,
|
46
|
+
PARA,
|
47
|
+
LISTITEM,
|
48
|
+
BULLETLIST,
|
49
|
+
ORDEREDLIST,
|
50
|
+
H1, H2, H3, H4, H5, H6, H7, /* Code assumes that these are in order. */
|
51
|
+
BLOCKQUOTE,
|
52
|
+
VERBATIM,
|
53
|
+
HTMLBLOCK,
|
54
|
+
HRULE,
|
55
|
+
REFERENCE,
|
56
|
+
NOTE,
|
57
|
+
CITATION,
|
58
|
+
NOCITATION,
|
59
|
+
LOCATOR,
|
60
|
+
NOTELABEL,
|
61
|
+
DEFLIST,
|
62
|
+
TERM,
|
63
|
+
DEFINITION,
|
64
|
+
METAKEY,
|
65
|
+
METAVALUE,
|
66
|
+
METADATA,
|
67
|
+
FOOTER,
|
68
|
+
LABEL,
|
69
|
+
HEADINGSECTION,
|
70
|
+
ENDHTML,
|
71
|
+
TABLE,
|
72
|
+
TABLEHEAD,
|
73
|
+
TABLEBODY,
|
74
|
+
TABLEROW,
|
75
|
+
TABLECELL,
|
76
|
+
CELLSPAN,
|
77
|
+
TABLECAPTION,
|
78
|
+
TABLELABEL,
|
79
|
+
TABLESEPARATOR,
|
80
|
+
AUTOLABEL,
|
81
|
+
ATTRIBUTE,
|
82
|
+
ATTRKEY,
|
83
|
+
ATTRVALUE,
|
84
|
+
GLOSSARY,
|
85
|
+
GLOSSARYTERM,
|
86
|
+
GLOSSARYSORTKEY,
|
87
|
+
MATHSPAN
|
88
|
+
};
|
89
|
+
|
90
|
+
/* constants for managing Smart Typography */
|
91
|
+
enum smartelements {
|
92
|
+
LSQUOTE,
|
93
|
+
RSQUOTE,
|
94
|
+
LDQUOTE,
|
95
|
+
RDQUOTE,
|
96
|
+
NDASH,
|
97
|
+
MDASH,
|
98
|
+
ELLIP,
|
99
|
+
APOS,
|
100
|
+
};
|
101
|
+
|
102
|
+
enum smartoutput {
|
103
|
+
HTMLOUT,
|
104
|
+
LATEXOUT,
|
105
|
+
};
|
106
|
+
|
107
|
+
enum language {
|
108
|
+
DUTCH,
|
109
|
+
ENGLISH,
|
110
|
+
FRENCH,
|
111
|
+
GERMAN,
|
112
|
+
SWEDISH,
|
113
|
+
GERMANGUILL,
|
114
|
+
};
|
115
|
+
|
116
|
+
/* Semantic value of a parsing action. */
|
117
|
+
struct Element {
|
118
|
+
int key;
|
119
|
+
union Contents contents;
|
120
|
+
struct Element *children;
|
121
|
+
struct Element *next;
|
122
|
+
};
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
typedef struct Element element;
|
127
|
+
|
128
|
+
element * parse_references(char *string, int extensions);
|
129
|
+
element * parse_notes(char *string, int extensions, element *reference_list);
|
130
|
+
element * parse_labels(char *string, int extensions, element *reference_list, element *note_list);
|
131
|
+
|
132
|
+
element * parse_markdown(char *string, int extensions, element *reference_list, element *note_list, element *label_list);
|
133
|
+
element * parse_markdown_with_metadata(char *string, int extensions, element *reference_list, element *note_list, element *label_list);
|
134
|
+
void free_element_list(element * elt);
|
135
|
+
void free_element(element *elt);
|
136
|
+
void print_element_list(GString *out, element *elt, int format, int exts);
|
137
|
+
|
138
|
+
|
139
|
+
element * parse_metadata_only(char *string, int extensions);
|
140
|
+
char * extract_metadata_value(char *text, int extensions, char *key);
|
141
|
+
|
142
|
+
char * metavalue_for_key(char *key, element *list);
|
143
|
+
|
144
|
+
element * parse_markdown_for_opml(char *string, int extensions);
|
data/ext/odf.c
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
odf.c - Utility routines to enable ODF support in peg-multimarkdown.
|
4
|
+
(c) 2011 Fletcher T. Penney (http://fletcherpenney.net/).
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License or the MIT
|
8
|
+
license. See LICENSE for details.
|
9
|
+
|
10
|
+
This program is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
***********************************************************************/
|
16
|
+
|
17
|
+
|
18
|
+
void print_odf_header(GString *out){
|
19
|
+
|
20
|
+
/* Insert required XML header */
|
21
|
+
g_string_append_printf(out,
|
22
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
23
|
+
"<office:document xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n" \
|
24
|
+
" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
|
25
|
+
" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
|
26
|
+
" xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
|
27
|
+
" xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
|
28
|
+
" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
|
29
|
+
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
|
30
|
+
" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
|
31
|
+
" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
|
32
|
+
" xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
|
33
|
+
" xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
|
34
|
+
" xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
|
35
|
+
" xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
|
36
|
+
" xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
|
37
|
+
" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
|
38
|
+
" xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
|
39
|
+
" xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"\n" \
|
40
|
+
" xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
|
41
|
+
" xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
|
42
|
+
" xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
|
43
|
+
" xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
|
44
|
+
" xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
|
45
|
+
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
|
46
|
+
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
|
47
|
+
" xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
|
48
|
+
" xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
|
49
|
+
" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
|
50
|
+
" xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
|
51
|
+
" xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
|
52
|
+
" xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
|
53
|
+
" xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
|
54
|
+
" xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
|
55
|
+
" office:version=\"1.2\"\n" \
|
56
|
+
" grddl:transformation=\"http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl\"\n" \
|
57
|
+
" office:mimetype=\"application/vnd.oasis.opendocument.text\">\n");
|
58
|
+
|
59
|
+
/* Font Declarations */
|
60
|
+
g_string_append_printf(out, "<office:font-face-decls>\n" \
|
61
|
+
" <style:font-face style:name=\"Courier New\" svg:font-family=\"'Courier New'\"\n" \
|
62
|
+
" style:font-adornments=\"Regular\"\n" \
|
63
|
+
" style:font-family-generic=\"modern\"\n" \
|
64
|
+
" style:font-pitch=\"fixed\"/>\n" \
|
65
|
+
"</office:font-face-decls>\n");
|
66
|
+
|
67
|
+
/* Append basic style information */
|
68
|
+
g_string_append_printf(out, "<office:styles>\n" \
|
69
|
+
"<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n" \
|
70
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.15in\"" \
|
71
|
+
" fo:text-align=\"justify\" style:justify-single-word=\"false\"/>\n" \
|
72
|
+
" </style:style>\n" \
|
73
|
+
"<style:style style:name=\"Preformatted_20_Text\" style:display-name=\"Preformatted Text\"\n" \
|
74
|
+
" style:family=\"paragraph\"\n" \
|
75
|
+
" style:parent-style-name=\"Standard\"\n" \
|
76
|
+
" style:class=\"html\">\n" \
|
77
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0in\" fo:text-align=\"start\"\n" \
|
78
|
+
" style:justify-single-word=\"false\"/>\n" \
|
79
|
+
" <style:text-properties style:font-name=\"Courier New\" fo:font-size=\"11pt\"\n" \
|
80
|
+
" style:font-name-asian=\"Courier New\"\n" \
|
81
|
+
" style:font-size-asian=\"11pt\"\n" \
|
82
|
+
" style:font-name-complex=\"Courier New\"\n" \
|
83
|
+
" style:font-size-complex=\"11pt\"/>\n" \
|
84
|
+
"</style:style>\n" \
|
85
|
+
"<style:style style:name=\"Source_20_Text\" style:display-name=\"Source Text\"\n" \
|
86
|
+
" style:family=\"text\">\n" \
|
87
|
+
" <style:text-properties style:font-name=\"Courier New\" style:font-name-asian=\"Courier New\"\n" \
|
88
|
+
" style:font-name-complex=\"Courier New\"\n" \
|
89
|
+
" fo:font-size=\"11pt\"/>\n" \
|
90
|
+
"</style:style>\n" \
|
91
|
+
"<style:style style:name=\"List\" style:family=\"paragraph\"\n" \
|
92
|
+
" style:parent-style-name=\"Standard\"\n" \
|
93
|
+
" style:class=\"list\">\n" \
|
94
|
+
" <style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
|
95
|
+
" <style:text-properties style:font-size-asian=\"12pt\"/>\n" \
|
96
|
+
"</style:style>\n" \
|
97
|
+
"<style:style style:name=\"Quotations\" style:family=\"paragraph\"\n" \
|
98
|
+
" style:parent-style-name=\"Standard\"\n" \
|
99
|
+
" style:class=\"html\">\n" \
|
100
|
+
" <style:paragraph-properties fo:margin-left=\"0.3937in\" fo:margin-right=\"0.3937in\" fo:margin-top=\"0in\"\n" \
|
101
|
+
" fo:margin-bottom=\"0.1965in\"\n" \
|
102
|
+
" fo:text-align=\"justify\"" \
|
103
|
+
" style:justify-single-word=\"false\"" \
|
104
|
+
" fo:text-indent=\"0in\"\n" \
|
105
|
+
" style:auto-text-indent=\"false\"/>\n" \
|
106
|
+
"</style:style>\n" \
|
107
|
+
"<style:style style:name=\"Table_20_Heading\" style:display-name=\"Table Heading\"\n" \
|
108
|
+
" style:family=\"paragraph\"\n" \
|
109
|
+
" style:parent-style-name=\"Table_20_Contents\"\n" \
|
110
|
+
" style:class=\"extra\">\n" \
|
111
|
+
" <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"\n" \
|
112
|
+
" text:number-lines=\"false\"\n" \
|
113
|
+
" text:line-number=\"0\"/>\n" \
|
114
|
+
" <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
|
115
|
+
" style:font-weight-complex=\"bold\"/>\n" \
|
116
|
+
"</style:style>\n" \
|
117
|
+
"<style:style style:name=\"Horizontal_20_Line\" style:display-name=\"Horizontal Line\"\n" \
|
118
|
+
" style:family=\"paragraph\"\n" \
|
119
|
+
" style:parent-style-name=\"Standard\"\n" \
|
120
|
+
" style:class=\"html\">\n" \
|
121
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.1965in\"\n" \
|
122
|
+
" style:border-line-width-bottom=\"0.0008in 0.0138in 0.0008in\"\n" \
|
123
|
+
" fo:padding=\"0in\"\n" \
|
124
|
+
" fo:border-left=\"none\"\n" \
|
125
|
+
" fo:border-right=\"none\"\n" \
|
126
|
+
" fo:border-top=\"none\"\n" \
|
127
|
+
" fo:border-bottom=\"0.0154in double #808080\"\n" \
|
128
|
+
" text:number-lines=\"false\"\n" \
|
129
|
+
" text:line-number=\"0\"\n" \
|
130
|
+
" style:join-border=\"false\"/>\n" \
|
131
|
+
" <style:text-properties fo:font-size=\"6pt\" style:font-size-asian=\"6pt\" style:font-size-complex=\"6pt\"/>\n" \
|
132
|
+
"</style:style>\n" \
|
133
|
+
"<style:style style:name=\"Footnote_20_anchor\" style:display-name=\"Footnote anchor\"" \
|
134
|
+
" style:family=\"text\">" \
|
135
|
+
" <style:text-properties style:text-position=\"super 58%\"/>" \
|
136
|
+
" </style:style>" \
|
137
|
+
"</office:styles>\n");
|
138
|
+
|
139
|
+
/* Automatic style information */
|
140
|
+
g_string_append_printf(out, "<office:automatic-styles>" \
|
141
|
+
" <style:style style:name=\"MMD-Italic\" style:family=\"text\">\n" \
|
142
|
+
" <style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\"\n" \
|
143
|
+
" style:font-style-complex=\"italic\"/>\n" \
|
144
|
+
" </style:style>\n" \
|
145
|
+
" <style:style style:name=\"MMD-Bold\" style:family=\"text\">\n" \
|
146
|
+
" <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
|
147
|
+
" style:font-weight-complex=\"bold\"/>\n" \
|
148
|
+
" </style:style>\n" \
|
149
|
+
"<style:style style:name=\"MMD-Table\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
|
150
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.05in\"/>\n" \
|
151
|
+
"</style:style>\n" \
|
152
|
+
"<style:style style:name=\"MMD-Table-Center\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
|
153
|
+
" <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"/>\n" \
|
154
|
+
"</style:style>\n" \
|
155
|
+
"<style:style style:name=\"MMD-Table-Right\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
|
156
|
+
" <style:paragraph-properties fo:text-align=\"right\" style:justify-single-word=\"false\"/>\n" \
|
157
|
+
"</style:style>\n" \
|
158
|
+
"<style:style style:name=\"P2\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
|
159
|
+
" style:list-style-name=\"L2\">\n" \
|
160
|
+
"<style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
|
161
|
+
"</style:style>\n" \
|
162
|
+
"<style:style style:name=\"fr1\" style:family=\"graphic\" style:parent-style-name=\"Frame\">\n" \
|
163
|
+
" <style:graphic-properties style:print-content=\"false\" style:vertical-pos=\"top\"\n" \
|
164
|
+
" style:vertical-rel=\"baseline\"\n" \
|
165
|
+
" fo:padding=\"0in\"\n" \
|
166
|
+
" fo:border=\"none\"\n" \
|
167
|
+
" style:shadow=\"none\"/>\n" \
|
168
|
+
"</style:style>\n" \
|
169
|
+
"</office:automatic-styles>\n" \
|
170
|
+
"<style:style style:name=\"P1\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
|
171
|
+
" style:list-style-name=\"L1\"/>\n" \
|
172
|
+
"<text:list-style style:name=\"L1\">\n" \
|
173
|
+
" <text:list-level-style-bullet />\n" \
|
174
|
+
"</text:list-style>\n" \
|
175
|
+
"<text:list-style style:name=\"L2\">\n" \
|
176
|
+
" <text:list-level-style-number />\n" \
|
177
|
+
"</text:list-style>\n");
|
178
|
+
}
|
179
|
+
|
180
|
+
void print_odf_footer(GString *out) {
|
181
|
+
g_string_append_printf(out, "</office:text>\n</office:body>\n</office:document>");
|
182
|
+
}
|
183
|
+
|
data/ext/odf.h
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
/* parsing_functions.c - Functions for parsing markdown and
|
2
|
+
* freeing element lists. */
|
3
|
+
|
4
|
+
int yyparse(void);
|
5
|
+
|
6
|
+
static void free_element_contents(element elt);
|
7
|
+
|
8
|
+
/* free_element_list - free list of elements recursively */
|
9
|
+
void free_element_list(element * elt) {
|
10
|
+
element * next = NULL;
|
11
|
+
while (elt != NULL) {
|
12
|
+
next = elt->next;
|
13
|
+
free_element_contents(*elt);
|
14
|
+
if (elt->children != NULL) {
|
15
|
+
free_element_list(elt->children);
|
16
|
+
elt->children = NULL;
|
17
|
+
}
|
18
|
+
free(elt);
|
19
|
+
elt = next;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
/* free_element_contents - free element contents depending on type */
|
24
|
+
static void free_element_contents(element elt) {
|
25
|
+
switch (elt.key) {
|
26
|
+
case STR:
|
27
|
+
case SPACE:
|
28
|
+
case RAW:
|
29
|
+
case HTMLBLOCK:
|
30
|
+
case HTML:
|
31
|
+
case VERBATIM:
|
32
|
+
case CODE:
|
33
|
+
case NOTE:
|
34
|
+
case AUTOLABEL:
|
35
|
+
case CITATION:
|
36
|
+
case TERM:
|
37
|
+
case METAKEY:
|
38
|
+
case METAVALUE:
|
39
|
+
case TABLESEPARATOR:
|
40
|
+
case ATTRKEY:
|
41
|
+
case GLOSSARY:
|
42
|
+
case GLOSSARYTERM:
|
43
|
+
case NOTELABEL:
|
44
|
+
free(elt.contents.str);
|
45
|
+
elt.contents.str = NULL;
|
46
|
+
break;
|
47
|
+
case LINK:
|
48
|
+
case IMAGE:
|
49
|
+
case REFERENCE:
|
50
|
+
free(elt.contents.link->url);
|
51
|
+
elt.contents.link->url = NULL;
|
52
|
+
free(elt.contents.link->title);
|
53
|
+
elt.contents.link->title = NULL;
|
54
|
+
free_element_list(elt.contents.link->label);
|
55
|
+
free(elt.contents.link->identifier);
|
56
|
+
elt.contents.link->identifier = NULL;
|
57
|
+
/* free_element_list(elt.contents.link->attr);*/
|
58
|
+
free(elt.contents.link);
|
59
|
+
elt.contents.link = NULL;
|
60
|
+
break;
|
61
|
+
default:
|
62
|
+
;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
/* free_element - free element and contents */
|
67
|
+
void free_element(element *elt) {
|
68
|
+
free_element_contents(*elt);
|
69
|
+
free(elt);
|
70
|
+
}
|
71
|
+
|
72
|
+
element * parse_references(char *string, int extensions) {
|
73
|
+
|
74
|
+
char *oldcharbuf;
|
75
|
+
syntax_extensions = extensions;
|
76
|
+
|
77
|
+
oldcharbuf = charbuf;
|
78
|
+
charbuf = string;
|
79
|
+
yyparsefrom(yy_References); /* first pass, just to collect references */
|
80
|
+
charbuf = oldcharbuf;
|
81
|
+
|
82
|
+
return references;
|
83
|
+
}
|
84
|
+
|
85
|
+
element * parse_notes(char *string, int extensions, element *reference_list) {
|
86
|
+
|
87
|
+
char *oldcharbuf;
|
88
|
+
notes = NULL;
|
89
|
+
syntax_extensions = extensions;
|
90
|
+
|
91
|
+
if (extension(EXT_NOTES)) {
|
92
|
+
references = reference_list;
|
93
|
+
oldcharbuf = charbuf;
|
94
|
+
charbuf = string;
|
95
|
+
yyparsefrom(yy_Notes); /* second pass for notes */
|
96
|
+
charbuf = oldcharbuf;
|
97
|
+
}
|
98
|
+
|
99
|
+
return notes;
|
100
|
+
}
|
101
|
+
|
102
|
+
element * parse_labels(char *string, int extensions, element *reference_list, element *note_list) {
|
103
|
+
|
104
|
+
char *oldcharbuf;
|
105
|
+
syntax_extensions = extensions;
|
106
|
+
references = reference_list;
|
107
|
+
notes = note_list;
|
108
|
+
labels = NULL;
|
109
|
+
|
110
|
+
oldcharbuf = charbuf;
|
111
|
+
charbuf = string;
|
112
|
+
yyparsefrom(yy_AutoLabels); /* third pass, to collect labels */
|
113
|
+
charbuf = oldcharbuf;
|
114
|
+
|
115
|
+
return labels;
|
116
|
+
}
|
117
|
+
|
118
|
+
element * parse_markdown(char *string, int extensions, element *reference_list, element *note_list, element *label_list) {
|
119
|
+
|
120
|
+
char *oldcharbuf;
|
121
|
+
syntax_extensions = extensions;
|
122
|
+
references = reference_list;
|
123
|
+
notes = note_list;
|
124
|
+
labels = label_list;
|
125
|
+
|
126
|
+
oldcharbuf = charbuf;
|
127
|
+
charbuf = string;
|
128
|
+
|
129
|
+
yyparsefrom(yy_Doc);
|
130
|
+
|
131
|
+
charbuf = oldcharbuf; /* restore charbuf to original value */
|
132
|
+
|
133
|
+
/* if (parse_aborted) {
|
134
|
+
free_element_list(parse_result);
|
135
|
+
return NULL;
|
136
|
+
}*/
|
137
|
+
|
138
|
+
return parse_result;
|
139
|
+
|
140
|
+
}
|
141
|
+
|
142
|
+
element * parse_markdown_with_metadata(char *string, int extensions, element *reference_list, element *note_list, element *label_list) {
|
143
|
+
|
144
|
+
char *oldcharbuf;
|
145
|
+
syntax_extensions = extensions;
|
146
|
+
references = reference_list;
|
147
|
+
notes = note_list;
|
148
|
+
labels = label_list;
|
149
|
+
|
150
|
+
oldcharbuf = charbuf;
|
151
|
+
charbuf = string;
|
152
|
+
|
153
|
+
start_time = clock();
|
154
|
+
|
155
|
+
yyparsefrom(yy_DocWithMetaData);
|
156
|
+
charbuf = oldcharbuf; /* restore charbuf to original value */
|
157
|
+
|
158
|
+
/* reset start_time for subsequent passes */
|
159
|
+
start_time = 0;
|
160
|
+
|
161
|
+
if (parse_aborted) {
|
162
|
+
parse_aborted = 0;
|
163
|
+
free_element_list(parse_result);
|
164
|
+
return NULL;
|
165
|
+
}
|
166
|
+
|
167
|
+
return parse_result;
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
element * parse_metadata_only(char *string, int extensions) {
|
172
|
+
|
173
|
+
char *oldcharbuf;
|
174
|
+
syntax_extensions = extensions;
|
175
|
+
|
176
|
+
oldcharbuf = charbuf;
|
177
|
+
charbuf = string;
|
178
|
+
|
179
|
+
yyparsefrom(yy_MetaDataOnly);
|
180
|
+
|
181
|
+
charbuf = oldcharbuf; /* restore charbuf to original value */
|
182
|
+
return parse_result;
|
183
|
+
|
184
|
+
}
|
185
|
+
|
186
|
+
element * parse_markdown_for_opml(char *string, int extensions) {
|
187
|
+
|
188
|
+
char *oldcharbuf;
|
189
|
+
syntax_extensions = extensions;
|
190
|
+
|
191
|
+
oldcharbuf = charbuf;
|
192
|
+
charbuf = string;
|
193
|
+
|
194
|
+
yyparsefrom(yy_DocForOPML);
|
195
|
+
|
196
|
+
charbuf = oldcharbuf; /* restore charbuf to original value */
|
197
|
+
return parse_result;
|
198
|
+
|
199
|
+
}
|