all repos — markup @ 5b98a3aa3d35a26613136e8a257b4a64ca180565

The code we use to render README.your_favorite_markup

It seems .rst.txt is an acceptable rst extension 

blasted windows users
tekkub tekkub@gmail.com
Thu, 04 Mar 2010 02:19:45 +0800
commit

5b98a3aa3d35a26613136e8a257b4a64ca180565

parent

31ed99536d478ca4f631e27f5d7f0eb7123abe4a

M README.mdREADME.md

@@ -17,11 +17,11 @@ Once your script is in place, edit `lib/github/markups.rb` and tell

GitHub Markup about it. Again we look to [rest2html][r2hc] for guidance: - command(:rest2html, /rest|rst/) + command(:rest2html, /re?st(.txt)?/) Here we're telling GitHub Markup of the existence of a `rest2html` -command which should be used for any file ending in `rest` or -`rst`. Any regular expression will do. +command which should be used for any file ending in `rest`, +`rst`, `rest.txt` or `rst.txt`. Any regular expression will do. Finally add your tests. Create a `README.extension` in `test/markups` along with a `README.extension.html`. As you may imagine, the
M lib/github/markups.rblib/github/markups.rb

@@ -14,7 +14,7 @@ markup('org-ruby', /org/) do |content|

Orgmode::Parser.new(content).to_html end -command(:rest2html, /rest|rst/) +command(:rest2html, /re?st(.txt)?/) command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc/)
M test/markup_test.rbtest/markup_test.rb

@@ -6,7 +6,7 @@

class MarkupTest < Test::Unit::TestCase Dir['test/markups/README.*'].each do |readme| next if readme =~ /html$/ - markup = readme.split('.').last + markup = readme.split('/').last.gsub(/^README\./, '') define_method "test_#{markup}" do expected = File.read("#{readme}.html")
A test/markups/README.rst.txt

@@ -0,0 +1,13 @@

+Header 1 +======== + +Example text. + +Header 2 +-------- + +1. Blah blah ``code`` blah + +2. More ``code``, hooray + +
A test/markups/README.rst.txt.html

@@ -0,0 +1,14 @@

+<div class="document"> +<div class="section" id="header-1"> +<h1>Header 1</h1> +<p>Example text.</p> +<div class="section" id="header-2"> +<h2>Header 2</h2> +<ol class="arabic simple"> +<li>Blah blah <tt class="docutils literal">code</tt> blah</li> +<li>More <tt class="docutils literal">code</tt>, hooray</li> +</ol> +</div> +</div> +</div> +