Class: Coradoc::Element::Block::Core
- Inherits:
-
Coradoc::Element::Base
- Object
- Coradoc::Element::Base
- Coradoc::Element::Block::Core
- Defined in:
- lib/coradoc/element/block/core.rb
Direct Known Subclasses
Example, Literal, Pass, Quote, ReviewerComment, Side, SourceCode
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #gen_anchor ⇒ Object
- #gen_attributes ⇒ Object
- #gen_delimiter ⇒ Object
- #gen_lines ⇒ Object
- #gen_title ⇒ Object
-
#initialize(title, options = {}) ⇒ Core
constructor
A new instance of Core.
- #type ⇒ Object
Methods inherited from Coradoc::Element::Base
#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(title, options = {}) ⇒ Core
Returns a new instance of Core.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/coradoc/element/block/core.rb', line 11 def initialize(title, = {}) @title = title @id = .fetch(:id, nil) @anchor = @id.nil? ? nil : Inline::Anchor.new(@id) @type_str = .fetch(:type, nil) @attributes = .fetch(:attributes, AttributeList.new) @delimiter = .fetch(:delimiter, "") @lang = .fetch(:lang, nil) @lines = .fetch(:lines, []) end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def attributes @attributes end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def id @id end |
#lang ⇒ Object
Returns the value of attribute lang.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def lang @lang end |
#lines ⇒ Object
Returns the value of attribute lines.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def lines @lines end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/coradoc/element/block/core.rb', line 7 def title @title end |
Instance Method Details
#gen_anchor ⇒ Object
26 27 28 |
# File 'lib/coradoc/element/block/core.rb', line 26 def gen_anchor @anchor.nil? ? "" : "#{@anchor.to_adoc}\n" end |
#gen_attributes ⇒ Object
37 38 39 40 41 42 |
# File 'lib/coradoc/element/block/core.rb', line 37 def gen_attributes attrs = @attributes.to_adoc(false) return "#{attrs}\n" if !attrs.empty? "" end |
#gen_delimiter ⇒ Object
44 45 46 |
# File 'lib/coradoc/element/block/core.rb', line 44 def gen_delimiter @delimiter_char * @delimiter_len end |
#gen_lines ⇒ Object
48 49 50 |
# File 'lib/coradoc/element/block/core.rb', line 48 def gen_lines Coradoc::Generator.gen_adoc(@lines) end |
#gen_title ⇒ Object
30 31 32 33 34 35 |
# File 'lib/coradoc/element/block/core.rb', line 30 def gen_title t = Coradoc::Generator.gen_adoc(@title) return "" if t.empty? ".#{t}\n" end |
#type ⇒ Object
22 23 24 |
# File 'lib/coradoc/element/block/core.rb', line 22 def type @type ||= defined_type || type_from_delimiter end |