lib/isodoc/section.rb in isodoc-0.5.8 vs lib/isodoc/section.rb in isodoc-0.5.9
- old
+ new
@@ -81,18 +81,20 @@
end
end
end
end
- def scope(isoxml, out)
- f = isoxml.at(ns("//clause[title = 'Scope']")) || return
+ def scope(isoxml, out, num)
+ f = isoxml.at(ns("//clause[title = 'Scope']")) or return num
out.div **attr_code(id: f["id"]) do |div|
- clause_name("1.", @scope_lbl, div, nil)
+ num = num + 1
+ clause_name("#{num}.", @scope_lbl, div, nil)
f.elements.each do |e|
parse(e, div) unless e.name == "title"
end
end
+ num
end
def external_terms_boilerplate(sources)
@external_terms_boilerplate.gsub(/%/, sources)
end
@@ -109,11 +111,11 @@
end
div << @term_def_boilerplate
end
def term_defs_boilerplate_cont(src, term)
- sources = sentence_join(src.map { |s| s["citeas"] })
+ sources = sentence_join(src.map { |s| @anchors[s["target"]][:xref] })
if src.empty?
@internal_terms_boilerplate
elsif term.nil?
external_terms_boilerplate(sources)
else
@@ -128,35 +130,39 @@
end
TERM_CLAUSE = "//sections/terms | "\
"//sections/clause[descendant::terms]".freeze
- def terms_defs(isoxml, out)
- f = isoxml.at(ns(TERM_CLAUSE)) || return
+ def terms_defs(isoxml, out, num)
+ f = isoxml.at(ns(TERM_CLAUSE)) or return num
out.div **attr_code(id: f["id"]) do |div|
- clause_name("3.", terms_defs_title(f), div, nil)
+ num = num + 1
+ clause_name("#{num}.", terms_defs_title(f), div, nil)
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
+ num
end
# subclause
def terms_parse(isoxml, out)
clause_parse(isoxml, out)
end
- def symbols_abbrevs(isoxml, out)
- f = isoxml.at(ns("//sections/symbols-abbrevs")) || return
+ def symbols_abbrevs(isoxml, out, num)
+ f = isoxml.at(ns("//sections/symbols-abbrevs")) or return num
out.div **attr_code(id: f["id"], class: "Symbols") do |div|
- clause_name("4.", @symbols_lbl, div, nil)
+ num = num + 1
+ clause_name("#{num}.", @symbols_lbl, div, nil)
f.elements.each do |e|
parse(e, div) unless e.name == "title"
end
end
+ num
end
# subclause
def symbols_parse(isoxml, out)
isoxml.children.first.previous =
@@ -164,10 +170,10 @@
clause_parse(isoxml, out)
end
def introduction(isoxml, out)
f = isoxml.at(ns("//introduction")) || return
- num = f.at(ns(".//subsection")) ? "0." : nil
+ num = f.at(ns(".//clause")) ? "0." : nil
title_attr = { class: "IntroTitle" }
page_break(out)
out.div **{ class: "Section3", id: f["id"] } do |div|
# div.h1 "Introduction", **attr_code(title_attr)
clause_name(num, @introduction_lbl, div, title_attr)