diff --git a/README.md b/README.md index daf2f885..dd215ba8 100644 --- a/README.md +++ b/README.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 diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 181b1fbc..aab96da1 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -14,7 +14,7 @@ Orgmode::Parser.new(content).to_html end -command(:rest2html, /rest|rst/) +command(:rest2html, /re?st(.txt)?/) command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc/) diff --git a/test/markup_test.rb b/test/markup_test.rb index e30714ec..53b8e385 100644 --- a/test/markup_test.rb +++ b/test/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") diff --git a/test/markups/README.rst.txt b/test/markups/README.rst.txt new file mode 100644 index 00000000..add90768 --- /dev/null +++ b/test/markups/README.rst.txt @@ -0,0 +1,13 @@ +Header 1 +======== + +Example text. + +Header 2 +-------- + +1. Blah blah ``code`` blah + +2. More ``code``, hooray + + diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html new file mode 100644 index 00000000..8e26e4f0 --- /dev/null +++ b/test/markups/README.rst.txt.html @@ -0,0 +1,14 @@ +
+
+

Header 1

+

Example text.

+
+

Header 2

+
    +
  1. Blah blah code blah
  2. +
  3. More code, hooray
  4. +
+
+
+
+