lib/metanorma/standoc/blocks.rb in metanorma-standoc-2.6.2 vs lib/metanorma/standoc/blocks.rb in metanorma-standoc-2.6.3

- old
+ new

@@ -1,7 +1,8 @@ require "uri" if /^2\./.match?(RUBY_VERSION) require_relative "./blocks_notes" +require_relative "./blocks_image" module Metanorma module Standoc module Blocks def id_attr(node = nil) @@ -91,14 +92,14 @@ end end.join("\n") end def example(node) - (in_terms? || node.option?("termexample")) and return term_example(node) role = node.role || node.attr("style") ret = example_to_requirement(node, role) || example_by_role(node, role) and return ret + (in_terms? || node.option?("termexample")) and return term_example(node) reqt_subpart?(role) and return requirement_subpart(node) example_proper(node) end def example_by_role(node, role) @@ -117,29 +118,10 @@ select_requirement_model(node) requirement(node, @reqt_models.requirement_roles[role.to_sym], role) end - def svgmap_attrs(node) - attr_code(id_attr(node) - .merge(id: node.id, number: node.attr("number"), - unnumbered: node.option?("unnumbered") ? "true" : nil, - subsequence: node.attr("subsequence")) - .merge(keep_attrs(node))) - end - - def svgmap_example(node) - noko do |xml| - xml.svgmap **attr_code(svgmap_attrs(node).merge( - src: node.attr("src"), alt: node.attr("alt"), - )) do |ex| - figure_title(node, ex) - ex << node.content - end - end.join("\n") - end - # prevent A's and other subs inappropriate for pseudocode def pseudocode_example(node) node.blocks.each { |b| b.remove_sub(:replacements) } noko do |xml| xml.figure **example_attrs(node).merge(class: "pseudocode") do |ex| @@ -158,37 +140,9 @@ xml.example **example_attrs(node) do |ex| node.title.nil? or ex.name { |name| name << node.title } wrap_in_para(node, ex) end end.join("\n") - end - - def figure_example(node) - noko do |xml| - xml.figure **figure_attrs(node) do |ex| - node.title.nil? or ex.name { |name| name << node.title } - wrap_in_para(node, ex) - end - end.join("\n") - end - - def figure_title(node, out) - node.title.nil? and return - out.name { |name| name << node.title } - end - - def figure_attrs(node) - attr_code(id_unnum_attrs(node).merge(keep_attrs(node)) - .merge(class: node.attr("class"))) - end - - def image(node) - noko do |xml| - xml.figure **figure_attrs(node) do |f| - figure_title(node, f) - f.image **image_attributes(node) - end - end end def para_attrs(node) attr_code(id_attr(node).merge(keep_attrs(node) .merge(align: node.attr("align"),