Class: Webgen::ContentProcessor::Kramdown::CustomHtmlConverter

Inherits:
Kramdown::Converter::Html
  • Object
show all
Defined in:
lib/webgen/content_processor/kramdown.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(root, options, context) ⇒ CustomHtmlConverter

Returns a new instance of CustomHtmlConverter.



15
16
17
18
19
20
# File 'lib/webgen/content_processor/kramdown.rb', line 15

def initialize(root, options, context)
  super(root, options)
  @context = context
  @do_convert = context.website.config['content_processor.kramdown.handle_links']
  @ignore_fragments = context.website.config['content_processor.kramdown.ignore_unknown_fragments']
end

Instance Method Details

#convert_a(el, indent) ⇒ Object



22
23
24
25
26
# File 'lib/webgen/content_processor/kramdown.rb', line 22

def convert_a(el, indent)
  el.attr['href'] = @context.tag('relocatable', {'path' => el.attr['href'],
                                   'ignore_unknown_fragment' => @ignore_fragments}) if @do_convert
  super
end

#convert_img(el, indent) ⇒ Object



28
29
30
31
32
# File 'lib/webgen/content_processor/kramdown.rb', line 28

def convert_img(el, indent)
  el.attr['src'] = @context.tag('relocatable', {'path' => el.attr['src'],
                                  'ignore_unknown_fragment' => @ignore_fragments}) if @do_convert
  super
end