Class: Metanorma::Iso::Sts::Transformer::TableTransformer
- Inherits:
-
Transformer::Base
- Object
- Transformer::Base
- Metanorma::Iso::Sts::Transformer::TableTransformer
- Defined in:
- lib/metanorma/iso/sts/transformer/table_transformer.rb
Instance Method Summary collapse
Instance Method Details
#transform(table) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/metanorma/iso/sts/transformer/table_transformer.rb', line 31 def transform(table) build_ordered(::Sts::TbxIsoTml::Table) do |t| t.width = table.width if table.width t.summary = table.summary if table.summary if table.colgroup cg = build_ordered(::Sts::TbxIsoTml::Colgroup) do |colgroup| Array(table.colgroup.col).each do |col| c = ::Sts::TbxIsoTml::Col.new c.width = col.width if col.width colgroup.col c end end t.colgroup cg end if table.thead t.thead transform_section(table.thead, ::Sts::TbxIsoTml::Thead) end if table.tbody t.tbody transform_section(table.tbody, ::Sts::TbxIsoTml::Tbody) end if table.tfoot t.tfoot transform_section(table.tfoot, ::Sts::TbxIsoTml::Tfoot) end end end |
#transform_wrap(table) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/metanorma/iso/sts/transformer/table_transformer.rb', line 7 def transform_wrap(table) build_ordered(::Sts::TbxIsoTml::TableWrap) do |tw| tw.id = id_for(table) table_label = label_for(table) tw.label table_label if table_label if table.name caption = build_ordered(::Sts::NisoSts::Caption) do |c| inline_transformer.apply_inline_content(table.name, c) end tw.caption caption end tw.table transform(table) if table.note && !table.note.empty? table.note.each do |n| tw.non_normative_note note_transformer.transform(n) end end end end |