Class: Coradoc::Element::Table::Cell
- Defined in:
- lib/coradoc/element/table.rb
Instance Attribute Summary collapse
-
#alignattr ⇒ Object
Returns the value of attribute alignattr.
-
#anchor ⇒ Object
Returns the value of attribute anchor.
-
#colrowattr ⇒ Object
Returns the value of attribute colrowattr.
-
#content ⇒ Object
Returns the value of attribute content.
-
#id ⇒ Object
Returns the value of attribute id.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
- #asciidoc? ⇒ Boolean
-
#initialize(options = {}) ⇒ Cell
constructor
A new instance of Cell.
- #to_adoc ⇒ Object
Methods inherited from Base
#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(options = {}) ⇒ Cell
Returns a new instance of Cell.
61 62 63 64 65 66 67 68 69 |
# File 'lib/coradoc/element/table.rb', line 61 def initialize( = {}) super() @id = .fetch(:id, nil) @anchor = @id.nil? ? nil : Inline::Anchor.new(@id) @colrowattr = .fetch(:colrowattr, "") @alignattr = .fetch(:alignattr, "") @style = .fetch(:style, "") @content = .fetch(:content, "") end |
Instance Attribute Details
#alignattr ⇒ Object
Returns the value of attribute alignattr.
57 58 59 |
# File 'lib/coradoc/element/table.rb', line 57 def alignattr @alignattr end |
#anchor ⇒ Object
Returns the value of attribute anchor.
57 58 59 |
# File 'lib/coradoc/element/table.rb', line 57 def anchor @anchor end |
#colrowattr ⇒ Object
Returns the value of attribute colrowattr.
57 58 59 |
# File 'lib/coradoc/element/table.rb', line 57 def colrowattr @colrowattr end |
#content ⇒ Object
Returns the value of attribute content.
57 58 59 |
# File 'lib/coradoc/element/table.rb', line 57 def content @content end |
#id ⇒ Object
Returns the value of attribute id.
57 58 59 |
# File 'lib/coradoc/element/table.rb', line 57 def id @id end |
#style ⇒ Object
Returns the value of attribute style.
57 58 59 |
# File 'lib/coradoc/element/table.rb', line 57 def style @style end |
Instance Method Details
#asciidoc? ⇒ Boolean
71 72 73 |
# File 'lib/coradoc/element/table.rb', line 71 def asciidoc? @style.include?("a") end |
#to_adoc ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/coradoc/element/table.rb', line 75 def to_adoc anchor = @anchor.nil? ? "" : @anchor.to_adoc.to_s content = simplify_block_content(@content) content = Coradoc::Generator.gen_adoc(content) # Only try to postprocess elements that are text, # otherwise we could strip markup. if Coradoc.a_single?(@content, Coradoc::Element::TextElement) content = Coradoc.strip_unicode(content) end "#{@colrowattr}#{@alignattr}#{@style}| #{anchor}#{content}" end |