parkdown-libertree 1.4.26 → 1.4.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67568f585e1d910802244c5255e7623a5ecd24da
|
4
|
+
data.tar.gz: 0ec503a6c92fa3a19f5bfd76109d807cc73c83fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4591d8bdeb2a6cbe6f1743fbb3688b0a29f16a787535ab6fd3763ea128483ce695cca552a41a6e03bb4cdb00353d751167f36306d0197053e803f8127e37d3bb
|
7
|
+
data.tar.gz: 21d02473389308bd96f6d5a6b52b43d09b7fadd826c89b3ad5eafac7acf1c85a260169846a7f41144856a9a42ce06cac4734b79dc618a1253b4975b898f4f24b
|
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-libertree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-09-
|
13
|
+
date: 2016-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: ''
|
16
16
|
email: spam@elephly.net
|
@@ -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
|