Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'koraktor/pygments-options' into next

  • Loading branch information...
commit aa9993a6c13d5510bc7be7110634ce0dfaad2b95 2 parents 8a417e8 + ef6aa6b
@mojombo mojombo authored
Showing with 15 additions and 2 deletions.
  1. +15 −2 lib/jekyll/tags/highlight.rb
View
17 lib/jekyll/tags/highlight.rb
@@ -4,15 +4,28 @@ class HighlightBlock < Liquid::Block
include Liquid::StandardFilters
# we need a language, but the linenos argument is optional.
- SYNTAX = /(\w+)\s?(:?linenos)?\s?/
+ SYNTAX = /(\w+)\s?([\w\s=]+)*/
def initialize(tag_name, markup, tokens)
super
if markup =~ SYNTAX
@lang = $1
if defined? $2
+ tmp_options = {}
+ $2.split.each do |opt|
+ key, value = opt.split('=')
+ if value.nil?
+ if key == 'linenos'
+ value = 'inline'
+ else
+ value = true
+ end
+ end
+ tmp_options[key] = value
+ end
+ tmp_options = tmp_options.to_a.collect { |opt| opt.join('=') }
# additional options to pass to Albino.
- @options = { 'O' => 'linenos=inline' }
+ @options = { 'O' => tmp_options.join(',') }
else
@options = {}
end
Please sign in to comment.
Something went wrong with that request. Please try again.