parkdown 1.4.28 → 1.4.29
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/Rakefile +1 -1
- data/ext/odf.c +184 -0
- data/ext/odf.h +11 -0
- data/ext/parsing_functions.h +17 -0
- data/ext/utility_functions.h +78 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba512c543d83ef1b70c4384f02ae3e0b4ef18e17603415d1291f92b3301ca60c
|
4
|
+
data.tar.gz: c0e205a87d5b0b8f106c9bd247051928117abcd6c684a82f6ce6f65ad98c7ffb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bc195204359c8e818f114b038ad40fb67e14c223e400bb46ea1d25af8916f25094ea152d0874d042920a60e39b0797c831c9bb15b6bbee3baca3a70efbbe2f0
|
7
|
+
data.tar.gz: b3ca3e4ab42f6fa72cf7e126701a5cc8dc125b4556cee84a226019f4809fdea195c5f2bc3c1f07d8d427fbf1f45b0a438ee2beac82cfddd5e4c84824718ea5c4
|
data/Rakefile
CHANGED
data/ext/odf.c
ADDED
@@ -0,0 +1,184 @@
|
|
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
|
+
#include "odf.h"
|
18
|
+
|
19
|
+
|
20
|
+
void print_odf_header(GString *out){
|
21
|
+
|
22
|
+
/* Insert required XML header */
|
23
|
+
g_string_append_printf(out,
|
24
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
25
|
+
"<office:document xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n" \
|
26
|
+
" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
|
27
|
+
" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
|
28
|
+
" xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
|
29
|
+
" xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
|
30
|
+
" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
|
31
|
+
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
|
32
|
+
" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
|
33
|
+
" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
|
34
|
+
" xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
|
35
|
+
" xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
|
36
|
+
" xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
|
37
|
+
" xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
|
38
|
+
" xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
|
39
|
+
" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
|
40
|
+
" xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
|
41
|
+
" xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"\n" \
|
42
|
+
" xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
|
43
|
+
" xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
|
44
|
+
" xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
|
45
|
+
" xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
|
46
|
+
" xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
|
47
|
+
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
|
48
|
+
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
|
49
|
+
" xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
|
50
|
+
" xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
|
51
|
+
" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
|
52
|
+
" xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
|
53
|
+
" xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
|
54
|
+
" xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
|
55
|
+
" xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
|
56
|
+
" xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
|
57
|
+
" office:version=\"1.2\"\n" \
|
58
|
+
" grddl:transformation=\"http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl\"\n" \
|
59
|
+
" office:mimetype=\"application/vnd.oasis.opendocument.text\">\n");
|
60
|
+
|
61
|
+
/* Font Declarations */
|
62
|
+
g_string_append_printf(out, "<office:font-face-decls>\n" \
|
63
|
+
" <style:font-face style:name=\"Courier New\" svg:font-family=\"'Courier New'\"\n" \
|
64
|
+
" style:font-adornments=\"Regular\"\n" \
|
65
|
+
" style:font-family-generic=\"modern\"\n" \
|
66
|
+
" style:font-pitch=\"fixed\"/>\n" \
|
67
|
+
"</office:font-face-decls>\n");
|
68
|
+
|
69
|
+
/* Append basic style information */
|
70
|
+
g_string_append_printf(out, "<office:styles>\n" \
|
71
|
+
"<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n" \
|
72
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.15in\"" \
|
73
|
+
" fo:text-align=\"justify\" style:justify-single-word=\"false\"/>\n" \
|
74
|
+
" </style:style>\n" \
|
75
|
+
"<style:style style:name=\"Preformatted_20_Text\" style:display-name=\"Preformatted Text\"\n" \
|
76
|
+
" style:family=\"paragraph\"\n" \
|
77
|
+
" style:parent-style-name=\"Standard\"\n" \
|
78
|
+
" style:class=\"html\">\n" \
|
79
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0in\" fo:text-align=\"start\"\n" \
|
80
|
+
" style:justify-single-word=\"false\"/>\n" \
|
81
|
+
" <style:text-properties style:font-name=\"Courier New\" fo:font-size=\"11pt\"\n" \
|
82
|
+
" style:font-name-asian=\"Courier New\"\n" \
|
83
|
+
" style:font-size-asian=\"11pt\"\n" \
|
84
|
+
" style:font-name-complex=\"Courier New\"\n" \
|
85
|
+
" style:font-size-complex=\"11pt\"/>\n" \
|
86
|
+
"</style:style>\n" \
|
87
|
+
"<style:style style:name=\"Source_20_Text\" style:display-name=\"Source Text\"\n" \
|
88
|
+
" style:family=\"text\">\n" \
|
89
|
+
" <style:text-properties style:font-name=\"Courier New\" style:font-name-asian=\"Courier New\"\n" \
|
90
|
+
" style:font-name-complex=\"Courier New\"\n" \
|
91
|
+
" fo:font-size=\"11pt\"/>\n" \
|
92
|
+
"</style:style>\n" \
|
93
|
+
"<style:style style:name=\"List\" style:family=\"paragraph\"\n" \
|
94
|
+
" style:parent-style-name=\"Standard\"\n" \
|
95
|
+
" style:class=\"list\">\n" \
|
96
|
+
" <style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
|
97
|
+
" <style:text-properties style:font-size-asian=\"12pt\"/>\n" \
|
98
|
+
"</style:style>\n" \
|
99
|
+
"<style:style style:name=\"Quotations\" style:family=\"paragraph\"\n" \
|
100
|
+
" style:parent-style-name=\"Standard\"\n" \
|
101
|
+
" style:class=\"html\">\n" \
|
102
|
+
" <style:paragraph-properties fo:margin-left=\"0.3937in\" fo:margin-right=\"0.3937in\" fo:margin-top=\"0in\"\n" \
|
103
|
+
" fo:margin-bottom=\"0.1965in\"\n" \
|
104
|
+
" fo:text-align=\"justify\"" \
|
105
|
+
" style:justify-single-word=\"false\"" \
|
106
|
+
" fo:text-indent=\"0in\"\n" \
|
107
|
+
" style:auto-text-indent=\"false\"/>\n" \
|
108
|
+
"</style:style>\n" \
|
109
|
+
"<style:style style:name=\"Table_20_Heading\" style:display-name=\"Table Heading\"\n" \
|
110
|
+
" style:family=\"paragraph\"\n" \
|
111
|
+
" style:parent-style-name=\"Table_20_Contents\"\n" \
|
112
|
+
" style:class=\"extra\">\n" \
|
113
|
+
" <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"\n" \
|
114
|
+
" text:number-lines=\"false\"\n" \
|
115
|
+
" text:line-number=\"0\"/>\n" \
|
116
|
+
" <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
|
117
|
+
" style:font-weight-complex=\"bold\"/>\n" \
|
118
|
+
"</style:style>\n" \
|
119
|
+
"<style:style style:name=\"Horizontal_20_Line\" style:display-name=\"Horizontal Line\"\n" \
|
120
|
+
" style:family=\"paragraph\"\n" \
|
121
|
+
" style:parent-style-name=\"Standard\"\n" \
|
122
|
+
" style:class=\"html\">\n" \
|
123
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.1965in\"\n" \
|
124
|
+
" style:border-line-width-bottom=\"0.0008in 0.0138in 0.0008in\"\n" \
|
125
|
+
" fo:padding=\"0in\"\n" \
|
126
|
+
" fo:border-left=\"none\"\n" \
|
127
|
+
" fo:border-right=\"none\"\n" \
|
128
|
+
" fo:border-top=\"none\"\n" \
|
129
|
+
" fo:border-bottom=\"0.0154in double #808080\"\n" \
|
130
|
+
" text:number-lines=\"false\"\n" \
|
131
|
+
" text:line-number=\"0\"\n" \
|
132
|
+
" style:join-border=\"false\"/>\n" \
|
133
|
+
" <style:text-properties fo:font-size=\"6pt\" style:font-size-asian=\"6pt\" style:font-size-complex=\"6pt\"/>\n" \
|
134
|
+
"</style:style>\n" \
|
135
|
+
"</office:styles>\n");
|
136
|
+
|
137
|
+
/* Automatic style information */
|
138
|
+
g_string_append_printf(out, "<office:automatic-styles>" \
|
139
|
+
" <style:style style:name=\"MMD-Italic\" style:family=\"text\">\n" \
|
140
|
+
" <style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\"\n" \
|
141
|
+
" style:font-style-complex=\"italic\"/>\n" \
|
142
|
+
" </style:style>\n" \
|
143
|
+
" <style:style style:name=\"MMD-Bold\" style:family=\"text\">\n" \
|
144
|
+
" <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
|
145
|
+
" style:font-weight-complex=\"bold\"/>\n" \
|
146
|
+
" </style:style>\n" \
|
147
|
+
" <style:style style:name=\"StrikeThrough\" style:family=\"text\">\n" \
|
148
|
+
" <style:text-properties style:text-line-through-style=\"solid\"/>\n" \
|
149
|
+
" </style:style>\n" \
|
150
|
+
"<style:style style:name=\"MMD-Table\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
|
151
|
+
" <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.05in\"/>\n" \
|
152
|
+
"</style:style>\n" \
|
153
|
+
"<style:style style:name=\"MMD-Table-Center\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
|
154
|
+
" <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"/>\n" \
|
155
|
+
"</style:style>\n" \
|
156
|
+
"<style:style style:name=\"MMD-Table-Right\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
|
157
|
+
" <style:paragraph-properties fo:text-align=\"right\" style:justify-single-word=\"false\"/>\n" \
|
158
|
+
"</style:style>\n" \
|
159
|
+
"<style:style style:name=\"P2\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
|
160
|
+
" style:list-style-name=\"L2\">\n" \
|
161
|
+
"<style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
|
162
|
+
"</style:style>\n" \
|
163
|
+
"<style:style style:name=\"fr1\" style:family=\"graphic\" style:parent-style-name=\"Frame\">\n" \
|
164
|
+
" <style:graphic-properties style:print-content=\"false\" style:vertical-pos=\"top\"\n" \
|
165
|
+
" style:vertical-rel=\"baseline\"\n" \
|
166
|
+
" fo:padding=\"0in\"\n" \
|
167
|
+
" fo:border=\"none\"\n" \
|
168
|
+
" style:shadow=\"none\"/>\n" \
|
169
|
+
"</style:style>\n" \
|
170
|
+
"</office:automatic-styles>\n" \
|
171
|
+
"<style:style style:name=\"P1\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
|
172
|
+
" style:list-style-name=\"L1\"/>\n" \
|
173
|
+
"<text:list-style style:name=\"L1\">\n" \
|
174
|
+
" <text:list-level-style-bullet />\n" \
|
175
|
+
"</text:list-style>\n" \
|
176
|
+
"<text:list-style style:name=\"L2\">\n" \
|
177
|
+
" <text:list-level-style-number />\n" \
|
178
|
+
"</text:list-style>\n");
|
179
|
+
}
|
180
|
+
|
181
|
+
void print_odf_footer(GString *out) {
|
182
|
+
g_string_append_printf(out, "</office:text>\n</office:body>\n</office:document>");
|
183
|
+
}
|
184
|
+
|
data/ext/odf.h
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#ifndef PARSING_FUNCTIONS_H
|
2
|
+
#define PARSING_FUNCTIONS_H
|
3
|
+
/* parsing_functions.c - Functions for parsing markdown and
|
4
|
+
* freeing element lists. */
|
5
|
+
|
6
|
+
#include "markdown_peg.h"
|
7
|
+
|
8
|
+
/* free_element_list - free list of elements recursively */
|
9
|
+
void free_element_list(element * elt);
|
10
|
+
/* free_element - free element and contents */
|
11
|
+
void free_element(element *elt);
|
12
|
+
|
13
|
+
element * parse_references(char *string, int extensions);
|
14
|
+
element * parse_notes(char *string, int extensions, element *reference_list);
|
15
|
+
element * parse_markdown(char *string, int extensions, element *reference_list, element *note_list);
|
16
|
+
|
17
|
+
#endif
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#ifndef UTILITY_FUNCTIONS_H
|
2
|
+
#define UTILITY_FUNCTIONS_H
|
3
|
+
|
4
|
+
#include <stdbool.h>
|
5
|
+
#include <glib.h>
|
6
|
+
|
7
|
+
#include "markdown_peg.h"
|
8
|
+
|
9
|
+
/* utility_functions.h - List manipulation functions, element
|
10
|
+
* constructors, and macro definitions for leg markdown parser. */
|
11
|
+
|
12
|
+
|
13
|
+
/* cons - cons an element onto a list, returning pointer to new head */
|
14
|
+
element * cons(element *new, element *list);
|
15
|
+
|
16
|
+
/* reverse - reverse a list, returning pointer to new list */
|
17
|
+
element *reverse(element *list);
|
18
|
+
/* concat_string_list - concatenates string contents of list of STR elements.
|
19
|
+
* Frees STR elements as they are added to the concatenation. */
|
20
|
+
GString *concat_string_list(element *list);
|
21
|
+
/**********************************************************************
|
22
|
+
|
23
|
+
Global variables used in parsing
|
24
|
+
|
25
|
+
***********************************************************************/
|
26
|
+
|
27
|
+
extern char *charbuf; /* Buffer of characters to be parsed. */
|
28
|
+
extern element *references; /* List of link references found. */
|
29
|
+
extern element *notes; /* List of footnotes found. */
|
30
|
+
extern element *parse_result; /* Results of parse. */
|
31
|
+
extern int syntax_extensions; /* Syntax extensions selected. */
|
32
|
+
|
33
|
+
/**********************************************************************
|
34
|
+
|
35
|
+
Auxiliary functions for parsing actions.
|
36
|
+
These make it easier to build up data structures (including lists)
|
37
|
+
in the parsing actions.
|
38
|
+
|
39
|
+
***********************************************************************/
|
40
|
+
|
41
|
+
/* mk_element - generic constructor for element */
|
42
|
+
element * mk_element(int key);
|
43
|
+
|
44
|
+
/* mk_str - constructor for STR element */
|
45
|
+
element * mk_str(char *string);
|
46
|
+
|
47
|
+
/* mk_str_from_list - makes STR element by concatenating a
|
48
|
+
* reversed list of strings, adding optional extra newline */
|
49
|
+
element * mk_str_from_list(element *list, bool extra_newline);
|
50
|
+
|
51
|
+
/* mk_list - makes new list with key 'key' and children the reverse of 'lst'.
|
52
|
+
* This is designed to be used with cons to build lists in a parser action.
|
53
|
+
* The reversing is necessary because cons adds to the head of a list. */
|
54
|
+
element * mk_list(int key, element *lst);
|
55
|
+
|
56
|
+
/* mk_link - constructor for LINK element */
|
57
|
+
element * mk_link(element *label, char *url, char *title);
|
58
|
+
|
59
|
+
/* mk_media - constructor for AUDIO and VIDEO element */
|
60
|
+
element * mk_media(element *label, char *source1, char *source2);
|
61
|
+
|
62
|
+
/* extension = returns true if extension is selected */
|
63
|
+
bool extension(int ext);
|
64
|
+
|
65
|
+
/* match_inlines - returns true if inline lists match (case-insensitive...) */
|
66
|
+
bool match_inlines(element *l1, element *l2);
|
67
|
+
|
68
|
+
/* find_reference - return true if link found in references matching label.
|
69
|
+
* 'link' is modified with the matching url and title. */
|
70
|
+
bool find_reference(link *result, element *label);
|
71
|
+
|
72
|
+
/* find_note - return true if note found in notes matching label.
|
73
|
+
if found, 'result' is set to point to matched note. */
|
74
|
+
|
75
|
+
bool find_note(element **result, char *label);
|
76
|
+
|
77
|
+
#endif
|
78
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parkdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
@@ -33,8 +33,12 @@ files:
|
|
33
33
|
- ext/markdown_output.c
|
34
34
|
- ext/markdown_parser.c
|
35
35
|
- ext/markdown_peg.h
|
36
|
+
- ext/odf.c
|
37
|
+
- ext/odf.h
|
36
38
|
- ext/parsing_functions.c
|
39
|
+
- ext/parsing_functions.h
|
37
40
|
- ext/utility_functions.c
|
41
|
+
- ext/utility_functions.h
|
38
42
|
- lib/markdown.rb
|
39
43
|
- lib/peg_markdown.rb
|
40
44
|
- test/MarkdownTest_1.0.3/MarkdownTest.pl
|