From 347e855ddc05c4da2f0530db436a9097d8ddbaea Mon Sep 17 00:00:00 2001 From: Frederic Hemberger Date: Sun, 18 Sep 2011 13:55:35 +0200 Subject: Fixes HTML validation issues with code highlighting --- plugins/backtick_code_block.rb | 4 ++-- plugins/pygments_code.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/backtick_code_block.rb b/plugins/backtick_code_block.rb index 7f5076df..6243de6f 100644 --- a/plugins/backtick_code_block.rb +++ b/plugins/backtick_code_block.rb @@ -27,7 +27,7 @@ module BacktickCodeBlock end if @lang.nil? || @lang == 'plain' code = tableize_code(str.gsub('<','<').gsub('>','>')) - "
#{@caption}#{code}
" + "
#{@caption}#{code}
" else if @lang.include? "-raw" raw = "``` #{@options.sub('-raw', '')}\n" @@ -35,7 +35,7 @@ module BacktickCodeBlock raw += "\n```\n" else code = highlight(str, @lang) - "
#{@caption}#{code}
" + "
#{@caption}#{code}
" end end end diff --git a/plugins/pygments_code.rb b/plugins/pygments_code.rb index b87413f5..c009df9f 100644 --- a/plugins/pygments_code.rb +++ b/plugins/pygments_code.rb @@ -30,12 +30,12 @@ module HighlightCode highlighted_code end def tableize_code (str, lang = '') - table = '
'
+    table = '
'
     code = ''
     str.lines.each_with_index do |line,index|
-      table += "#{index+1}\n"
-      code  += "
#{line}
" + table += "#{index+1}\n" + code += "#{line}" end - table += "
#{code}
" + table += "
#{code}
" end end -- cgit v1.2.1