lib/isodoc/gb/gbhtmlrender.rb in metanorma-gb-1.1.2 vs lib/isodoc/gb/gbhtmlrender.rb in metanorma-gb-1.1.3

- old
+ new

@@ -195,9 +195,40 @@ allparts = ref.at(ns("./allparts")) reference = format_ref(docid.text, isopub, date, allparts) @anchors[ref["id"]] = { xref: reference } end =end + + def example_p_parse(node, div) + div.p do |p| + p.span **{ class: "example_label" } do |s| + s << example_label(node) + end + insert_tab(p, 1) + node.first_element_child.children.each { |n| parse(n, p) } + end + node.element_children[1..-1].each { |n| parse(n, div) } + end + + def example_parse1(node, div) + div.p do |p| + p.span **{ class: "example_label" } do |s| + s << example_label(node) + end + insert_tab(p, 1) + end + node.children.each { |n| parse(n, div) } + end + + def example_parse(node, out) + out.div **{ id: node["id"], class: "example" } do |div| + if node.first_element_child.name == "p" + example_p_parse(node, div) + else + example_parse1(node, div) + end + end + end end end end