Merge remote branch 'koraktor/pygments-options' into next
This commit is contained in:
commit
aa9993a6c1
|
@ -4,15 +4,28 @@ module Jekyll
|
||||||
include Liquid::StandardFilters
|
include Liquid::StandardFilters
|
||||||
|
|
||||||
# we need a language, but the linenos argument is optional.
|
# 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)
|
def initialize(tag_name, markup, tokens)
|
||||||
super
|
super
|
||||||
if markup =~ SYNTAX
|
if markup =~ SYNTAX
|
||||||
@lang = $1
|
@lang = $1
|
||||||
if defined? $2
|
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.
|
# additional options to pass to Albino.
|
||||||
@options = { 'O' => 'linenos=inline' }
|
@options = { 'O' => tmp_options.join(',') }
|
||||||
else
|
else
|
||||||
@options = {}
|
@options = {}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue