From 347e855ddc05c4da2f0530db436a9097d8ddbaea Mon Sep 17 00:00:00 2001 From: Frederic Hemberger Date: Sun, 18 Sep 2011 13:55:35 +0200 Subject: [PATCH] Fixes HTML validation issues with code highlighting --- .themes/classic/sass/partials/_syntax.scss | 2 +- plugins/backtick_code_block.rb | 4 ++-- plugins/pygments_code.rb | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.themes/classic/sass/partials/_syntax.scss b/.themes/classic/sass/partials/_syntax.scss index 25e8d32..713d46e 100644 --- a/.themes/classic/sass/partials/_syntax.scss +++ b/.themes/classic/sass/partials/_syntax.scss @@ -201,7 +201,7 @@ pre, .highlight, .gist-highlight { } .highlight code { @extend .pre-code; background: #000;} -figure[role=code] { +figure.code { background: none; padding: 0; border: 0; diff --git a/plugins/backtick_code_block.rb b/plugins/backtick_code_block.rb index 7f5076d..6243de6 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 b87413f..c009df9 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