Class: DocTemplate::Tags::ImageStudentWorksheetTag

Inherits:
BaseTag
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/doc_template/tags/image_student_worksheet_tag.rb

Constant Summary collapse

HEIGHT_MOD =
0.85
TAG_NAME =
'image-student-worksheet'
TEMPLATE =
'image-student-worksheet.html.erb'

Constants inherited from BaseTag

BaseTag::SOFT_RETURN_RE, BaseTag::UNICODE_SPACES_RE

Instance Attribute Summary

Attributes inherited from BaseTag

#anchor, #content

Instance Method Summary collapse

Methods inherited from BaseTag

#before_tag, #check_tag_soft_return, #content_until_break, #content_until_materials, #ela2?, #ela6?, #gdoc?, #include_break?, #include_break_for?, #materials, parse, #parse_nested, #parse_template, #placeholder, #placeholder_id, #render, #replace_tag, #tag_data, tag_with_html_regexp, #template_name, #template_path, template_path_for

Instance Method Details

#parse(node, _options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/doc_template/tags/image_student_worksheet_tag.rb', line 12

def parse(node, _options = {})
  if (image = find_image node)
    image.ancestors('p').first.try(:remove)
    params = prepare_content image
    @content = parse_template params, TEMPLATE
    replace_tag node
  else
    node.remove
  end

  self
end