Merge remote branch 'koraktor/pygments-options' into next
This commit is contained in:
commit
aa9993a6c1
|
@ -4,15 +4,28 @@ module Jekyll
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue