all repos — markup @ 684342130a713299029e3e2febf1638e9a4a57ef

The code we use to render README.your_favorite_markup

Merge pull request #217 from github/fix-tests

Fix tests
Garen Torikian gjtorikian@users.noreply.github.com
Wed, 11 Sep 2013 21:54:57 -0700
commit

684342130a713299029e3e2febf1638e9a4a57ef

parent

dd1b9eb2730fe5cdca75eae0cfc7a9fd69d6d8a2

M .gitignore.gitignore

@@ -2,3 +2,4 @@ *.pyc

bin .bundle Gemfile.lock +vendor/
A .travis.yml

@@ -0,0 +1,7 @@

+before_install: sudo pip install docutils +rvm: + - 1.9.3 + - 2.0.0 +notifications: + disabled: true +bundler_args: --without development
M README.mdREADME.md

@@ -8,7 +8,7 @@ Markups

------- The following markups are supported. The dependencies listed are required if -you wish to run the library. +you wish to run the library. You can also run `script/bootstrap` to fetch them all. * [.markdown, .mdown, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet) * [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
M lib/github/markup.rblib/github/markup.rb

@@ -88,6 +88,8 @@ end

out.gsub("\r", '') rescue Errno::EPIPE "" + rescue Errno::ENOENT + "" end # Define markups
A script/bootstrap

@@ -0,0 +1,9 @@

+#!/bin/bash + +set -e + +cd $(dirname "$0")/.. + +bundle install +easy_install docutils +brew install asciidoc
A script/cibuild

@@ -0,0 +1,20 @@

+#!/bin/bash + +set -e + +# GC customizations +export RUBY_GC_MALLOC_LIMIT=79000000 +export RUBY_HEAP_MIN_SLOTS=800000 +export RUBY_HEAP_FREE_MIN=100000 +export RUBY_HEAP_SLOTS_INCREMENT=400000 +export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 + +export PATH="/usr/share/rbenv/shims:$PATH" +export RBENV_VERSION="1.9.3" + +# bootstrap gem environment changes +echo "Bootstrapping gem environment ..." + +script/bootstrap --local + +rake
M test/markup_test.rbtest/markup_test.rb

@@ -12,8 +12,8 @@ define_method "test_#{markup}" do

source = File.read(readme) expected_file = "#{readme}.html" - expected = File.read(expected_file) - actual = GitHub::Markup.render(readme, File.read(readme)) + expected = File.read(expected_file).rstrip + actual = GitHub::Markup.render(readme, File.read(readme)).rstrip if source != expected assert(source != actual, "#{markup} did not render anything")
M test/markups/README.asciidoc.htmltest/markups/README.asciidoc.html

@@ -1,12 +1,10 @@

-<div class="ulist"><ul> +<div class="ulist"> +<ul> <li> -<p> -One -</p> +<p>One</p> </li> <li> -<p> -Two -</p> +<p>Two</p> </li> -</ul></div> +</ul> +</div>
M test/markups/README.lhs.htmltest/markups/README.lhs.html

@@ -2,7 +2,7 @@ <h1>Markdown</h1>

<p>Except with more magic added.</p> -<pre><code class="haskell">isPrefixOf :: (Eq a) =&gt; [a] -&gt; [a] -&gt; Bool +<pre><code class="haskell">isPrefixOf :: (Eq a) =&gt; [a] -> [a] -> Bool isPrefixOf [] _ = True isPrefixOf _ [] = False isPrefixOf (x:xs) (y:ys)= x == y &amp;&amp; isPrefixOf xs ys
M test/markups/README.mediawiki.htmltest/markups/README.mediawiki.html

@@ -9,12 +9,12 @@ </p><p>

<table id="toc" class="toc" summary="Contents"><tr><td><div style="font-weight:bold">Table of Contents</div><ul></ul></td></tr></table> </p><p> -<h1> <span class="mw-headline" id="Red_Bridge_JRuby_Embed">Red Bridge (JRuby Embed)</span></h1> +<h1> <span id="Red_Bridge_JRuby_Embed" class="mw-headline">Red Bridge (JRuby Embed)</span></h1> JRuby has long had a private embedding API, which was closely tied to the runtime's internals and therefore changed frequently as JRuby evolved. Since version 1.4, however, we have also provided a more stable public API, known as Red Bridge or JRuby Embed. Existing Java programs written to the <a href="javascript:void(0)">legacy API</a> should still work, but we strongly recommend Red Bridge for all new projects. </p><p> -<h2> <span class="mw-headline" id="Features_of_Red_Bridge">Features of Red Bridge</span></h2>Red Bridge consists of two layers: Embed Core on the bottom, and implementations of <a href="http://www.jcp.org/en/jsr/detail?id=223">JSR223</a> and <a href="http://jakarta.apache.org/bsf/">BSF</a> on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages. +<h2> <span id="Features_of_Red_Bridge" class="mw-headline">Features of Red Bridge</span></h2>Red Bridge consists of two layers: Embed Core on the bottom, and implementations of <a href="http://www.jcp.org/en/jsr/detail?id=223">JSR223</a> and <a href="http://jakarta.apache.org/bsf/">BSF</a> on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages. </p><p> Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons:

@@ -31,5 +31,5 @@ </p><p>

The full <a href="http://jruby-embed.kenai.com/docs/">API documentation</a> has all the gory details. It's worth talking about a couple of the finer points here. </p><p> -<h1> <span class="mw-headline" id="Previous_Embedding_JRuby_Page">Previous Embedding JRuby Page</span></h1>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <a href="javascript:void(0)">legacy embedding</a> page. -</p>+<h1> <span id="Previous_Embedding_JRuby_Page" class="mw-headline">Previous Embedding JRuby Page</span></h1>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <a href="javascript:void(0)">legacy embedding</a> page. +</p>
M test/markups/README.org.htmltest/markups/README.org.html

@@ -4,133 +4,112 @@ <tr><td>Status:</td><td>Under Development</td></tr>

<tr><td>Location:</td><td><a href="http://github.com/bdewey/org-ruby">http://github.com/bdewey/org-ruby</a></td></tr> <tr><td>Version:</td><td>0.5.1</td></tr> </table> -<h1><span class="heading-number heading-number-1">1 </span>Description</h1> -<p>Helpful Ruby routines for parsing orgmode files. The most significant thing this library does today is convert orgmode files to textile. Currently, you cannot do much to customize the conversion. The supplied textile conversion is optimized for extracting &#8220;content&#8221; from the orgfile as opposed to &#8220;metadata.&#8221;</p> -<h1><span class="heading-number heading-number-1">2 </span>History</h1> -<h2><span class="heading-number heading-number-2">2.1 </span>2009-12-30: Version 0.5.1</h2> +<h1><span class="heading-number heading-number-1">1</span> Description</h1> +<p>Helpful Ruby routines for parsing orgmode files. The most + significant thing this library does today is convert orgmode files + to textile. Currently, you cannot do much to customize the + conversion. The supplied textile conversion is optimized for + extracting &#8220;content&#8221; from the orgfile as opposed to &#8220;metadata.&#8221;</p> +<h1><span class="heading-number heading-number-1">2</span> History</h1> +<h2><span class="heading-number heading-number-2">2.1</span> 2009-12-30: Version 0.5.1</h2> <ul> - <li>Minor enhancement: Recognize lines starting with &#8220;:&#8221; as examples. - </li> - <li>Minor enhancement: Recognize #+BEGIN_SRC as source blocks - </li> - <li>Minor enhancement: Add &#8220;src&#8221; and &#8220;example&#8221; classes to &lt;pre&gt; blocks. - </li> + <li>Minor enhancement: Recognize lines starting with &#8220;:&#8221; as examples.</li> + <li>Minor enhancement: Recognize #+BEGIN_SRC as source blocks</li> + <li>Minor enhancement: Add &#8220;src&#8221; and &#8220;example&#8221; classes to &lt;pre&gt; blocks.</li> </ul> -<h2><span class="heading-number heading-number-2">2.2 </span>2009-12-30: Version 0.5.0</h2> +<h2><span class="heading-number heading-number-2">2.2</span> 2009-12-30: Version 0.5.0</h2> <ul> - <li>Parse (but not necessarily <b>use</b>) in-buffer settings. The following in-buffer settings <b>are</b> used: - <ul> - <li>Understand the #+TITLE: directive. - </li> - <li>Exporting todo keywords (option todo:t) - </li> - <li>Numbering headlines (option num:t) - </li> - <li>Skipping text before the first headline (option skip:t) - </li> - <li>Skipping tables (option |:nil) - </li> - <li>Custom todo keywords - </li> - <li>EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of the tree to export - </li> - </ul> + <li>Parse (but not necessarily <b>use</b>) in-buffer settings. The following + in-buffer settings <b>are</b> used: + <ul> + <li>Understand the #+TITLE: directive.</li> + <li>Exporting todo keywords (option todo:t)</li> + <li>Numbering headlines (option num:t)</li> + <li>Skipping text before the first headline (option skip:t)</li> + <li>Skipping tables (option |:nil)</li> + <li>Custom todo keywords</li> + <li>EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of + the tree to export</li> + </ul> </li> - <li>Rewrite &#8220;file:(blah).org&#8221; links to &#8220;http:(blah).html&#8221; links. This makes the inter-links to other org-mode files work. - </li> - <li>Uses &lt;th&gt; tags inside table rows that precede table separators. - </li> + <li>Rewrite &#8220;file:(blah).org&#8221; links to &#8220;http:(blah).html&#8221; links. This + makes the inter-links to other org-mode files work.</li> + <li>Uses &lt;th&gt; tags inside table rows that precede table separators.</li> <li>Bugfixes: - <ul> - <li>Headings now have HTML escaped. - </li> - </ul> + <ul> + <li>Headings now have HTML escaped.</li> + </ul> </li> </ul> -<h2><span class="heading-number heading-number-2">2.3 </span>2009-12-29: Version 0.4.2</h2> +<h2><span class="heading-number heading-number-2">2.3</span> 2009-12-29: Version 0.4.2</h2> <ul> - <li>Got rid of the extraneous newline at the start of code blocks. - </li> - <li>Everything now shows up in code blocks, even org-mode metadata. - </li> + <li>Got rid of the extraneous newline at the start of code blocks.</li> + <li>Everything now shows up in code blocks, even org-mode metadata.</li> <li>Fixed bugs: - <ul> - <li>Regressed smart double quotes with HTML escaping. Added a test case and fixed the regression. - </li> - </ul> + <ul> + <li>Regressed smart double quotes with HTML escaping. Added a test + case and fixed the regression.</li> + </ul> </li> </ul> -<h2><span class="heading-number heading-number-2">2.4 </span>2009-12-29: Version 0.4.1</h2> +<h2><span class="heading-number heading-number-2">2.4</span> 2009-12-29: Version 0.4.1</h2> <ul> - <li>HTML is now escaped by default - </li> - <li>org-mode comments will show up in a code block. - </li> + <li>HTML is now escaped by default</li> + <li>org-mode comments will show up in a code block.</li> </ul> -<h2><span class="heading-number heading-number-2">2.5 </span>2009-12-29: Version 0.4</h2> +<h2><span class="heading-number heading-number-2">2.5</span> 2009-12-29: Version 0.4</h2> <ul> - <li>The first thing output in HTML gets the class &#8220;title&#8221; - </li> - <li>HTML output is now indented - </li> + <li>The first thing output in HTML gets the class &#8220;title&#8221;</li> + <li>HTML output is now indented</li> <li>Proper support for multi-paragraph list items. - <p>See? This paragraph is part of the last bullet.</p> + <p>See? This paragraph is part of the last bullet.</p> </li> <li>Fixed bugs: - <ul> - <li>&#8220;rake spec&#8221; wouldn&#8217;t work on Linux. Needed &#8220;require &#8216;rubygems&#8217;&#8221;. - </li> - </ul> + <ul> + <li>&#8220;rake spec&#8221; wouldn&#8217;t work on Linux. Needed &#8220;require &#8216;rubygems&#8217;&#8221;.</li> + </ul> </li> </ul> -<h2><span class="heading-number heading-number-2">2.6 </span>2009-12-27: Version 0.3</h2> +<h2><span class="heading-number heading-number-2">2.6</span> 2009-12-27: Version 0.3</h2> <ul> - <li>Uses rubypants to get better typography (smart quotes, elipses, etc&#8230;). - </li> + <li>Uses rubypants to get better typography (smart quotes, elipses, etc&#8230;).</li> <li>Fixed bugs: - <ul> - <li>Tables and lists did not get properly closed at the end of file - </li> - <li>You couldn&#8217;t do inline formatting inside table cells - </li> - <li>Characters in PRE blocks were not HTML escaped. - </li> - </ul> + <ul> + <li>Tables and lists did not get properly closed at the end of file</li> + <li>You couldn&#8217;t do inline formatting inside table cells</li> + <li>Characters in PRE blocks were not HTML escaped.</li> + </ul> </li> </ul> -<h2><span class="heading-number heading-number-2">2.7 </span>2009-12-26: Version 0.2</h2> +<h2><span class="heading-number heading-number-2">2.7</span> 2009-12-26: Version 0.2</h2> <ul> - <li>Added <code>to_html</code> output on the parser. - </li> - <li>Added support for the full range of inline markup: <b>bold</b>, <i>italic</i>, <code>code</code>, <code>verbatim</code>, <span style="text-decoration:underline;">underline</span>, <del>strikethrough</del>. - </li> - <li>Lots of refactoring to make the code more maintainable. - </li> + <li>Added <code>to_html</code> output on the parser.</li> + <li>Added support for the full range of inline markup: <b>bold</b>, + <i>italic</i>, <code>code</code>, <code>verbatim</code>, <span style="text-decoration:underline;">underline</span>, <del>strikethrough</del>.</li> + <li>Lots of refactoring to make the code more maintainable.</li> </ul> -<h2><span class="heading-number heading-number-2">2.8 </span>2009-12-23: Version 0.1</h2> +<h2><span class="heading-number heading-number-2">2.8</span> 2009-12-23: Version 0.1</h2> <ul> <li>Added support for block code, like this: - <pre class="example"> - def flush! - @logger.debug "FLUSH ==========&gt; #{@output_type}" - if (@output_type == :blank) then - @output &lt;&lt; "\n" - elsif (@buffer.length &gt; 0) then - if @cancel_modifier then - @output &lt;&lt; "p. " if @output_type == :paragraph - @cancel_modifier = false - end - @output &lt;&lt; @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?) - @output &lt;&lt; @buffer.textile_substitution &lt;&lt; "\n" - end - @buffer = "" - end - </pre> + <pre class="example"> + def flush! + @logger.debug &quot;FLUSH ==========&gt; #{@output_type}&quot; + if (@output_type == :blank) then + @output &lt;&lt; &quot;\n&quot; + elsif (@buffer.length &gt; 0) then + if @cancel_modifier then + @output &lt;&lt; &quot;p. &quot; if @output_type == :paragraph + @cancel_modifier = false + end + @output &lt;&lt; @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?) + @output &lt;&lt; @buffer.textile_substitution &lt;&lt; &quot;\n&quot; + end + @buffer = &quot;&quot; +end + </pre> </li> - <ul> - <li>Major code cleanup: Created the <code>OutputBuffer</code> class that greatly simplified a lot of the messiness of <code>textile</code> conversion. - </li> - <li>Added support for line breaks within list items. - </li> - </ul> + <li>Major code cleanup: Created the <code>OutputBuffer</code> class that + greatly simplified a lot of the messiness of <code>textile</code> + conversion.</li> + <li>Added support for line breaks within list items.</li> </ul>