RedCloth 3.0.4 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of RedCloth might be problematic. Click here for more details.

Files changed (63) hide show
  1. data/CHANGELOG +17 -0
  2. data/COPYING +18 -0
  3. data/README +156 -0
  4. data/Rakefile +238 -0
  5. data/bin/redcloth +27 -2
  6. data/ext/redcloth_scan/extconf.rb +9 -0
  7. data/ext/redcloth_scan/redcloth.h +149 -0
  8. data/ext/redcloth_scan/redcloth_attributes.c +650 -0
  9. data/ext/redcloth_scan/redcloth_attributes.rl +78 -0
  10. data/ext/redcloth_scan/redcloth_common.rl +113 -0
  11. data/ext/redcloth_scan/redcloth_inline.c +5102 -0
  12. data/ext/redcloth_scan/redcloth_inline.rl +282 -0
  13. data/ext/redcloth_scan/redcloth_scan.c +9300 -0
  14. data/ext/redcloth_scan/redcloth_scan.rl +523 -0
  15. data/extras/mingw-rbconfig.rb +176 -0
  16. data/extras/ragel_profiler.rb +73 -0
  17. data/lib/redcloth.rb +22 -1128
  18. data/lib/redcloth/formatters/base.rb +50 -0
  19. data/lib/redcloth/formatters/html.rb +342 -0
  20. data/lib/redcloth/formatters/latex.rb +227 -0
  21. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  22. data/lib/redcloth/textile_doc.rb +105 -0
  23. data/lib/redcloth/version.rb +18 -0
  24. data/test/basic.yml +794 -0
  25. data/test/code.yml +195 -0
  26. data/test/definitions.yml +71 -0
  27. data/test/extra_whitespace.yml +64 -0
  28. data/test/filter_html.yml +177 -0
  29. data/test/filter_pba.yml +12 -0
  30. data/test/helper.rb +108 -0
  31. data/test/html.yml +271 -0
  32. data/test/images.yml +202 -0
  33. data/{tests → test}/instiki.yml +14 -15
  34. data/test/links.yml +214 -0
  35. data/test/lists.yml +283 -0
  36. data/test/poignant.yml +89 -0
  37. data/test/sanitize_html.yml +42 -0
  38. data/test/table.yml +267 -0
  39. data/test/test_custom_tags.rb +46 -0
  40. data/test/test_extensions.rb +31 -0
  41. data/test/test_formatters.rb +15 -0
  42. data/test/test_parser.rb +68 -0
  43. data/test/test_restrictions.rb +41 -0
  44. data/test/textism.yml +480 -0
  45. data/test/threshold.yml +772 -0
  46. data/test/validate_fixtures.rb +73 -0
  47. metadata +94 -60
  48. data/doc/CHANGELOG +0 -160
  49. data/doc/COPYING +0 -25
  50. data/doc/README +0 -106
  51. data/doc/REFERENCE +0 -216
  52. data/doc/make.rb +0 -359
  53. data/run-tests.rb +0 -28
  54. data/setup.rb +0 -1376
  55. data/tests/code.yml +0 -105
  56. data/tests/hard_breaks.yml +0 -26
  57. data/tests/images.yml +0 -171
  58. data/tests/links.yml +0 -155
  59. data/tests/lists.yml +0 -77
  60. data/tests/markdown.yml +0 -218
  61. data/tests/poignant.yml +0 -64
  62. data/tests/table.yml +0 -198
  63. data/tests/textism.yml +0 -406
