all repos — markup @ bfd4687f4b7ee187780414778a8f3ac985fc246d

The code we use to render README.your_favorite_markup

add tests for rendering .litcoffee as markdown
Coby Chapple coby@cobychapple.com
Fri, 05 Apr 2013 13:24:00 +0100
commit

bfd4687f4b7ee187780414778a8f3ac985fc246d

parent

8154dca5f42425fe389ed7027c5569ae91e377ba

3 files changed, 117 insertions(+), 0 deletions(-)

jump to
M test/markup_test.rbtest/markup_test.rb

@@ -36,6 +36,7 @@ def test_knows_what_it_can_and_cannot_render

assert_equal false, GitHub::Markup.can_render?('README.html') assert_equal true, GitHub::Markup.can_render?('README.markdown') assert_equal false, GitHub::Markup.can_render?('README.cmd') + assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end def test_fails_gracefully_on_missing_commands
A test/markups/README.litcoffee

@@ -0,0 +1,59 @@

+Literate CoffeeScript Test +-------------------------- + +> Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee + +comment comment + + test "basic literate CoffeeScript parsing", -> + ok yes + +now with a... + + test "broken up indentation", -> + +... broken up ... + + do -> + +... nested block. + + ok yes + +Code must be separated from text by a blank line. + + test "code blocks must be preceded by a blank line", -> + +The next line is part of the text and will not be executed. + fail() + + ok yes + +Code in `backticks is not parsed` and... + + test "comments in indented blocks work", -> + do -> + do -> + # Regular comment. + + ### + Block comment. + ### + + ok yes + +Regular [Markdown](http://example.com/markdown) features, like links +and unordered lists, are fine: + + * I + + * Am + + * A + + * List + +Tabs work too: + + test "tabbed code", -> + ok yes
A test/markups/README.litcoffee.html

@@ -0,0 +1,57 @@

+<h2 id='literate_coffeescript_test'>Literate CoffeeScript Test</h2> + +<blockquote> +<p>Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee</p> +</blockquote> + +<p>comment comment</p> + +<pre><code>test &quot;basic literate CoffeeScript parsing&quot;, -&gt; + ok yes</code></pre> + +<p>now with a&#8230;</p> + +<pre><code>test &quot;broken up indentation&quot;, -&gt;</code></pre> + +<p>&#8230; broken up &#8230;</p> + +<pre><code> do -&gt;</code></pre> + +<p>&#8230; nested block.</p> + +<pre><code> ok yes</code></pre> + +<p>Code must be separated from text by a blank line.</p> + +<pre><code>test &quot;code blocks must be preceded by a blank line&quot;, -&gt;</code></pre> + +<p>The next line is part of the text and will not be executed. fail()</p> + +<pre><code> ok yes</code></pre> + +<p>Code in <code>backticks is not parsed</code> and&#8230;</p> + +<pre><code>test &quot;comments in indented blocks work&quot;, -&gt; + do -&gt; + do -&gt; + # Regular comment. + + ### + Block comment. + ### + + ok yes</code></pre> + +<p>Regular <a href='http://example.com/markdown'>Markdown</a> features, like links and unordered lists, are fine:</p> + +<p>* I</p> + +<p>* Am</p> + +<p>* A</p> + +<p>* List</p> + +<p>Tabs work too:</p> + +<p>test &#8220;tabbed code&#8221;, -&gt; ok yes</p>