Class: Jekyll::LilyPondConverter

Inherits:
Converter
  • Object
show all
Defined in:
lib/jekyll_ext/converter.rb

Constant Summary collapse

DEFAULT_CONFIG =
{
  "lilypond-image-format" => "svg"
}

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ LilyPondConverter

Returns a new instance of LilyPondConverter.



11
12
13
# File 'lib/jekyll_ext/converter.rb', line 11

def initialize(config = {})
  @config = Jekyll::Utils.deep_merge_hashes(DEFAULT_CONFIG, config)
end

Instance Method Details

#convert(content) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/jekyll_ext/converter.rb', line 23

def convert(content)
  ensure_valid_image_format(image_format)

  ::JekyllLilyPondConverter::Handler.new(
    content: content,
    naming_policy: ::JekyllLilyPondConverter::NamingPolicy.new,
    image_format: image_format,
    site_manager: ::JekyllLilyPondConverter::SiteManager.instance,
    static_file_builder: Jekyll::LilyPondStaticFileBuilder
  ).execute
end

#matches(ext) ⇒ Object



15
16
17
# File 'lib/jekyll_ext/converter.rb', line 15

def matches(ext)
  /md|markdown/.match?(ext)
end

#output_ext(ext) ⇒ Object



19
20
21
# File 'lib/jekyll_ext/converter.rb', line 19

def output_ext(ext)
  ".html"
end