lib/isodoc/function/inline.rb in isodoc-1.0.13 vs lib/isodoc/function/inline.rb in isodoc-1.0.14

- old
+ new

@@ -43,29 +43,30 @@ elsif node["target"] && !/.#./.match(node["target"]) linkend = anchor(node["target"], :xref) container = anchor(node["target"], :container, false) (container && get_note_container_id(node) != container && @anchors[node["target"]]) && - linkend = prefix_container(container, linkend, node["target"]) + linkend = prefix_container(container, linkend, node["target"]) end linkend || "???" end def get_linkend(node) link = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"])) link += eref_localities(node.xpath(ns("./locality")), link) - contents = node.children.select { |c| c.name != "locality" } + contents = node.children.select { |c| c.name != "locality" }. + select { |c| !c.text? || /\S/.match(c) } return link if contents.nil? || contents.empty? Nokogiri::XML::NodeSet.new(node.document, contents).to_xml # so not <origin bibitemid="ISO7301" citeas="ISO 7301"> # <locality type="section"><reference>3.1</reference></locality></origin> end def xref_parse(node, out) target = /#/.match(node["target"]) ? node["target"].sub(/#/, ".html#") : "##{node["target"]}" - out.a(**{ "href": target }) { |l| l << get_linkend(node) } + out.a(**{ "href": target }) { |l| l << get_linkend(node) } end def eref_localities(refs, target) ret = "" refs.each do |r| @@ -87,10 +88,26 @@ else out.a(**{ "href": "#" + node["bibitemid"] }) { |l| l << linkend } end end + def termrefelem_parse(node, out) + out << "Termbase #{node['base']}, term ID #{node['target']}" + end + + def concept_parse(node, out) + content = node.first_element_child.children.select { |c| c.name != "locality" }. + select { |c| !c.text? || /\S/.match(c) } + if content.empty? + out << "[Term defined in " + parse(node.first_element_child, out) + out << "]" + else + content.each { |n| parse(n, out) } + end + end + def stem_parse(node, out) ooml = if node["type"] == "AsciiMath" "#{@openmathdelim}#{HTMLEntities.new.encode(node.text)}#{@closemathdelim}" elsif node["type"] == "MathML" then node.first_element_child.to_s else @@ -99,10 +116,10 @@ out.span **{ class: "stem" } do |span| span.parent.add_child ooml end end - def image_title_parse(out, caption) + def image_title_parse(out, caption) unless caption.nil? out.p **{ class: "FigureTitle", style: "text-align:center;" } do |p| p.b { |b| b << caption.to_s } end end