Class: Coradoc::Element::Image::BlockImage
- Extended by:
- AttributeList::Matchers
- Defined in:
- lib/coradoc/element/image/block_image.rb
Constant Summary collapse
- VALIDATORS_NAMED_BLOCK =
{ caption: String, align: one("left", "center", "right"), float: one("left", "right"), }
Constants inherited from Core
Core::VALIDATORS_NAMED, Core::VALIDATORS_POSITIONAL
Instance Attribute Summary
Attributes inherited from Core
#attributes, #id, #src, #title
Instance Method Summary collapse
-
#initialize(title, id, src, options = {}) ⇒ BlockImage
constructor
A new instance of BlockImage.
- #to_adoc ⇒ Object
- #validate_named ⇒ Object
Methods included from AttributeList::Matchers
Methods inherited from Base
#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(title, id, src, options = {}) ⇒ BlockImage
Returns a new instance of BlockImage.
5 6 7 8 |
# File 'lib/coradoc/element/image/block_image.rb', line 5 def initialize(title, id, src, = {}) super @colons = "::" end |
Instance Method Details
#to_adoc ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/coradoc/element/image/block_image.rb', line 10 def to_adoc missing = "// FIXME: Missing image: #{@annotate_missing}\n" if @annotate_missing anchor = @anchor.nil? ? "" : "#{@anchor.to_adoc}\n" title = ".#{@title}\n" unless @title.to_s.empty? attrs = @attributes.to_adoc [missing, anchor, title, "image", @colons, @src, attrs, @line_break].join("") end |
#validate_named ⇒ Object
18 19 20 |
# File 'lib/coradoc/element/image/block_image.rb', line 18 def validate_named @attributes.validate_named(VALIDATORS_NAMED, VALIDATORS_NAMED_BLOCK) end |