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