Adaptation to MathJax

This commit is contained in:
Yann Esposito (Yogsototh) 2010-09-16 16:39:16 +02:00
parent f67b94ffa6
commit d576a915a8
3 changed files with 16 additions and 1 deletions

1
Rules
View file

@ -45,6 +45,7 @@ compile '/html/*' do
elsif ext == 'md' || ext == 'markdown'
filter :erb
filter :kramdown
filter :math_repair # after kramdown
else
raise "Filter is not configured for #{item.identifier} in Rules file."
end

View file

@ -20,7 +20,7 @@ conf=LocalConf.new
language=@item_rep.path.sub(/\/Scratch\//,'').sub(/\/.*$/,'')
conf.language=language
containMaths=yield.match('class="math"')
containMaths=yield.match(/$(.|\n)*$/)
conf.containMaths=containMaths
# the current item is an article

View file

@ -20,6 +20,20 @@ def allExceptCode( f, content )
end
module Nanoc3::Filters
class MathJaxKramdownRepair < Nanoc3::Filter
identifiers :math_repair
def description(content)
content.gsub(/<div class="math">(.+?)<\/div>/m) do
return %{$$ #{$1} $$}
end
end
def run(content, params={})
allExceptCode( :description , content )
end
end
class Description < Nanoc3::Filter
identifiers :description