Added passing of all options to Pygments, not just "linenos"

This commit is contained in:
Sebastian Staudt 2009-05-04 23:53:40 +02:00
parent a4f3f5c583
commit ef6aa6b5c4
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