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

This commit is contained in:
Tom Preston-Werner 2010-06-21 19:31:22 -07:00
commit aa9993a6c1
1 changed files with 15 additions and 2 deletions

View File

@ -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