BBRedCloth 0.8.0

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.
Files changed (51) hide show
  1. data/BBRedCloth.gemspec +36 -0
  2. data/CHANGELOG +123 -0
  3. data/COPYING +18 -0
  4. data/Manifest +45 -0
  5. data/README.textile +149 -0
  6. data/Rakefile +247 -0
  7. data/bin/bbredcloth +34 -0
  8. data/ext/mingw-rbconfig.rb +176 -0
  9. data/ext/redcloth_scan/extconf.rb +9 -0
  10. data/ext/redcloth_scan/redcloth.h +196 -0
  11. data/ext/redcloth_scan/redcloth_attributes.c +655 -0
  12. data/ext/redcloth_scan/redcloth_bbcode.c +2457 -0
  13. data/ext/redcloth_scan/redcloth_bbcode_inline.c +1890 -0
  14. data/ext/redcloth_scan/redcloth_inline.c +12387 -0
  15. data/ext/redcloth_scan/redcloth_scan.c +10848 -0
  16. data/extras/ragel_profiler.rb +73 -0
  17. data/lib/case_sensitive_require/RedCloth.rb +6 -0
  18. data/lib/redcloth/erb_extension.rb +27 -0
  19. data/lib/redcloth/formatters/base.rb +57 -0
  20. data/lib/redcloth/formatters/html.rb +487 -0
  21. data/lib/redcloth/formatters/latex.rb +249 -0
  22. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  23. data/lib/redcloth/textile_doc.rb +196 -0
  24. data/lib/redcloth/version.rb +28 -0
  25. data/lib/redcloth.rb +37 -0
  26. data/setup.rb +1585 -0
  27. data/test/basic.yml +933 -0
  28. data/test/code.yml +229 -0
  29. data/test/definitions.yml +82 -0
  30. data/test/extra_whitespace.yml +64 -0
  31. data/test/filter_html.yml +177 -0
  32. data/test/filter_pba.yml +20 -0
  33. data/test/helper.rb +109 -0
  34. data/test/html.yml +313 -0
  35. data/test/images.yml +254 -0
  36. data/test/instiki.yml +38 -0
  37. data/test/links.yml +275 -0
  38. data/test/lists.yml +283 -0
  39. data/test/poignant.yml +89 -0
  40. data/test/sanitize_html.yml +42 -0
  41. data/test/table.yml +267 -0
  42. data/test/test_custom_tags.rb +46 -0
  43. data/test/test_erb.rb +13 -0
  44. data/test/test_extensions.rb +31 -0
  45. data/test/test_formatters.rb +24 -0
  46. data/test/test_parser.rb +73 -0
  47. data/test/test_restrictions.rb +61 -0
  48. data/test/textism.yml +484 -0
  49. data/test/threshold.yml +772 -0
  50. data/test/validate_fixtures.rb +74 -0
  51. metadata +139 -0
@@ -0,0 +1,655 @@
1
+
2
+ #line 1 "ext/redcloth_scan/redcloth_attributes.c.rl"
3
+ /*
4
+ * redcloth_attributes.c.rl
5
+ *
6
+ * Copyright (C) 2008 Jason Garber
7
+ */
8
+ #include <ruby.h>
9
+ #include "redcloth.h"
10
+
11
+
12
+ #line 15 "ext/redcloth_scan/redcloth_attributes.c.rl"
13
+
14
+
15
+
16
+ #line 17 "ext/redcloth_scan/redcloth_attributes.c"
17
+ static const char _redcloth_attributes_actions[] = {
18
+ 0, 1, 0, 1, 3, 1, 4, 1,
19
+ 5, 1, 6, 1, 7, 1, 9, 1,
20
+ 10, 1, 12, 1, 13, 1, 16, 1,
21
+ 17, 1, 22, 1, 23, 1, 24, 2,
22
+ 0, 9, 2, 2, 15, 2, 8, 20,
23
+ 2, 9, 21, 2, 10, 11, 2, 13,
24
+ 0, 2, 13, 1, 2, 13, 4, 2,
25
+ 13, 5, 2, 13, 6, 2, 13, 7,
26
+ 2, 13, 14, 2, 13, 18, 2, 13,
27
+ 19, 3, 8, 9, 20, 3, 13, 0,
28
+ 14, 3, 13, 0, 18, 3, 13, 0,
29
+ 19, 3, 13, 1, 19, 3, 13, 4,
30
+ 14, 3, 13, 4, 18, 3, 13, 4,
31
+ 19
32
+ };
33
+
34
+ static const short _redcloth_attributes_key_offsets[] = {
35
+ 0, 0, 6, 11, 13, 14, 15, 23,
36
+ 29, 34, 38, 46, 53, 60, 66, 72,
37
+ 73, 80, 86, 87, 94, 100, 108, 115,
38
+ 122, 128, 134, 139, 145, 153, 160, 167,
39
+ 173, 179, 186, 192, 199, 205, 212, 218,
40
+ 225, 231, 233, 235, 236, 237, 244, 250,
41
+ 255, 263, 270, 277, 283, 284, 291, 297,
42
+ 298, 305, 311, 312, 313, 320, 326, 334,
43
+ 342, 348, 356, 364, 371, 378, 388, 395,
44
+ 402, 409, 416, 423, 430, 437, 447, 453,
45
+ 461, 469, 476, 483, 493, 500, 507, 514,
46
+ 521, 528, 535, 542, 549, 556, 559, 565,
47
+ 573, 581, 588, 595, 604, 611, 618, 625
48
+ };
49
+
50
+ static const char _redcloth_attributes_trans_keys[] = {
51
+ 0, 9, 10, 32, 11, 13, 0, 9,
52
+ 32, 10, 13, 35, 41, 41, 41, 0,
53
+ 32, 40, 46, 91, 123, 9, 13, 0,
54
+ 9, 10, 32, 11, 13, 0, 9, 32,
55
+ 10, 13, 0, 32, 9, 13, 0, 9,
56
+ 10, 32, 35, 41, 11, 13, 0, 9,
57
+ 32, 35, 41, 10, 13, 0, 9, 10,
58
+ 32, 41, 11, 13, 0, 9, 32, 41,
59
+ 10, 13, 0, 9, 10, 32, 11, 13,
60
+ 93, 0, 9, 10, 32, 93, 11, 13,
61
+ 0, 9, 32, 93, 10, 13, 125, 0,
62
+ 9, 10, 32, 125, 11, 13, 0, 9,
63
+ 32, 125, 10, 13, 0, 9, 10, 32,
64
+ 35, 41, 11, 13, 0, 9, 32, 35,
65
+ 41, 10, 13, 0, 9, 10, 32, 41,
66
+ 11, 13, 0, 9, 32, 41, 10, 13,
67
+ 0, 9, 10, 32, 11, 13, 0, 9,
68
+ 32, 10, 13, 0, 9, 10, 32, 11,
69
+ 13, 0, 9, 10, 32, 35, 41, 11,
70
+ 13, 0, 9, 32, 35, 41, 10, 13,
71
+ 0, 9, 10, 32, 41, 11, 13, 0,
72
+ 9, 32, 41, 10, 13, 0, 9, 10,
73
+ 32, 11, 13, 0, 9, 10, 32, 93,
74
+ 11, 13, 0, 9, 32, 93, 10, 13,
75
+ 0, 9, 10, 32, 125, 11, 13, 0,
76
+ 9, 32, 125, 10, 13, 0, 9, 10,
77
+ 32, 93, 11, 13, 0, 9, 32, 93,
78
+ 10, 13, 0, 9, 10, 32, 125, 11,
79
+ 13, 0, 9, 32, 125, 10, 13, 35,
80
+ 41, 35, 41, 41, 41, 0, 32, 40,
81
+ 91, 123, 9, 13, 0, 9, 10, 32,
82
+ 11, 13, 0, 9, 32, 10, 13, 0,
83
+ 9, 10, 32, 35, 41, 11, 13, 0,
84
+ 9, 32, 35, 41, 10, 13, 0, 9,
85
+ 10, 32, 41, 11, 13, 0, 9, 32,
86
+ 41, 10, 13, 93, 0, 9, 10, 32,
87
+ 93, 11, 13, 0, 9, 32, 93, 10,
88
+ 13, 125, 0, 9, 10, 32, 125, 11,
89
+ 13, 0, 9, 32, 125, 10, 13, 93,
90
+ 125, 0, 32, 40, 91, 123, 9, 13,
91
+ 0, 9, 10, 32, 11, 13, 0, 9,
92
+ 10, 32, 35, 41, 11, 13, 0, 9,
93
+ 10, 32, 35, 41, 11, 13, 0, 9,
94
+ 10, 32, 11, 13, 0, 9, 10, 32,
95
+ 35, 41, 11, 13, 0, 9, 10, 32,
96
+ 35, 41, 11, 13, 0, 9, 10, 32,
97
+ 41, 11, 13, 0, 9, 10, 32, 41,
98
+ 11, 13, 0, 9, 10, 32, 40, 46,
99
+ 91, 123, 11, 13, 0, 9, 10, 32,
100
+ 46, 11, 13, 0, 9, 10, 32, 93,
101
+ 11, 13, 0, 9, 10, 32, 93, 11,
102
+ 13, 0, 9, 10, 32, 125, 11, 13,
103
+ 0, 9, 10, 32, 125, 11, 13, 0,
104
+ 9, 10, 32, 41, 11, 13, 0, 9,
105
+ 10, 32, 41, 11, 13, 0, 9, 10,
106
+ 32, 40, 46, 91, 123, 11, 13, 0,
107
+ 9, 10, 32, 11, 13, 0, 9, 10,
108
+ 32, 35, 41, 11, 13, 0, 9, 10,
109
+ 32, 35, 41, 11, 13, 0, 9, 10,
110
+ 32, 41, 11, 13, 0, 9, 10, 32,
111
+ 41, 11, 13, 0, 9, 10, 32, 40,
112
+ 46, 91, 123, 11, 13, 0, 9, 10,
113
+ 32, 46, 11, 13, 0, 9, 10, 32,
114
+ 93, 11, 13, 0, 9, 10, 32, 93,
115
+ 11, 13, 0, 9, 10, 32, 125, 11,
116
+ 13, 0, 9, 10, 32, 125, 11, 13,
117
+ 0, 9, 10, 32, 93, 11, 13, 0,
118
+ 9, 10, 32, 93, 11, 13, 0, 9,
119
+ 10, 32, 125, 11, 13, 0, 9, 10,
120
+ 32, 125, 11, 13, 40, 91, 123, 0,
121
+ 9, 10, 32, 11, 13, 0, 9, 10,
122
+ 32, 35, 41, 11, 13, 0, 9, 10,
123
+ 32, 35, 41, 11, 13, 0, 9, 10,
124
+ 32, 41, 11, 13, 0, 9, 10, 32,
125
+ 41, 11, 13, 0, 9, 10, 32, 40,
126
+ 91, 123, 11, 13, 0, 9, 10, 32,
127
+ 93, 11, 13, 0, 9, 10, 32, 93,
128
+ 11, 13, 0, 9, 10, 32, 125, 11,
129
+ 13, 0, 9, 10, 32, 125, 11, 13,
130
+ 0
131
+ };
132
+
133
+ static const char _redcloth_attributes_single_lengths[] = {
134
+ 0, 4, 3, 2, 1, 1, 6, 4,
135
+ 3, 2, 6, 5, 5, 4, 4, 1,
136
+ 5, 4, 1, 5, 4, 6, 5, 5,
137
+ 4, 4, 3, 4, 6, 5, 5, 4,
138
+ 4, 5, 4, 5, 4, 5, 4, 5,
139
+ 4, 2, 2, 1, 1, 5, 4, 3,
140
+ 6, 5, 5, 4, 1, 5, 4, 1,
141
+ 5, 4, 1, 1, 5, 4, 6, 6,
142
+ 4, 6, 6, 5, 5, 8, 5, 5,
143
+ 5, 5, 5, 5, 5, 8, 4, 6,
144
+ 6, 5, 5, 8, 5, 5, 5, 5,
145
+ 5, 5, 5, 5, 5, 3, 4, 6,
146
+ 6, 5, 5, 7, 5, 5, 5, 5
147
+ };
148
+
149
+ static const char _redcloth_attributes_range_lengths[] = {
150
+ 0, 1, 1, 0, 0, 0, 1, 1,
151
+ 1, 1, 1, 1, 1, 1, 1, 0,
152
+ 1, 1, 0, 1, 1, 1, 1, 1,
153
+ 1, 1, 1, 1, 1, 1, 1, 1,
154
+ 1, 1, 1, 1, 1, 1, 1, 1,
155
+ 1, 0, 0, 0, 0, 1, 1, 1,
156
+ 1, 1, 1, 1, 0, 1, 1, 0,
157
+ 1, 1, 0, 0, 1, 1, 1, 1,
158
+ 1, 1, 1, 1, 1, 1, 1, 1,
159
+ 1, 1, 1, 1, 1, 1, 1, 1,
160
+ 1, 1, 1, 1, 1, 1, 1, 1,
161
+ 1, 1, 1, 1, 1, 0, 1, 1,
162
+ 1, 1, 1, 1, 1, 1, 1, 1
163
+ };
164
+
165
+ static const short _redcloth_attributes_index_offsets[] = {
166
+ 0, 0, 6, 11, 14, 16, 18, 26,
167
+ 32, 37, 41, 49, 56, 63, 69, 75,
168
+ 77, 84, 90, 92, 99, 105, 113, 120,
169
+ 127, 133, 139, 144, 150, 158, 165, 172,
170
+ 178, 184, 191, 197, 204, 210, 217, 223,
171
+ 230, 236, 239, 242, 244, 246, 253, 259,
172
+ 264, 272, 279, 286, 292, 294, 301, 307,
173
+ 309, 316, 322, 324, 326, 333, 339, 347,
174
+ 355, 361, 369, 377, 384, 391, 401, 408,
175
+ 415, 422, 429, 436, 443, 450, 460, 466,
176
+ 474, 482, 489, 496, 506, 513, 520, 527,
177
+ 534, 541, 548, 555, 562, 569, 573, 579,
178
+ 587, 595, 602, 609, 618, 625, 632, 639
179
+ };
180
+
181
+ static const unsigned char _redcloth_attributes_indicies[] = {
182
+ 0, 2, 3, 2, 0, 1, 0, 2,
183
+ 2, 0, 1, 6, 7, 5, 4, 8,
184
+ 10, 9, 4, 12, 13, 14, 15, 16,
185
+ 4, 11, 17, 19, 20, 19, 17, 18,
186
+ 17, 19, 19, 17, 18, 4, 12, 4,
187
+ 11, 5, 22, 23, 22, 24, 25, 5,
188
+ 21, 5, 22, 22, 24, 25, 5, 21,
189
+ 9, 27, 28, 27, 29, 9, 26, 9,
190
+ 27, 27, 29, 9, 26, 17, 19, 20,
191
+ 30, 17, 11, 32, 31, 31, 34, 35,
192
+ 34, 36, 31, 33, 31, 34, 34, 36,
193
+ 31, 33, 38, 37, 37, 40, 41, 40,
194
+ 42, 37, 39, 37, 40, 40, 42, 37,
195
+ 39, 5, 44, 45, 44, 46, 47, 5,
196
+ 43, 5, 44, 44, 46, 47, 5, 43,
197
+ 9, 49, 50, 49, 51, 9, 48, 9,
198
+ 49, 49, 51, 9, 48, 17, 53, 54,
199
+ 53, 17, 52, 17, 53, 53, 17, 52,
200
+ 0, 2, 3, 56, 0, 55, 5, 58,
201
+ 59, 58, 60, 61, 5, 57, 5, 58,
202
+ 58, 60, 61, 5, 57, 9, 63, 64,
203
+ 63, 65, 9, 62, 9, 63, 63, 65,
204
+ 9, 62, 17, 53, 54, 66, 17, 55,
205
+ 31, 68, 69, 68, 70, 31, 67, 31,
206
+ 68, 68, 70, 31, 67, 37, 72, 73,
207
+ 72, 74, 37, 71, 37, 72, 72, 74,
208
+ 37, 71, 31, 76, 77, 76, 78, 31,
209
+ 75, 31, 76, 76, 78, 31, 75, 37,
210
+ 80, 81, 80, 82, 37, 79, 37, 80,
211
+ 80, 82, 37, 79, 84, 85, 83, 88,
212
+ 89, 87, 86, 90, 92, 91, 86, 86,
213
+ 94, 95, 96, 86, 93, 97, 99, 100,
214
+ 99, 97, 98, 97, 99, 99, 97, 98,
215
+ 87, 102, 103, 102, 104, 105, 87, 101,
216
+ 87, 102, 102, 104, 105, 87, 101, 91,
217
+ 107, 108, 107, 109, 91, 106, 91, 107,
218
+ 107, 109, 91, 106, 111, 110, 110, 113,
219
+ 114, 113, 115, 110, 112, 110, 113, 113,
220
+ 115, 110, 112, 117, 116, 116, 119, 120,
221
+ 119, 121, 116, 118, 116, 119, 119, 121,
222
+ 116, 118, 123, 122, 123, 124, 123, 123,
223
+ 126, 127, 128, 123, 125, 129, 2, 3,
224
+ 2, 129, 1, 131, 132, 133, 132, 134,
225
+ 135, 131, 130, 136, 44, 45, 44, 46,
226
+ 47, 136, 43, 137, 19, 20, 19, 137,
227
+ 18, 139, 140, 141, 140, 142, 143, 139,
228
+ 138, 5, 22, 23, 22, 24, 25, 5,
229
+ 21, 8, 145, 146, 145, 18, 8, 144,
230
+ 9, 27, 28, 27, 29, 9, 26, 137,
231
+ 19, 20, 30, 13, 14, 15, 16, 137,
232
+ 11, 137, 19, 20, 30, 14, 137, 11,
233
+ 148, 149, 150, 149, 18, 148, 147, 31,
234
+ 34, 35, 34, 36, 31, 33, 152, 153,
235
+ 154, 153, 18, 152, 151, 37, 40, 41,
236
+ 40, 42, 37, 39, 156, 157, 158, 157,
237
+ 1, 156, 155, 159, 49, 50, 49, 51,
238
+ 159, 48, 129, 2, 3, 56, 160, 161,
239
+ 162, 163, 129, 55, 164, 53, 54, 53,
240
+ 164, 52, 131, 166, 167, 166, 168, 169,
241
+ 131, 165, 136, 58, 59, 58, 60, 61,
242
+ 136, 57, 156, 171, 172, 171, 52, 156,
243
+ 170, 159, 63, 64, 63, 65, 159, 62,
244
+ 164, 53, 54, 66, 160, 161, 162, 163,
245
+ 164, 55, 164, 53, 54, 66, 161, 164,
246
+ 55, 174, 175, 176, 175, 52, 174, 173,
247
+ 177, 68, 69, 68, 70, 177, 67, 179,
248
+ 180, 181, 180, 52, 179, 178, 182, 72,
249
+ 73, 72, 74, 182, 71, 174, 184, 185,
250
+ 184, 1, 174, 183, 177, 76, 77, 76,
251
+ 78, 177, 75, 179, 187, 188, 187, 1,
252
+ 179, 186, 182, 80, 81, 80, 82, 182,
253
+ 79, 189, 190, 191, 123, 192, 99, 100,
254
+ 99, 192, 98, 83, 194, 195, 194, 196,
255
+ 197, 83, 193, 87, 102, 103, 102, 104,
256
+ 105, 87, 101, 90, 199, 200, 199, 98,
257
+ 90, 198, 91, 107, 108, 107, 109, 91,
258
+ 106, 192, 99, 100, 99, 94, 95, 96,
259
+ 192, 93, 122, 202, 203, 202, 98, 122,
260
+ 201, 110, 113, 114, 113, 115, 110, 112,
261
+ 124, 205, 206, 205, 98, 124, 204, 116,
262
+ 119, 120, 119, 121, 116, 118, 0
263
+ };
264
+
265
+ static const char _redcloth_attributes_trans_targs[] = {
266
+ 60, 61, 1, 2, 60, 3, 4, 6,
267
+ 5, 5, 6, 64, 9, 65, 70, 71,
268
+ 73, 60, 64, 7, 8, 66, 10, 11,
269
+ 67, 69, 68, 12, 13, 69, 14, 15,
270
+ 6, 72, 16, 17, 69, 18, 6, 74,
271
+ 19, 20, 69, 63, 21, 22, 75, 77,
272
+ 76, 23, 24, 77, 78, 25, 26, 78,
273
+ 27, 80, 28, 29, 81, 83, 82, 30,
274
+ 31, 83, 32, 86, 33, 34, 83, 88,
275
+ 35, 36, 83, 90, 37, 38, 77, 92,
276
+ 39, 40, 77, 42, 43, 45, 93, 42,
277
+ 43, 45, 44, 44, 45, 94, 95, 100,
278
+ 102, 93, 94, 46, 47, 96, 48, 49,
279
+ 97, 99, 98, 50, 51, 99, 52, 45,
280
+ 101, 53, 54, 99, 55, 45, 103, 56,
281
+ 57, 99, 52, 0, 55, 61, 62, 89,
282
+ 91, 60, 63, 3, 21, 22, 75, 77,
283
+ 3, 60, 66, 3, 10, 11, 67, 69,
284
+ 68, 12, 13, 72, 15, 16, 17, 74,
285
+ 18, 19, 20, 76, 5, 23, 24, 5,
286
+ 79, 84, 85, 87, 60, 80, 28, 29,
287
+ 81, 83, 82, 30, 31, 86, 15, 33,
288
+ 34, 15, 88, 18, 35, 36, 18, 90,
289
+ 37, 38, 92, 39, 40, 41, 58, 59,
290
+ 93, 96, 48, 49, 97, 99, 98, 50,
291
+ 51, 101, 53, 54, 103, 56, 57
292
+ };
293
+
294
+ static const char _redcloth_attributes_trans_actions[] = {
295
+ 27, 19, 0, 0, 29, 0, 5, 5,
296
+ 1, 0, 7, 46, 0, 81, 46, 81,
297
+ 81, 25, 19, 0, 0, 67, 0, 0,
298
+ 97, 52, 67, 0, 0, 55, 0, 0,
299
+ 9, 67, 0, 0, 58, 0, 11, 67,
300
+ 0, 0, 61, 70, 0, 0, 101, 52,
301
+ 70, 0, 0, 55, 19, 0, 0, 46,
302
+ 0, 67, 0, 0, 97, 52, 67, 0,
303
+ 0, 55, 0, 67, 0, 0, 58, 67,
304
+ 0, 0, 61, 70, 0, 0, 58, 70,
305
+ 0, 0, 61, 1, 0, 0, 23, 0,
306
+ 5, 5, 1, 0, 7, 46, 77, 77,
307
+ 77, 21, 19, 0, 0, 64, 0, 0,
308
+ 93, 52, 64, 0, 0, 55, 0, 9,
309
+ 64, 0, 0, 58, 0, 11, 64, 0,
310
+ 0, 61, 1, 0, 1, 49, 89, 89,
311
+ 89, 40, 85, 31, 1, 1, 70, 19,
312
+ 13, 37, 81, 1, 1, 1, 67, 19,
313
+ 81, 1, 1, 81, 1, 1, 1, 81,
314
+ 1, 1, 1, 85, 31, 1, 1, 13,
315
+ 81, 46, 81, 81, 73, 81, 1, 1,
316
+ 67, 19, 81, 1, 1, 81, 31, 1,
317
+ 1, 13, 81, 31, 1, 1, 13, 85,
318
+ 1, 1, 85, 1, 1, 3, 3, 3,
319
+ 34, 77, 1, 1, 64, 19, 77, 1,
320
+ 1, 77, 1, 1, 77, 1, 1
321
+ };
322
+
323
+ static const char _redcloth_attributes_to_state_actions[] = {
324
+ 0, 0, 0, 0, 0, 0, 0, 0,
325
+ 0, 0, 0, 0, 0, 0, 0, 0,
326
+ 0, 0, 0, 0, 0, 0, 0, 0,
327
+ 0, 0, 0, 0, 0, 0, 0, 0,
328
+ 0, 0, 0, 0, 0, 0, 0, 0,
329
+ 0, 0, 0, 0, 0, 0, 0, 0,
330
+ 0, 0, 0, 0, 0, 0, 0, 0,
331
+ 0, 0, 0, 0, 15, 0, 0, 0,
332
+ 0, 0, 0, 0, 0, 0, 0, 0,
333
+ 0, 0, 0, 0, 0, 0, 0, 0,
334
+ 0, 0, 0, 0, 0, 0, 0, 0,
335
+ 0, 0, 0, 0, 0, 43, 0, 0,
336
+ 0, 0, 0, 0, 0, 0, 0, 0
337
+ };
338
+
339
+ static const char _redcloth_attributes_from_state_actions[] = {
340
+ 0, 0, 0, 0, 0, 0, 0, 0,
341
+ 0, 0, 0, 0, 0, 0, 0, 0,
342
+ 0, 0, 0, 0, 0, 0, 0, 0,
343
+ 0, 0, 0, 0, 0, 0, 0, 0,
344
+ 0, 0, 0, 0, 0, 0, 0, 0,
345
+ 0, 0, 0, 0, 0, 0, 0, 0,
346
+ 0, 0, 0, 0, 0, 0, 0, 0,
347
+ 0, 0, 0, 0, 17, 0, 0, 0,
348
+ 0, 0, 0, 0, 0, 0, 0, 0,
349
+ 0, 0, 0, 0, 0, 0, 0, 0,
350
+ 0, 0, 0, 0, 0, 0, 0, 0,
351
+ 0, 0, 0, 0, 0, 17, 0, 0,
352
+ 0, 0, 0, 0, 0, 0, 0, 0
353
+ };
354
+
355
+ static const short _redcloth_attributes_eof_trans[] = {
356
+ 0, 1, 1, 5, 5, 5, 5, 18,
357
+ 18, 5, 18, 18, 18, 18, 18, 5,
358
+ 18, 18, 5, 18, 18, 1, 1, 1,
359
+ 1, 18, 18, 1, 18, 18, 18, 18,
360
+ 18, 18, 18, 18, 18, 1, 1, 1,
361
+ 1, 0, 87, 87, 87, 87, 98, 98,
362
+ 98, 98, 98, 98, 87, 98, 98, 87,
363
+ 98, 98, 0, 0, 0, 130, 130, 130,
364
+ 138, 138, 138, 138, 138, 138, 138, 138,
365
+ 138, 138, 138, 130, 130, 130, 165, 165,
366
+ 165, 165, 165, 165, 165, 165, 165, 165,
367
+ 165, 130, 130, 130, 130, 0, 193, 193,
368
+ 193, 193, 193, 193, 193, 193, 193, 193
369
+ };
370
+
371
+ static const int redcloth_attributes_start = 60;
372
+ static const int redcloth_attributes_error = 0;
373
+
374
+ static const int redcloth_attributes_en_inline = 93;
375
+ static const int redcloth_attributes_en_link_says = 60;
376
+
377
+
378
+ #line 18 "ext/redcloth_scan/redcloth_attributes.c.rl"
379
+
380
+
381
+ VALUE
382
+ redcloth_attribute_parser(machine, self, p, pe)
383
+ int machine;
384
+ VALUE self;
385
+ char *p, *pe;
386
+ {
387
+ int cs, act;
388
+ char *ts, *te, *reg, *bck, *eof;
389
+ VALUE regs = rb_hash_new();
390
+ VALUE buf = Qnil;
391
+
392
+
393
+ #line 394 "ext/redcloth_scan/redcloth_attributes.c"
394
+ {
395
+ cs = redcloth_attributes_start;
396
+ ts = 0;
397
+ te = 0;
398
+ act = 0;
399
+ }
400
+
401
+ #line 32 "ext/redcloth_scan/redcloth_attributes.c.rl"
402
+
403
+ cs = machine;
404
+
405
+
406
+ #line 407 "ext/redcloth_scan/redcloth_attributes.c"
407
+ {
408
+ int _klen;
409
+ unsigned int _trans;
410
+ const char *_acts;
411
+ unsigned int _nacts;
412
+ const char *_keys;
413
+
414
+ if ( p == pe )
415
+ goto _test_eof;
416
+ if ( cs == 0 )
417
+ goto _out;
418
+ _resume:
419
+ _acts = _redcloth_attributes_actions + _redcloth_attributes_from_state_actions[cs];
420
+ _nacts = (unsigned int) *_acts++;
421
+ while ( _nacts-- > 0 ) {
422
+ switch ( *_acts++ ) {
423
+ case 12:
424
+ #line 1 "ext/redcloth_scan/redcloth_attributes.c.rl"
425
+ {ts = p;}
426
+ break;
427
+ #line 428 "ext/redcloth_scan/redcloth_attributes.c"
428
+ }
429
+ }
430
+
431
+ _keys = _redcloth_attributes_trans_keys + _redcloth_attributes_key_offsets[cs];
432
+ _trans = _redcloth_attributes_index_offsets[cs];
433
+
434
+ _klen = _redcloth_attributes_single_lengths[cs];
435
+ if ( _klen > 0 ) {
436
+ const char *_lower = _keys;
437
+ const char *_mid;
438
+ const char *_upper = _keys + _klen - 1;
439
+ while (1) {
440
+ if ( _upper < _lower )
441
+ break;
442
+
443
+ _mid = _lower + ((_upper-_lower) >> 1);
444
+ if ( (*p) < *_mid )
445
+ _upper = _mid - 1;
446
+ else if ( (*p) > *_mid )
447
+ _lower = _mid + 1;
448
+ else {
449
+ _trans += (_mid - _keys);
450
+ goto _match;
451
+ }
452
+ }
453
+ _keys += _klen;
454
+ _trans += _klen;
455
+ }
456
+
457
+ _klen = _redcloth_attributes_range_lengths[cs];
458
+ if ( _klen > 0 ) {
459
+ const char *_lower = _keys;
460
+ const char *_mid;
461
+ const char *_upper = _keys + (_klen<<1) - 2;
462
+ while (1) {
463
+ if ( _upper < _lower )
464
+ break;
465
+
466
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
467
+ if ( (*p) < _mid[0] )
468
+ _upper = _mid - 2;
469
+ else if ( (*p) > _mid[1] )
470
+ _lower = _mid + 2;
471
+ else {
472
+ _trans += ((_mid - _keys)>>1);
473
+ goto _match;
474
+ }
475
+ }
476
+ _trans += _klen;
477
+ }
478
+
479
+ _match:
480
+ _trans = _redcloth_attributes_indicies[_trans];
481
+ _eof_trans:
482
+ cs = _redcloth_attributes_trans_targs[_trans];
483
+
484
+ if ( _redcloth_attributes_trans_actions[_trans] == 0 )
485
+ goto _again;
486
+
487
+ _acts = _redcloth_attributes_actions + _redcloth_attributes_trans_actions[_trans];
488
+ _nacts = (unsigned int) *_acts++;
489
+ while ( _nacts-- > 0 )
490
+ {
491
+ switch ( *_acts++ )
492
+ {
493
+ case 0:
494
+ #line 5 "ext/redcloth_scan/redcloth_attributes.c.rl"
495
+ { reg = p; }
496
+ break;
497
+ case 1:
498
+ #line 6 "ext/redcloth_scan/redcloth_attributes.c.rl"
499
+ { bck = p; }
500
+ break;
501
+ case 2:
502
+ #line 7 "ext/redcloth_scan/redcloth_attributes.c.rl"
503
+ { STORE("text"); }
504
+ break;
505
+ case 3:
506
+ #line 8 "ext/redcloth_scan/redcloth_attributes.c.rl"
507
+ { CLEAR_REGS(); RESET_REG(); }
508
+ break;
509
+ case 4:
510
+ #line 10 "ext/redcloth_scan/redcloth_attributes.c.rl"
511
+ { STORE("class_buf"); }
512
+ break;
513
+ case 5:
514
+ #line 10 "ext/redcloth_scan/redcloth_attributes.c.rl"
515
+ {STORE("id_buf");}
516
+ break;
517
+ case 6:
518
+ #line 11 "ext/redcloth_scan/redcloth_attributes.c.rl"
519
+ { STORE("lang_buf"); }
520
+ break;
521
+ case 7:
522
+ #line 12 "ext/redcloth_scan/redcloth_attributes.c.rl"
523
+ { STORE("style_buf"); }
524
+ break;
525
+ case 8:
526
+ #line 23 "ext/redcloth_scan/redcloth_attributes.c.rl"
527
+ { STORE("name"); }
528
+ break;
529
+ case 9:
530
+ #line 24 "ext/redcloth_scan/redcloth_attributes.c.rl"
531
+ { STORE_B("name_without_attributes"); }
532
+ break;
533
+ case 13:
534
+ #line 1 "ext/redcloth_scan/redcloth_attributes.c.rl"
535
+ {te = p+1;}
536
+ break;
537
+ case 14:
538
+ #line 19 "ext/redcloth_scan/redcloth_attributes.c.rl"
539
+ {act = 1;}
540
+ break;
541
+ case 15:
542
+ #line 19 "ext/redcloth_scan/redcloth_attributes.c.rl"
543
+ {te = p;p--;{ SET_ATTRIBUTES(); }}
544
+ break;
545
+ case 16:
546
+ #line 19 "ext/redcloth_scan/redcloth_attributes.c.rl"
547
+ {{p = ((te))-1;}{ SET_ATTRIBUTES(); }}
548
+ break;
549
+ case 17:
550
+ #line 1 "ext/redcloth_scan/redcloth_attributes.c.rl"
551
+ { switch( act ) {
552
+ case 0:
553
+ {{cs = 0; goto _again;}}
554
+ break;
555
+ case 1:
556
+ {{p = ((te))-1;} SET_ATTRIBUTES(); }
557
+ break;
558
+ }
559
+ }
560
+ break;
561
+ case 18:
562
+ #line 28 "ext/redcloth_scan/redcloth_attributes.c.rl"
563
+ {act = 2;}
564
+ break;
565
+ case 19:
566
+ #line 29 "ext/redcloth_scan/redcloth_attributes.c.rl"
567
+ {act = 3;}
568
+ break;
569
+ case 20:
570
+ #line 28 "ext/redcloth_scan/redcloth_attributes.c.rl"
571
+ {te = p;p--;{ SET_ATTRIBUTES(); }}
572
+ break;
573
+ case 21:
574
+ #line 29 "ext/redcloth_scan/redcloth_attributes.c.rl"
575
+ {te = p;p--;{ SET_ATTRIBUTE("name_without_attributes", "name"); }}
576
+ break;
577
+ case 22:
578
+ #line 28 "ext/redcloth_scan/redcloth_attributes.c.rl"
579
+ {{p = ((te))-1;}{ SET_ATTRIBUTES(); }}
580
+ break;
581
+ case 23:
582
+ #line 29 "ext/redcloth_scan/redcloth_attributes.c.rl"
583
+ {{p = ((te))-1;}{ SET_ATTRIBUTE("name_without_attributes", "name"); }}
584
+ break;
585
+ case 24:
586
+ #line 1 "ext/redcloth_scan/redcloth_attributes.c.rl"
587
+ { switch( act ) {
588
+ case 2:
589
+ {{p = ((te))-1;} SET_ATTRIBUTES(); }
590
+ break;
591
+ case 3:
592
+ {{p = ((te))-1;} SET_ATTRIBUTE("name_without_attributes", "name"); }
593
+ break;
594
+ }
595
+ }
596
+ break;
597
+ #line 598 "ext/redcloth_scan/redcloth_attributes.c"
598
+ }
599
+ }
600
+
601
+ _again:
602
+ _acts = _redcloth_attributes_actions + _redcloth_attributes_to_state_actions[cs];
603
+ _nacts = (unsigned int) *_acts++;
604
+ while ( _nacts-- > 0 ) {
605
+ switch ( *_acts++ ) {
606
+ case 10:
607
+ #line 1 "ext/redcloth_scan/redcloth_attributes.c.rl"
608
+ {ts = 0;}
609
+ break;
610
+ case 11:
611
+ #line 1 "ext/redcloth_scan/redcloth_attributes.c.rl"
612
+ {act = 0;}
613
+ break;
614
+ #line 615 "ext/redcloth_scan/redcloth_attributes.c"
615
+ }
616
+ }
617
+
618
+ if ( cs == 0 )
619
+ goto _out;
620
+ if ( ++p != pe )
621
+ goto _resume;
622
+ _test_eof: {}
623
+ if ( p == eof )
624
+ {
625
+ if ( _redcloth_attributes_eof_trans[cs] > 0 ) {
626
+ _trans = _redcloth_attributes_eof_trans[cs] - 1;
627
+ goto _eof_trans;
628
+ }
629
+ }
630
+
631
+ _out: {}
632
+ }
633
+
634
+ #line 36 "ext/redcloth_scan/redcloth_attributes.c.rl"
635
+
636
+ return regs;
637
+ }
638
+
639
+ VALUE
640
+ redcloth_attributes(self, str)
641
+ VALUE self, str;
642
+ {
643
+ StringValue(str);
644
+ int cs = redcloth_attributes_en_inline;
645
+ return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1);
646
+ }
647
+
648
+ VALUE
649
+ redcloth_link_attributes(self, str)
650
+ VALUE self, str;
651
+ {
652
+ StringValue(str);
653
+ int cs = redcloth_attributes_en_link_says;
654
+ return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1);
655
+ }