lib/isodoc/section.rb in isodoc-0.5.7 vs lib/isodoc/section.rb in isodoc-0.5.8
- old
+ new
@@ -41,13 +41,16 @@
h1 << title
end
div.parent.at(".//h1")
end
+ MIDDLE_CLAUSE =
+ "//clause[parent::sections][not(xmlns:title = 'Scope')]"\
+ "[not(descendant::terms)]".freeze
+
def clause(isoxml, out)
- isoxml.xpath(ns("//clause[parent::sections]")).each do |c|
- next if c.at(ns("./title")).text == "Scope"
+ isoxml.xpath(ns(MIDDLE_CLAUSE)).each do |c|
out.div **attr_code(id: c["id"]) do |s|
c.elements.each do |c1|
if c1.name == "title"
clause_name("#{get_anchors[c['id']][:label]}.",
c1.content, s, nil)
@@ -122,14 +125,18 @@
symbols = f.at(".//symbols-abbrevs")
return @termsdefsymbols_lbl if symbols
@termsdef_lbl
end
+ TERM_CLAUSE = "//sections/terms | "\
+ "//sections/clause[descendant::terms]".freeze
+
def terms_defs(isoxml, out)
- f = isoxml.at(ns("//sections/terms")) || return
+ f = isoxml.at(ns(TERM_CLAUSE)) || return
out.div **attr_code(id: f["id"]) do |div|
clause_name("3.", terms_defs_title(f), div, nil)
- term_defs_boilerplate(div, f.xpath(ns("./source")), f.at(ns(".//term")))
+ term_defs_boilerplate(div, isoxml.xpath(ns(".//termdocsource")),
+ f.at(ns(".//term")))
f.elements.each do |e|
parse(e, div) unless %w{title source}.include? e.name
end
end
end