Sha256: 3b520e2a8956fda3a18511849f1a058edc95fbc468d741bdd2eac1475fd10802
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
/* * redcloth_attributes.rl * * Copyright (C) 2008 Jason Garber */ #include <ruby.h> #include "redcloth.h" %%{ machine redcloth_attributes; include redcloth_common "redcloth_common.rl"; C2_CLAS = ( "(" ( [^)#]+ >A %{ STORE(class_buf) } )? ("#" [^)]+ >A %{STORE(id_buf)} )? ")" ) ; C2_LNGE = ( "[" [^\]]+ >A %{ STORE(lang_buf) } "]" ) ; C2_STYL = ( "{" [^}]+ >A %{ STORE(style_buf) } "}" ) ; C2 = ( C2_CLAS | C2_STYL | C2_LNGE )+ ; mtext_with_attributes = ( C2 mtext >A %T ) >X ; inline := |* mtext_with_attributes { SET_ATTRIBUTES(); } ; *|; link_text_with_attributes = C2 "."* " "* ( mtext+ ) >A %{ STORE(name) } ; link_text_without_attributes = ( mtext+ ) >B %{ STORE_B(name_without_attributes) } ; link_says := |* link_text_with_attributes { SET_ATTRIBUTES(); } ; link_text_without_attributes { SET_ATTRIBUTE("name_without_attributes", "name"); } ; *|; }%% %% write data nofinal; VALUE redcloth_attribute_parser(machine, self, p, pe) int machine; VALUE self; char *p, *pe; { int cs, act; char *ts, *te, *reg, *bck, *eof; VALUE regs = rb_hash_new(); VALUE buf = Qnil; %% write init; cs = machine; %% write exec; return regs; } VALUE redcloth_attributes(self, str) VALUE self, str; { StringValue(str); int cs = redcloth_attributes_en_inline; return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1); } VALUE redcloth_link_attributes(self, str) VALUE self, str; { StringValue(str); int cs = redcloth_attributes_en_link_says; return redcloth_attribute_parser(cs, self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1); }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
RedCloth-4.0.4 | ext/redcloth_scan/redcloth_attributes.rl |
RedCloth-4.0.4-x86-mswin32-60 | ext/redcloth_scan/redcloth_attributes.rl |