class Jekyll::Lilypond::TagProcessor

Attributes

site[RW]

Public Class Methods

new(site, tag) click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 6
def initialize(site, tag)
  @site = site
  @tag = tag
end

Public Instance Methods

file_processor() click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 32
def file_processor
  FileProcessor.new("#{site.source}/lilypond_files", hash, source)
end
hash() click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 19
def hash
  Digest::MD5.hexdigest(source)
end
include() click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 23
def include
  @tag.attrs.update("filename" => hash)
  include_template_obj.render(@tag)
end
include_template_obj() click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 28
def include_template_obj
  Template.new(@site, @tag, :include)
end
run!() click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 36
def run! 
  fp = file_processor
  fp.write
  fp.compile
  fp.trim_svg
  fp.make_mp3 if @tag.attrs["mp3"] == "true"

  @site.static_files << StaticFile.new(site, 
                                       site.source, 
                                       "lilypond_files", 
                                       "#{hash}-trimmed.svg") 

  @site.static_files << StaticFile.new(site, 
                                       site.source, 
                                       "lilypond_files", 
                                       "#{hash}.mp3") if @tag.attrs["mp3"] == "true"
end
source() click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 11
def source
  source_template_obj.render(@tag)
end
source_template_obj() click to toggle source
# File lib/jekyll-lilypond/tag_processor.rb, line 15
def source_template_obj
  Template.new(@site, @tag, :source)
end