public
Fork of jgarber/redcloth
Description: RedCloth is a Ruby library for converting Textile into HTML.
Homepage: http://code.whytheluckystiff.net/redcloth/
Clone URL: git://github.com/github/redcloth.git
RedCloth::VERSION on a line all by itself outputs the version.  Handy for 
debugging someone else's site.
jgarber (author)
Wed Apr 16 04:37:22 -0700 2008
commit  7d9ad50b51d35db212587a3e9deeb1b4213ac721
tree    3a34ffcb2e0251b0677fa87ec20a322500e71d93
parent  0205748568fab595df6eb5f8368252d3f7cf8672
...
70
71
72
 
 
 
73
74
75
...
280
281
282
 
283
284
285
...
70
71
72
73
74
75
76
77
78
...
283
284
285
286
287
288
289
0
@@ -70,6 +70,9 @@ int SYM_html_escape_entities;
0
   tdef = ( "table" >X A C :> dotspace CRLF ) ;
0
   table = ( tdef? trows >{INLINE(table, table_open);} ) >{ reg = NULL; } ;
0
 
0
+ # info
0
+ redcloth_version = "RedCloth::VERSION" (CRLF* EOF | double_return) ;
0
+
0
   pre_tag := |*
0
     pre_tag_end { CAT(block); DONE(block); fgoto main; };
0
     default => esc_pre;
0
@@ -280,6 +283,7 @@ int SYM_html_escape_entities;
0
     table { INLINE(table, table_close); DONE(table); fgoto block; };
0
     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); };
0
     aligned_image { rb_hash_aset(regs, ID2SYM(rb_intern("type")), plain_block); fgoto block; };
0
+ redcloth_version { INLINE(html, redcloth_version); };
0
     blank_line => cat;
0
     default
0
     {
...
213
214
215
 
 
 
 
216
...
213
214
215
216
217
218
219
220
0
@@ -213,4 +213,8 @@ class << RedCloth::HTML
0
   def urlesc(txt)
0
     txt.gsub(/&/, '&amp;')
0
   end
0
+
0
+ def redcloth_version(opts)
0
+ p(:text => RedCloth::VERSION)
0
+ end
0
 end
...
29
30
31
 
 
 
 
 
 
 
 
 
 
32
33
...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
0
@@ -29,5 +29,15 @@ class TestParser < Test::Unit::TestCase
0
   def test_table_with_empty_cells_does_not_segfault
0
     assert_match /td/, red("html", %Q{|one || |\nthree | four |})
0
   end
0
+
0
+ def test_redcloth_version_in_output
0
+ assert_equal "<p>#{RedCloth::VERSION}</p>", red("html", "RedCloth::VERSION")
0
+ end
0
+
0
+ def test_redcloth_version_only_on_line_by_itself
0
+ input = "RedCloth::VERSION won't output the RedCloth::VERSION unless it's on a line all by itself.\n\nRedCloth::VERSION"
0
+ html = "<p>RedCloth::<span class=\"caps\">VERSION</span> won&#8217;t output the RedCloth::<span class=\"caps\">VERSION</span> unless it&#8217;s on a line all by itself.</p>\n<p>#{RedCloth::VERSION}</p>"
0
+ assert_equal html, red("html", input)
0
+ end
0
 
0
 end

Comments

    No one has commented yet.