516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
|
# File 'lib/showoff_utils.rb', line 516
def self.setup(dir_name)
require 'tilt'
require 'tilt/erb'
renderer = ShowOffUtils.showoff_markdown(dir_name)
begin
case renderer
when 'rdiscount'
Tilt.prefer Tilt::RDiscountTemplate, "markdown"
when 'maruku'
Tilt.prefer Tilt::MarukuTemplate, "markdown"
require 'maruku'
require 'maruku/ext/math'
opts = ShowOffUtils.showoff_renderer_options(dir_name,
{ :use_tex => false,
:png_dir => 'images',
:html_png_url => '/file/images/'})
if opts[:use_tex]
MaRuKu::Globals[:html_math_output_mathml] = false
MaRuKu::Globals[:html_math_output_png] = true
MaRuKu::Globals[:html_math_engine] = 'none'
MaRuKu::Globals[:html_png_engine] = 'blahtex'
MaRuKu::Globals[:html_png_dir] = opts[:png_dir]
MaRuKu::Globals[:html_png_url] = opts[:html_png_url]
end
when 'bluecloth'
Tilt.prefer Tilt::BlueClothTemplate, "markdown"
when 'kramdown'
Tilt.prefer Tilt::KramdownTemplate, "markdown"
when 'commonmarker'
Tilt.prefer Tilt::CommonMarkerTemplate, "markdown"
else
Tilt.prefer Tilt::RedcarpetTemplate, "markdown"
end
rescue LoadError
puts "ERROR: The #{renderer} markdown rendering engine does not appear to be installed correctly."
exit! 1
end
end
|