class Presentation::SlideDSL
Public Instance Methods
bullet(bullet)
click to toggle source
# File lib/presentation/dsl.rb, line 67 def bullet(bullet) slide.list ||= [] slide.list << bullet end
Also aliased as: b
code(language, text, line_numbers: true)
click to toggle source
# File lib/presentation/dsl.rb, line 43 def code(language, text, line_numbers: true) options = {} options[:line_numbers] = :inline if line_numbers html = CodeRay.scan(text, language).span(options) # puts "Before:\n" + html # remove unsupported properties html.gsub! '<span class="CodeRay">', '' html.gsub! /<\/span>\z/, '' html.gsub! /font-weight:bold/, '' # convert inline styles to Gosu compatible color tags html.gsub! /<span style="background-color:hsla.*?">/, '<c=FFFFFF>' html.gsub! /<span class="line-numbers">(?<space> )?(<strong>)?<a href="#n\d+?" name="n\d+?">(?<number>\d+?)<\/a>(<\/strong>)?(<\/span>)?/, '\k<space>\k<number> ' html.gsub! /<span style="color:#([0-9a-fA-F]{3});?">/ do |m| color = $1.chars.map{|s|s*2}.join "<c=#{color}>" end html.gsub! '</span>', '</c>' html.gsub! '"', '"' # puts "After:\n" + html slide.code = html end
method_missing(method, *args, &block)
click to toggle source
# File lib/presentation/dsl.rb, line 35 def method_missing(method, *args, &block) if method =~ /(.*)_code$/ code($1, *args, &block) else slide.send("#{method}=", *args, &block) end end
slide()
click to toggle source
# File lib/presentation/dsl.rb, line 31 def slide @slide ||= Slide.new end