Class: Coradoc::Input::Html::Converters::Td
- Inherits:
-
Base
- Object
- Base
- Coradoc::Input::Html::Converters::Td
show all
- Defined in:
- lib/coradoc/html/input/converters/td.rb
Constant Summary
collapse
- INSTANCE =
new
Instance Method Summary
collapse
Methods inherited from Base
#extract_leading_trailing_whitespace, #extract_text_from_content, #extract_title, #node_has_ancestor?, #textnode_after_start_with?, #textnode_before_end_with?, #treat_children_coradoc, #treat_coradoc, #unconstrained_after?, #unconstrained_before?
Instance Method Details
29
30
31
32
33
34
35
36
|
# File 'lib/coradoc/html/input/converters/td.rb', line 29
def (node)
align = node['align']
case align
when 'left' then 'left'
when 'center' then 'center'
when 'right' then 'right'
end
end
|
#to_coradoc(node, state = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/coradoc/html/input/converters/td.rb', line 10
def to_coradoc(node, state = {})
colspan = node['colspan']&.to_i
rowspan = node['rowspan']&.to_i
alignment = (node)
singlepara = node.elements.size == 1 && node.elements.first.name == 'p'
state[:tdsinglepara] = singlepara if singlepara
content = treat_children_coradoc(node, state)
Coradoc::CoreModel::TableCell.new(
content: (content),
alignment: alignment,
colspan: colspan && colspan > 1 ? colspan : nil,
rowspan: rowspan && rowspan > 1 ? rowspan : nil,
header: node.name == 'th'
)
end
|