@@ -0,0 +1,523 @@
1
+ /*
2
+ * redcloth_scan.rl
3
+ *
4
+ * Copyright (C) 2008 Jason Garber
5
+ */
6
+ #define redcloth_scan_c
7
+
8
+ #include <ruby.h>
9
+ #include "redcloth.h"
10
+
11
+ VALUE mRedCloth, super_ParseError, super_RedCloth, super_HTML, super_LATEX;
12
+ int SYM_escape_preformatted;
13
+
14
+ %%{
15
+
16
+ machine redcloth_scan;
17
+ include redcloth_common "redcloth_common.rl";
18
+
19
+ action extend { extend = rb_hash_aref(regs, ID2SYM(rb_intern("type"))); }
20
+
21
+ # blocks
22
+ notextile_tag_start = "<notextile>" ;
23
+ notextile_tag_end = "</notextile>" LF? ;
24
+ noparagraph_line_start = " "+ ;
25
+ notextile_block_start = ( "notextile" >A %{ STORE(type) } A C :> "." ( "." %extend | "" ) " "+ ) ;
26
+ pre_tag_start = "<pre" [^>]* ">" (space* "<code>")? ;
27
+ pre_tag_end = ("</code>" space*)? "</pre>" LF? ;
28
+ pre_block_start = ( "pre" >A %{ STORE(type) } A C :> "." ( "." %extend | "" ) " "+ ) ;
29
+ bc_start = ( "bc" >A %{ STORE(type) } A C :> "." ( "." %extend | "" ) " "+ ) ;
30
+ bq_start = ( "bq" >A %{ STORE(type) } A C :> "." ( "." %extend | "" ) ( ":" %A uri %{ STORE(cite) } )? " "+ ) ;
31
+ non_ac_btype = ( "bq" | "bc" | "pre" | "notextile" );
32
+ btype = (alpha alnum*) -- (non_ac_btype | "fn" digit+);
33
+ block_start = ( btype >A %{ STORE(type) } A C :> "." ( "." %extend | "" ) " "+ ) >B %{ STORE_B(fallback) };
34
+ all_btypes = btype | non_ac_btype;
35
+ next_block_start = ( all_btypes A_noactions C_noactions :> "."+ " " ) >A @{ p = reg - 1; } ;
36
+ double_return = LF{2,} ;
37
+ block_end = ( double_return | EOF );
38
+ ftype = ( "fn" >A %{ STORE(type) } digit+ >A %{ STORE(id) } ) ;
39
+ footnote_start = ( ftype A C :> dotspace ) ;
40
+ ul = "*" %{nest++; list_type = "ul";};
41
+ ol = "#" %{nest++; list_type = "ol";};
42
+ list_start = ( ( ul | ol )+ N A C :> " "+ ) >{nest = 0;} ;
43
+ dl_start = "-" . " "+ ;
44
+ dd_start = ":=" ;
45
+ long_dd = dd_start " "* LF %{ ADD_BLOCK(); ASET(type, dd); } any+ >A %{ TRANSFORM(text) } :>> "=:" ;
46
+ blank_line = LF;
47
+ link_alias = ( "[" >{ ASET(type, ignore) } %A phrase %T "]" %A uri %{ STORE_URL(href); } ) ;
48
+
49
+ # image lookahead
50
+ IMG_A_LEFT = "<" %{ ASET(float, left) } ;
51
+ IMG_A_RIGHT = ">" %{ ASET(float, right) } ;
52
+ aligned_image = ( "["? "!" (IMG_A_LEFT | IMG_A_RIGHT) ) >A @{ p = reg - 1; } ;
53
+
54
+ # html blocks
55
+ BlockTagName = Name - ("pre" | "notextile" | "a" | "applet" | "basefont" | "bdo" | "br" | "font" | "iframe" | "img" | "map" | "object" | "param" | "q" | "script" | "span" | "sub" | "sup" | "abbr" | "acronym" | "cite" | "code" | "del" | "dfn" | "em" | "ins" | "kbd" | "samp" | "strong" | "var" | "b" | "big" | "i" | "s" | "small" | "strike" | "tt" | "u");
56
+ block_start_tag = "<" BlockTagName space+ AttrSet* (AttrEnd)? ">" | "<" BlockTagName ">";
57
+ block_empty_tag = "<" BlockTagName space+ AttrSet* (AttrEnd)? "/>" | "<" BlockTagName "/>" ;
58
+ block_end_tag = "</" BlockTagName space* ">" ;
59
+ html_start = indent >B %{STORE_B(indent_before_start)} block_start_tag >B %{STORE_B(start_tag)} indent >B %{STORE_B(indent_after_start)} ;
60
+ html_end = indent >B %{STORE_B(indent_before_end)} block_end_tag >B %{STORE_B(end_tag)} (indent LF?) >B %{STORE_B(indent_after_end)} ;
61
+ standalone_html = indent (block_start_tag | block_empty_tag | block_end_tag) indent LF+;
62
+ html_end_terminating_block = ( indent block_end_tag ) >A @{ p = reg - 1; } ;
63
+
64
+ # tables
65
+ para = ( default+ ) -- LF ;
66
+ btext = para ( LF{2} )? ;
67
+ tddef = ( D? S A C :> dotspace ) ;
68
+ td = ( tddef? btext >A %T :> "|" >{PASS(table, text, td);} ) >X ;
69
+ trdef = ( A C :> dotspace ) ;
70
+ tr = ( trdef? "|" %{INLINE(table, tr_open);} td+ ) >X %{INLINE(table, tr_close);} ;
71
+ trows = ( tr (LF >X tr)* ) ;
72
+ tdef = ( "table" >X A C :> dotspace LF ) ;
73
+ table = ( tdef? trows >{INLINE(table, table_open);} ) >{ reg = NULL; } ;
74
+
75
+ # info
76
+ redcloth_version = ("RedCloth" >A ("::" | " " ) "VERSION"i ":"? " ")? %{STORE(prefix)} "RedCloth::VERSION" (LF* EOF | double_return) ;
77
+
78
+ pre_tag := |*
79
+ pre_tag_end { CAT(block); DONE(block); fgoto main; };
80
+ default => esc_pre;
81
+ *|;
82
+
83
+ pre_block := |*
84
+ EOF {
85
+ ADD_BLOCKCODE();
86
+ fgoto main;
87
+ };
88
+ double_return {
89
+ if (NIL_P(extend)) {
90
+ ADD_BLOCKCODE();
91
+ fgoto main;
92
+ } else {
93
+ ADD_EXTENDED_BLOCKCODE();
94
+ }
95
+ };
96
+ double_return next_block_start {
97
+ if (NIL_P(extend)) {
98
+ ADD_BLOCKCODE();
99
+ fgoto main;
100
+ } else {
101
+ ADD_EXTENDED_BLOCKCODE();
102
+ END_EXTENDED();
103
+ fgoto main;
104
+ }
105
+ };
106
+ default => esc_pre;
107
+ *|;
108
+
109
+ script_tag := |*
110
+ script_tag_end { CAT(block); ASET(type, ignore); ADD_BLOCK(); fgoto main; };
111
+ EOF { ASET(type, ignore); ADD_BLOCK(); fgoto main; };
112
+ default => cat;
113
+ *|;
114
+
115
+ noparagraph_line := |*
116
+ LF { ADD_BLOCK(); fgoto main; };
117
+ default => cat;
118
+ *|;
119
+
120
+ notextile_tag := |*
121
+ notextile_tag_end { ADD_BLOCK(); fgoto main; };
122
+ default => cat;
123
+ *|;
124
+
125
+ notextile_block := |*
126
+ EOF {
127
+ ADD_BLOCK();
128
+ fgoto main;
129
+ };
130
+ double_return {
131
+ if (NIL_P(extend)) {
132
+ ADD_BLOCK();
133
+ CAT(html);
134
+ fgoto main;
135
+ } else {
136
+ CAT(block);
137
+ ADD_EXTENDED_BLOCK();
138
+ CAT(html);
139
+ }
140
+ };
141
+ double_return next_block_start {
142
+ if (NIL_P(extend)) {
143
+ ADD_BLOCK();
144
+ CAT(html);
145
+ fgoto main;
146
+ } else {
147
+ CAT(block);
148
+ ADD_EXTENDED_BLOCK();
149
+ END_EXTENDED();
150
+ fgoto main;
151
+ }
152
+ };
153
+ default => cat;
154
+ *|;
155
+
156
+ html := |*
157
+ html_end { ADD_BLOCK(); fgoto main; };
158
+ default => cat;
159
+ *|;
160
+
161
+ bc := |*
162
+ EOF {
163
+ ADD_BLOCKCODE();
164
+ INLINE(html, bc_close);
165
+ plain_block = rb_str_new2("p");
166
+ fgoto main;
167
+ };
168
+ double_return {
169
+ if (NIL_P(extend)) {
170
+ ADD_BLOCKCODE();
171
+ INLINE(html, bc_close);
172
+ plain_block = rb_str_new2("p");
173
+ fgoto main;
174
+ } else {
175
+ ADD_EXTENDED_BLOCKCODE();
176
+ CAT(html);
177
+ }
178
+ };
179
+ double_return next_block_start {
180
+ if (NIL_P(extend)) {
181
+ ADD_BLOCKCODE();
182
+ INLINE(html, bc_close);
183
+ plain_block = rb_str_new2("p");
184
+ fgoto main;
185
+ } else {
186
+ ADD_EXTENDED_BLOCKCODE();
187
+ CAT(html);
188
+ INLINE(html, bc_close);
189
+ plain_block = rb_str_new2("p");
190
+ END_EXTENDED();
191
+ fgoto main;
192
+ }
193
+ };
194
+ default => esc_pre;
195
+ *|;
196
+
197
+ bq := |*
198
+ EOF {
199
+ ADD_BLOCK();
200
+ INLINE(html, bq_close);
201
+ fgoto main;
202
+ };
203
+ double_return {
204
+ if (NIL_P(extend)) {
205
+ ADD_BLOCK();
206
+ INLINE(html, bq_close);
207
+ fgoto main;
208
+ } else {
209
+ ADD_EXTENDED_BLOCK();
210
+ }
211
+ };
212
+ double_return next_block_start {
213
+ if (NIL_P(extend)) {
214
+ ADD_BLOCK();
215
+ INLINE(html, bq_close);
216
+ fgoto main;
217
+ } else {
218
+ ADD_EXTENDED_BLOCK();
219
+ INLINE(html, bq_close);
220
+ END_EXTENDED();
221
+ fgoto main;
222
+ }
223
+ };
224
+ html_end_terminating_block {
225
+ if (NIL_P(extend)) {
226
+ ADD_BLOCK();
227
+ INLINE(html, bq_close);
228
+ fgoto main;
229
+ } else {
230
+ ADD_EXTENDED_BLOCK();
231
+ INLINE(html, bq_close);
232
+ END_EXTENDED();
233
+ fgoto main;
234
+ }
235
+ };
236
+ default => cat;
237
+ *|;
238
+
239
+ block := |*
240
+ EOF {
241
+ ADD_BLOCK();
242
+ fgoto main;
243
+ };
244
+ double_return {
245
+ if (NIL_P(extend)) {
246
+ ADD_BLOCK();
247
+ fgoto main;
248
+ } else {
249
+ ADD_EXTENDED_BLOCK();
250
+ }
251
+ };
252
+ double_return next_block_start {
253
+ if (NIL_P(extend)) {
254
+ ADD_BLOCK();
255
+ fgoto main;
256
+ } else {
257
+ ADD_EXTENDED_BLOCK();
258
+ END_EXTENDED();
259
+ fgoto main;
260
+ }
261
+ };
262
+ html_end_terminating_block {
263
+ if (NIL_P(extend)) {
264
+ ADD_BLOCK();
265
+ fgoto main;
266
+ } else {
267
+ ADD_EXTENDED_BLOCK();
268
+ END_EXTENDED();
269
+ fgoto main;
270
+ }
271
+ };
272
+ LF list_start {
273
+ ADD_BLOCK();
274
+ list_layout = rb_ary_new();
275
+ LIST_ITEM();
276
+ fgoto list;
277
+ };
278
+
279
+ default => cat;
280
+ *|;
281
+
282
+ footnote := |*
283
+ block_end { ADD_BLOCK(); fgoto main; };
284
+ default => cat;
285
+ *|;
286
+
287
+ list := |*
288
+ LF list_start { ADD_BLOCK(); LIST_ITEM(); };
289
+ block_end { ADD_BLOCK(); nest = 0; LIST_CLOSE(); fgoto main; };
290
+ default => cat;
291
+ *|;
292
+
293
+ dl := |*
294
+ LF dl_start { ADD_BLOCK(); ASET(type, dt); };
295
+ dd_start { ADD_BLOCK(); ASET(type, dd); };
296
+ long_dd { INLINE(html, dd); };
297
+ block_end { ADD_BLOCK(); INLINE(html, dl_close); fgoto main; };
298
+ default => cat;
299
+ *|;
300
+
301
+ main := |*
302
+ noparagraph_line_start { ASET(type, ignored_line); fgoto noparagraph_line; };
303
+ notextile_tag_start { ASET(type, notextile); fgoto notextile_tag; };
304
+ notextile_block_start { ASET(type, notextile); fgoto notextile_block; };
305
+ script_tag_start { CAT(block); fgoto script_tag; };
306
+ pre_tag_start { ASET(type, notextile); CAT(block); fgoto pre_tag; };
307
+ pre_block_start { fgoto pre_block; };
308
+ standalone_html { ASET(type, html); CAT(block); ADD_BLOCK(); };
309
+ html_start { ASET(type, html_block); fgoto html; };
310
+ bc_start { INLINE(html, bc_open); ASET(type, code); plain_block = rb_str_new2("code"); fgoto bc; };
311
+ bq_start { INLINE(html, bq_open); ASET(type, p); fgoto bq; };
312
+ block_start { fgoto block; };
313
+ footnote_start { fgoto footnote; };
314
+ list_start { list_layout = rb_ary_new(); LIST_ITEM(); fgoto list; };
315
+ dl_start { INLINE(html, dl_open); ASET(type, dt); fgoto dl; };
316
+ table { INLINE(table, table_close); DONE(table); fgoto block; };
317
+ link_alias { rb_hash_aset(refs_found, rb_hash_aref(regs, ID2SYM(rb_intern("text"))), rb_hash_aref(regs, ID2SYM(rb_intern("href")))); DONE(block); };
318
+ aligned_image { rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block); fgoto block; };
319
+ redcloth_version { INLINE(html, redcloth_version); };
320
+ blank_line => cat;
321
+ default
322
+ {
323
+ CLEAR_REGS();
324
+ rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block);
325
+ CAT(block);
326
+ fgoto block;
327
+ };
328
+ EOF;
329
+ *|;
330
+
331
+ }%%
332
+
333
+ %% write data nofinal;
334
+
335
+ VALUE
336
+ redcloth_transform(self, p, pe, refs)
337
+ VALUE self;
338
+ char *p, *pe;
339
+ VALUE refs;
340
+ {
341
+ char *orig_p = p, *orig_pe = pe;
342
+ int cs, act, nest;
343
+ char *ts = NULL, *te = NULL, *reg = NULL, *bck = NULL, *eof = NULL;
344
+ VALUE html = rb_str_new2("");
345
+ VALUE table = rb_str_new2("");
346
+ VALUE block = rb_str_new2("");
347
+ VALUE regs; CLEAR_REGS()
348
+
349
+
350
+ VALUE list_layout = Qnil;
351
+ char *list_type = NULL;
352
+ VALUE list_index = rb_ary_new();
353
+ int list_continue = 0;
354
+ VALUE plain_block = rb_str_new2("p");
355
+ VALUE extend = Qnil;
356
+ char listm[10] = "";
357
+ VALUE refs_found = rb_hash_new();
358
+
359
+ %% write init;
360
+
361
+ %% write exec;
362
+
363
+ if (RSTRING(block)->len > 0)
364
+ {
365
+ ADD_BLOCK();
366
+ }
367
+
368
+ if ( NIL_P(refs) && rb_funcall(refs_found, rb_intern("empty?"), 0) == Qfalse ) {
369
+ return redcloth_transform(self, orig_p, orig_pe, refs_found);
370
+ } else {
371
+ rb_funcall(self, rb_intern("after_transform"), 1, html);
372
+ return html;
373
+ }
374
+ }
375
+
376
+ VALUE
377
+ redcloth_transform2(self, str)
378
+ VALUE self, str;
379
+ {
380
+ rb_str_cat2(str, "\n");
381
+ StringValue(str);
382
+ rb_funcall(self, rb_intern("before_transform"), 1, str);
383
+ return redcloth_transform(self, RSTRING(str)->ptr, RSTRING(str)->ptr + RSTRING(str)->len + 1, Qnil);
384
+ }
385
+
386
+ /*
387
+ * Converts special characters into HTML entities.
388
+ */
389
+ static VALUE
390
+ redcloth_html_esc(int argc, VALUE* argv, VALUE self) //(self, str, level)
391
+ {
392
+ VALUE str, level;
393
+
394
+ rb_scan_args(argc, argv, "11", &str, &level);
395
+
396
+ VALUE new_str = rb_str_new2("");
397
+ StringValue(str);
398
+
399
+ if (RSTRING(str)->len == 0)
400
+ return new_str;
401
+
402
+ char *ts = RSTRING(str)->ptr, *te = RSTRING(str)->ptr + RSTRING(str)->len;
403
+ char *t = ts, *t2 = ts, *ch = NULL;
404
+ if (te <= ts) return;
405
+
406
+ while (t2 < te) {
407
+ ch = NULL;
408
+
409
+ // normal + pre
410
+ switch (*t2)
411
+ {
412
+ case '&': ch = "amp"; break;
413
+ case '>': ch = "gt"; break;
414
+ case '<': ch = "lt"; break;
415
+ }
416
+
417
+ // normal (non-pre)
418
+ if (level != SYM_escape_preformatted) {
419
+ switch (*t2)
420
+ {
421
+ case '"': ch = "quot"; break;
422
+ case '\'': ch = "squot"; break;
423
+ case '\n': ch = "br"; break;
424
+ }
425
+ }
426
+
427
+ if (ch != NULL)
428
+ {
429
+ if (t2 > t)
430
+ rb_str_cat(new_str, t, t2-t);
431
+ rb_str_concat(new_str, rb_funcall(self, rb_intern(ch), 1, rb_hash_new()));
432
+ t = t2 + 1;
433
+ }
434
+
435
+ t2++;
436
+ }
437
+ if (t2 > t)
438
+ rb_str_cat(new_str, t, t2-t);
439
+
440
+ return new_str;
441
+ }
442
+
443
+ /*
444
+ * Converts special characters into LaTeX entities.
445
+ */
446
+ static VALUE
447
+ redcloth_latex_esc(VALUE self, VALUE str)
448
+ {
449
+ VALUE new_str = rb_str_new2("");
450
+ StringValue(str);
451
+
452
+ char *ts = RSTRING(str)->ptr, *te = RSTRING(str)->ptr + RSTRING(str)->len;
453
+ char *t = ts, *t2 = ts, *ch = NULL;
454
+ if (te <= ts) return;
455
+
456
+ while (t2 < te) {
457
+ ch = NULL;
458
+
459
+ switch (*t2)
460
+ {
461
+ case '{': ch = "#123"; break;
462
+ case '}': ch = "#125"; break;
463
+ case '\\': ch = "#92"; break;
464
+ case '#': ch = "#35"; break;
465
+ case '$': ch = "#36"; break;
466
+ case '%': ch = "#37"; break;
467
+ case '&': ch = "amp"; break;
468
+ case '_': ch = "#95"; break;
469
+ case '^': ch = "circ"; break;
470
+ case '~': ch = "tilde"; break;
471
+ case '<': ch = "lt"; break;
472
+ case '>': ch = "gt"; break;
473
+ case '\n': ch = "#10"; break;
474
+ }
475
+
476
+ if (ch != NULL)
477
+ {
478
+ if (t2 > t)
479
+ rb_str_cat(new_str, t, t2-t);
480
+ VALUE opts = rb_hash_new();
481
+ rb_hash_aset(opts, ID2SYM(rb_intern("text")), rb_str_new2(ch));
482
+ rb_str_concat(new_str, rb_funcall(self, rb_intern("entity"), 1, opts));
483
+ t = t2 + 1;
484
+ }
485
+
486
+ t2++;
487
+ }
488
+ if (t2 > t)
489
+ rb_str_cat(new_str, t, t2-t);
490
+
491
+ return new_str;
492
+ }
493
+
494
+ static VALUE
495
+ redcloth_to(self, formatter)
496
+ VALUE self, formatter;
497
+ {
498
+ char *pe, *p;
499
+ int len = 0;
500
+
501
+ rb_funcall(self, rb_intern("delete!"), 1, rb_str_new2("\r"));
502
+ VALUE working_copy = rb_obj_clone(self);
503
+ rb_extend_object(working_copy, formatter);
504
+ if (rb_funcall(working_copy, rb_intern("lite_mode"), 0) == Qtrue) {
505
+ return redcloth_inline2(working_copy, self, rb_hash_new());
506
+ } else {
507
+ return redcloth_transform2(working_copy, self);
508
+ }
509
+ }
510
+
511
+ void Init_redcloth_scan()
512
+ {
513
+ mRedCloth = rb_define_module("RedCloth");
514
+ /* A Textile document that can be converted to other formats. See
515
+ the README for Textile syntax. */
516
+ super_RedCloth = rb_define_class_under(mRedCloth, "TextileDoc", rb_cString);
517
+ rb_define_method(super_RedCloth, "to", redcloth_to, 1);
518
+ super_ParseError = rb_define_class_under(super_RedCloth, "ParseError", rb_eException);
519
+ /* Escaping */
520
+ rb_define_method(super_RedCloth, "html_esc", redcloth_html_esc, -1);
521
+ rb_define_method(super_RedCloth, "latex_esc", redcloth_latex_esc, 1);
522
+ SYM_escape_preformatted = ID2SYM(rb_intern("html_escape_preformatted"));
523
+ }