piko-fast-lib 0.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.
- checksums.yaml +7 -0
- data/piko-fast-lib.gemspec +11 -0
- data/redcarpet-3.6.1/CHANGELOG.md +487 -0
- data/redcarpet-3.6.1/CONTRIBUTING.md +33 -0
- data/redcarpet-3.6.1/COPYING +20 -0
- data/redcarpet-3.6.1/Gemfile +9 -0
- data/redcarpet-3.6.1/README.markdown +405 -0
- data/redcarpet-3.6.1/Rakefile +60 -0
- data/redcarpet-3.6.1/bin/redcarpet +7 -0
- data/redcarpet-3.6.1/ext/redcarpet/autolink.c +308 -0
- data/redcarpet-3.6.1/ext/redcarpet/autolink.h +55 -0
- data/redcarpet-3.6.1/ext/redcarpet/buffer.c +203 -0
- data/redcarpet-3.6.1/ext/redcarpet/buffer.h +88 -0
- data/redcarpet-3.6.1/ext/redcarpet/extconf.rb +6 -0
- data/redcarpet-3.6.1/ext/redcarpet/houdini.h +51 -0
- data/redcarpet-3.6.1/ext/redcarpet/houdini_href_e.c +124 -0
- data/redcarpet-3.6.1/ext/redcarpet/houdini_html_e.c +104 -0
- data/redcarpet-3.6.1/ext/redcarpet/html.c +869 -0
- data/redcarpet-3.6.1/ext/redcarpet/html.h +83 -0
- data/redcarpet-3.6.1/ext/redcarpet/html_block_names.txt +44 -0
- data/redcarpet-3.6.1/ext/redcarpet/html_blocks.h +222 -0
- data/redcarpet-3.6.1/ext/redcarpet/html_smartypants.c +472 -0
- data/redcarpet-3.6.1/ext/redcarpet/markdown.c +2946 -0
- data/redcarpet-3.6.1/ext/redcarpet/markdown.h +143 -0
- data/redcarpet-3.6.1/ext/redcarpet/rc_markdown.c +194 -0
- data/redcarpet-3.6.1/ext/redcarpet/rc_render.c +601 -0
- data/redcarpet-3.6.1/ext/redcarpet/redcarpet.h +54 -0
- data/redcarpet-3.6.1/ext/redcarpet/stack.c +84 -0
- data/redcarpet-3.6.1/ext/redcarpet/stack.h +48 -0
- data/redcarpet-3.6.1/lib/redcarpet/cli.rb +86 -0
- data/redcarpet-3.6.1/lib/redcarpet/compat.rb +71 -0
- data/redcarpet-3.6.1/lib/redcarpet/render_man.rb +65 -0
- data/redcarpet-3.6.1/lib/redcarpet/render_strip.rb +60 -0
- data/redcarpet-3.6.1/lib/redcarpet.rb +92 -0
- data/redcarpet-3.6.1/redcarpet.gemspec +59 -0
- metadata +74 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015, Vicent Marti
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
* THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
#ifndef HTML_H__
|
|
24
|
+
#define HTML_H__
|
|
25
|
+
|
|
26
|
+
#include "markdown.h"
|
|
27
|
+
#include "buffer.h"
|
|
28
|
+
#include <stdlib.h>
|
|
29
|
+
|
|
30
|
+
#ifdef __cplusplus
|
|
31
|
+
extern "C" {
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
struct html_renderopt {
|
|
35
|
+
struct {
|
|
36
|
+
int current_level;
|
|
37
|
+
int level_offset;
|
|
38
|
+
int nesting_bounds[2];
|
|
39
|
+
} toc_data;
|
|
40
|
+
|
|
41
|
+
unsigned int flags;
|
|
42
|
+
|
|
43
|
+
/* extra callbacks */
|
|
44
|
+
void (*link_attributes)(struct buf *ob, const struct buf *url, void *self);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
typedef enum {
|
|
48
|
+
HTML_SKIP_HTML = (1 << 0),
|
|
49
|
+
HTML_SKIP_STYLE = (1 << 1),
|
|
50
|
+
HTML_SKIP_IMAGES = (1 << 2),
|
|
51
|
+
HTML_SKIP_LINKS = (1 << 3),
|
|
52
|
+
HTML_EXPAND_TABS = (1 << 4),
|
|
53
|
+
HTML_SAFELINK = (1 << 5),
|
|
54
|
+
HTML_TOC = (1 << 6),
|
|
55
|
+
HTML_HARD_WRAP = (1 << 7),
|
|
56
|
+
HTML_USE_XHTML = (1 << 8),
|
|
57
|
+
HTML_ESCAPE = (1 << 9),
|
|
58
|
+
HTML_PRETTIFY = (1 << 10),
|
|
59
|
+
} html_render_mode;
|
|
60
|
+
|
|
61
|
+
typedef enum {
|
|
62
|
+
HTML_TAG_NONE = 0,
|
|
63
|
+
HTML_TAG_OPEN,
|
|
64
|
+
HTML_TAG_CLOSE,
|
|
65
|
+
} html_tag;
|
|
66
|
+
|
|
67
|
+
int
|
|
68
|
+
sdhtml_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagname);
|
|
69
|
+
|
|
70
|
+
extern void
|
|
71
|
+
sdhtml_renderer(struct sd_callbacks *callbacks, struct html_renderopt *options_ptr, unsigned int render_flags);
|
|
72
|
+
|
|
73
|
+
extern void
|
|
74
|
+
sdhtml_toc_renderer(struct sd_callbacks *callbacks, struct html_renderopt *options_ptr, unsigned int render_flags);
|
|
75
|
+
|
|
76
|
+
extern void
|
|
77
|
+
sdhtml_smartypants(struct buf *ob, const uint8_t *text, size_t size);
|
|
78
|
+
|
|
79
|
+
#ifdef __cplusplus
|
|
80
|
+
}
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
#endif
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
abbr
|
|
2
|
+
address
|
|
3
|
+
article
|
|
4
|
+
aside
|
|
5
|
+
audio
|
|
6
|
+
blockquote
|
|
7
|
+
canvas
|
|
8
|
+
center
|
|
9
|
+
dd
|
|
10
|
+
del
|
|
11
|
+
details
|
|
12
|
+
div
|
|
13
|
+
dl
|
|
14
|
+
fieldset
|
|
15
|
+
figcaption
|
|
16
|
+
figure
|
|
17
|
+
footer
|
|
18
|
+
form
|
|
19
|
+
h1
|
|
20
|
+
h2
|
|
21
|
+
h3
|
|
22
|
+
h4
|
|
23
|
+
h5
|
|
24
|
+
h6
|
|
25
|
+
header
|
|
26
|
+
hgroup
|
|
27
|
+
hr
|
|
28
|
+
iframe
|
|
29
|
+
ins
|
|
30
|
+
math
|
|
31
|
+
nav
|
|
32
|
+
noscript
|
|
33
|
+
ol
|
|
34
|
+
output
|
|
35
|
+
p
|
|
36
|
+
pre
|
|
37
|
+
script
|
|
38
|
+
section
|
|
39
|
+
style
|
|
40
|
+
summary
|
|
41
|
+
table
|
|
42
|
+
tfoot
|
|
43
|
+
ul
|
|
44
|
+
video
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/* ANSI-C code produced by gperf version 3.1 */
|
|
2
|
+
/* Command-line: gperf -N find_block_tag -H hash_block_tag -C -c -E --ignore-case html_block_names.txt */
|
|
3
|
+
/* Computed positions: -k'1-2' */
|
|
4
|
+
|
|
5
|
+
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
|
6
|
+
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
|
7
|
+
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
|
8
|
+
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
|
9
|
+
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
|
10
|
+
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
|
11
|
+
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
|
12
|
+
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
|
13
|
+
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
|
14
|
+
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
|
15
|
+
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
|
16
|
+
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
|
17
|
+
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
|
18
|
+
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
|
19
|
+
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
|
20
|
+
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
|
21
|
+
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
|
22
|
+
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
|
23
|
+
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
|
24
|
+
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
|
25
|
+
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
|
26
|
+
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
|
27
|
+
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
|
28
|
+
/* The character set is not based on ISO-646. */
|
|
29
|
+
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
/* maximum key range = 72, duplicates = 0 */
|
|
33
|
+
|
|
34
|
+
#ifndef GPERF_DOWNCASE
|
|
35
|
+
#define GPERF_DOWNCASE 1
|
|
36
|
+
static unsigned char gperf_downcase[256] =
|
|
37
|
+
{
|
|
38
|
+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
39
|
+
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
|
40
|
+
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
|
|
41
|
+
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
|
42
|
+
60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
|
|
43
|
+
107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
|
|
44
|
+
122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
|
|
45
|
+
105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
|
|
46
|
+
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
|
|
47
|
+
135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
|
48
|
+
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
|
|
49
|
+
165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
|
|
50
|
+
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
|
|
51
|
+
195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
|
|
52
|
+
210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
|
|
53
|
+
225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
|
54
|
+
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
|
|
55
|
+
255
|
|
56
|
+
};
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#ifndef GPERF_CASE_STRNCMP
|
|
60
|
+
#define GPERF_CASE_STRNCMP 1
|
|
61
|
+
static int
|
|
62
|
+
gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n)
|
|
63
|
+
{
|
|
64
|
+
for (; n > 0;)
|
|
65
|
+
{
|
|
66
|
+
unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
|
|
67
|
+
unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
|
|
68
|
+
if (c1 != 0 && c1 == c2)
|
|
69
|
+
{
|
|
70
|
+
n--;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
return (int)c1 - (int)c2;
|
|
74
|
+
}
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
#ifdef __GNUC__
|
|
80
|
+
__inline
|
|
81
|
+
#else
|
|
82
|
+
#ifdef __cplusplus
|
|
83
|
+
inline
|
|
84
|
+
#endif
|
|
85
|
+
#endif
|
|
86
|
+
static unsigned int
|
|
87
|
+
hash_block_tag (register const char *str, register size_t len)
|
|
88
|
+
{
|
|
89
|
+
static const unsigned char asso_values[] =
|
|
90
|
+
{
|
|
91
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
92
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
93
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
94
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
95
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
96
|
+
16, 55, 50, 45, 40, 5, 73, 73, 73, 73,
|
|
97
|
+
73, 73, 73, 73, 73, 20, 15, 25, 0, 45,
|
|
98
|
+
0, 30, 10, 0, 5, 73, 73, 0, 15, 35,
|
|
99
|
+
0, 73, 73, 15, 20, 10, 10, 73, 73, 73,
|
|
100
|
+
73, 73, 73, 73, 73, 73, 73, 20, 15, 25,
|
|
101
|
+
0, 45, 0, 30, 10, 0, 5, 73, 73, 0,
|
|
102
|
+
15, 35, 0, 73, 73, 15, 20, 10, 10, 73,
|
|
103
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
104
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
105
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
106
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
107
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
108
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
109
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
110
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
111
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
112
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
113
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
114
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
115
|
+
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
|
|
116
|
+
73, 73, 73, 73, 73, 73, 73
|
|
117
|
+
};
|
|
118
|
+
register unsigned int hval = len;
|
|
119
|
+
|
|
120
|
+
switch (hval)
|
|
121
|
+
{
|
|
122
|
+
default:
|
|
123
|
+
hval += asso_values[(unsigned char)str[1]+1];
|
|
124
|
+
/*FALLTHROUGH*/
|
|
125
|
+
case 1:
|
|
126
|
+
hval += asso_values[(unsigned char)str[0]];
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
return hval;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const char *
|
|
133
|
+
find_block_tag (register const char *str, register size_t len)
|
|
134
|
+
{
|
|
135
|
+
enum
|
|
136
|
+
{
|
|
137
|
+
TOTAL_KEYWORDS = 44,
|
|
138
|
+
MIN_WORD_LENGTH = 1,
|
|
139
|
+
MAX_WORD_LENGTH = 10,
|
|
140
|
+
MIN_HASH_VALUE = 1,
|
|
141
|
+
MAX_HASH_VALUE = 72
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
static const char * const wordlist[] =
|
|
145
|
+
{
|
|
146
|
+
"",
|
|
147
|
+
"p",
|
|
148
|
+
"dl",
|
|
149
|
+
"del",
|
|
150
|
+
"form",
|
|
151
|
+
"",
|
|
152
|
+
"footer",
|
|
153
|
+
"details",
|
|
154
|
+
"div",
|
|
155
|
+
"", "",
|
|
156
|
+
"figure",
|
|
157
|
+
"ul",
|
|
158
|
+
"fieldset",
|
|
159
|
+
"",
|
|
160
|
+
"figcaption",
|
|
161
|
+
"header",
|
|
162
|
+
"h6",
|
|
163
|
+
"pre",
|
|
164
|
+
"math",
|
|
165
|
+
"video",
|
|
166
|
+
"script",
|
|
167
|
+
"section",
|
|
168
|
+
"noscript",
|
|
169
|
+
"",
|
|
170
|
+
"blockquote",
|
|
171
|
+
"hgroup",
|
|
172
|
+
"hr",
|
|
173
|
+
"h1",
|
|
174
|
+
"",
|
|
175
|
+
"style",
|
|
176
|
+
"center",
|
|
177
|
+
"summary",
|
|
178
|
+
"nav",
|
|
179
|
+
"",
|
|
180
|
+
"audio",
|
|
181
|
+
"iframe",
|
|
182
|
+
"ol",
|
|
183
|
+
"ins",
|
|
184
|
+
"",
|
|
185
|
+
"table",
|
|
186
|
+
"",
|
|
187
|
+
"article",
|
|
188
|
+
"", "",
|
|
189
|
+
"aside",
|
|
190
|
+
"canvas",
|
|
191
|
+
"dd",
|
|
192
|
+
"",
|
|
193
|
+
"abbr",
|
|
194
|
+
"",
|
|
195
|
+
"output",
|
|
196
|
+
"h5",
|
|
197
|
+
"", "",
|
|
198
|
+
"tfoot",
|
|
199
|
+
"",
|
|
200
|
+
"h4",
|
|
201
|
+
"", "", "", "",
|
|
202
|
+
"h3",
|
|
203
|
+
"", "", "", "",
|
|
204
|
+
"h2",
|
|
205
|
+
"", "", "", "",
|
|
206
|
+
"address"
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
|
210
|
+
{
|
|
211
|
+
register unsigned int key = hash_block_tag (str, len);
|
|
212
|
+
|
|
213
|
+
if (key <= MAX_HASH_VALUE)
|
|
214
|
+
{
|
|
215
|
+
register const char *s = wordlist[key];
|
|
216
|
+
|
|
217
|
+
if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
|
|
218
|
+
return s;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return 0;
|
|
222
|
+
}
|