Changeset 243
- Timestamp:
- 02/22/2008 16:06:26 (9 months ago)
- Location:
- branches/superredcloth
- Files:
-
- 3 modified
-
ext/superredcloth_scan/superredcloth.h (modified) (3 diffs)
-
ext/superredcloth_scan/superredcloth_inline.rl (modified) (3 diffs)
-
test/threshold.yml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/superredcloth/ext/superredcloth_scan/superredcloth.h
r238 r243 9 9 /* function defs */ 10 10 void rb_str_cat_escaped(VALUE str, char *tokstart, char *tokend); 11 void rb_str_cat_escaped_for_preformatted(VALUE str, char *tokstart, char *tokend); 11 12 VALUE superredcloth_inline(VALUE, char *, char *); 12 13 VALUE superredcloth_inline2(VALUE, VALUE); … … 17 18 VALUE red_pass2(VALUE, VALUE, VALUE, VALUE); 18 19 VALUE red_pass(VALUE, VALUE, VALUE, ID); 20 VALUE red_pass_code(VALUE, VALUE, VALUE, ID); 19 21 20 22 /* parser macros */ … … 25 27 #define PASS(H, A, T) rb_str_append(H, red_pass(rb_formatter, regs, ID2SYM(rb_intern(#A)), rb_intern(#T))) 26 28 #define PASS2(H, A, T) rb_str_append(H, red_pass2(rb_formatter, regs, ID2SYM(rb_intern(#A)), ID2SYM(rb_intern(#T)))) 29 #define PASS_CODE(H, A, T) rb_str_append(H, red_pass_code(rb_formatter, regs, ID2SYM(rb_intern(#A)), rb_intern(#T))) 27 30 #define ADD_BLOCK() \ 28 31 rb_str_append(html, red_block(rb_formatter, regs, block)); \ -
branches/superredcloth/ext/superredcloth_scan/superredcloth_inline.rl
r235 r243 59 59 # markup 60 60 code = "["? "@" >X C mtext >A %T :> "@" "]"? ; 61 code_tag = ("<code>" mspace?) >X (( mtext ) >A %T) :>> (mspace? "</code>") ; 61 62 strong = "["? "*" >X C mtext >A %T :> "*" "]"? ; 62 63 b = "["? "**" >X C mtext >A %T :> "**" "]"? ; … … 100 101 link { STORE_URL(href); PASS(block, name, link); }; 101 102 102 code { PASS(block, text, code); }; 103 code { PASS_CODE(block, text, code); }; 104 code_tag { PASS_CODE(block, text, code); }; 103 105 strong { PASS(block, text, strong); }; 104 106 b { PASS(block, text, b); }; … … 156 158 157 159 VALUE 160 red_pass_code(VALUE rb_formatter, VALUE regs, VALUE ref, ID meth) 161 { 162 VALUE txt = rb_hash_aref(regs, ref); 163 if (!NIL_P(txt)) { 164 VALUE txt2 = rb_str_new2(""); 165 rb_str_cat_escaped_for_preformatted(txt2, RSTRING(txt)->ptr, RSTRING(txt)->ptr + RSTRING(txt)->len); 166 rb_hash_aset(regs, ref, txt2); 167 } 168 return rb_funcall(rb_formatter, meth, 1, regs); 169 } 170 171 VALUE 158 172 red_pass2(VALUE rb_formatter, VALUE regs, VALUE ref, VALUE btype) 159 173 { -
branches/superredcloth/test/threshold.yml
r242 r243 367 367 // display a hello message 368 368 </code> 369 <code> print "Hello, World";369 <code> print "Hello, World"; 370 370 } 371 371 ?>