mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Merge pull request #35 from github/pygments-new-lines
Preserve new lines for syntax highlighting
This commit is contained in:
		@@ -141,7 +141,7 @@ module Linguist
 | 
			
		||||
    #
 | 
			
		||||
    # Returns html String
 | 
			
		||||
    def colorize(text)
 | 
			
		||||
      Albino.colorize(text, self)
 | 
			
		||||
      Albino.new(text, self).colorize(:O => 'stripnl=false')
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Public: Highlight syntax of text without the outer highlight div
 | 
			
		||||
 
 | 
			
		||||
@@ -459,6 +459,16 @@ Hello
 | 
			
		||||
      assert_equal <<-HTML, Language['Ruby'].colorize_without_wrapper("def foo\n  'foo'\nend\n")
 | 
			
		||||
<span class="k">def</span> <span class="nf">foo</span>
 | 
			
		||||
  <span class="s1">'foo'</span>
 | 
			
		||||
<span class="k">end</span>
 | 
			
		||||
      HTML
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_colorize_doesnt_strip_newlines
 | 
			
		||||
      assert_equal <<-HTML, Language['Ruby'].colorize_without_wrapper("\n\n# Foo\ndef 'foo'\nend\n")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<span class="c1"># Foo</span>
 | 
			
		||||
<span class="k">def</span> <span class="s1">'foo'</span>
 | 
			
		||||
<span class="k">end</span>
 | 
			
		||||
      HTML
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user