Module: IsoDoc::Function::Section
- Included in:
 - Common
 
- Defined in:
 - lib/isodoc/function/section.rb
 
Constant Summary collapse
- MIDDLE_CLAUSE =
 "//clause[parent::sections][not(xmlns:title = 'Scope')]"\ "[not(descendant::terms)]".freeze
- TERM_CLAUSE =
 "//sections/terms | "\ "//sections/clause[descendant::terms]".freeze
Instance Method Summary collapse
- #abstract(isoxml, out) ⇒ Object
 - #acknowledgements(isoxml, out) ⇒ Object
 - #annex(isoxml, out) ⇒ Object
 - #annex_name(annex, name, div) ⇒ Object
 - #clause(isoxml, out) ⇒ Object
 - #clause_name(num, title, div, header_class) ⇒ Object
 - 
  
    
      #clause_parse(node, out)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
used for subclauses.
 - 
  
    
      #clause_parse_title(node, div, c1, out)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
used for subclauses.
 - #clausedelim ⇒ Object
 - #clausedelimspace(out) ⇒ Object
 - #copyright_parse(node, out) ⇒ Object
 - #feedback_parse(node, out) ⇒ Object
 - #foreword(isoxml, out) ⇒ Object
 - #inline_header_title(out, node, c1) ⇒ Object
 - #introduction(isoxml, out) ⇒ Object
 - #legal_parse(node, out) ⇒ Object
 - #license_parse(node, out) ⇒ Object
 - #preface(isoxml, out) ⇒ Object
 - #scope(isoxml, out, num) ⇒ Object
 - #symbols_abbrevs(isoxml, out, num) ⇒ Object
 - 
  
    
      #symbols_parse(isoxml, out)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
subclause.
 - #terms_defs(isoxml, out, num) ⇒ Object
 - #terms_defs_title(f) ⇒ Object
 - 
  
    
      #terms_parse(isoxml, out)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
subclause.
 
Instance Method Details
#abstract(isoxml, out) ⇒ Object
      190 191 192 193 194 195 196 197  | 
    
      # File 'lib/isodoc/function/section.rb', line 190 def abstract(isoxml, out) f = isoxml.at(ns("//preface/abstract")) || return page_break(out) out.div **attr_code(id: f["id"]) do |s| s.h1(**{ class: "AbstractTitle" }) { |h1| h1 << @abstract_lbl } f.elements.each { |e| parse(e, s) unless e.name == "title" } end end  | 
  
#acknowledgements(isoxml, out) ⇒ Object
      178 179 180 181 182 183 184 185 186 187 188  | 
    
      # File 'lib/isodoc/function/section.rb', line 178 def acknowledgements(isoxml, out) f = isoxml.at(ns("//acknowledgements")) || return title_attr = { class: "IntroTitle" } page_break(out) out.div **{ class: "Section3", id: f["id"] } do |div| clause_name(nil, f&.at(ns("./title")), div, title_attr) f.elements.each do |e| parse(e, div) unless e.name == "title" end end end  | 
  
#annex(isoxml, out) ⇒ Object
      85 86 87 88 89 90 91 92 93 94 95 96 97 98  | 
    
      # File 'lib/isodoc/function/section.rb', line 85 def annex(isoxml, out) isoxml.xpath(ns("//annex")).each do |c| page_break(out) out.div **attr_code(id: c["id"], class: "Section3") do |s| annex_name(c, nil, s) unless c.at(ns("./title")) c.elements.each do |c1| if c1.name == "title" then annex_name(c, c1, s) else parse(c1, s) end end end end end  | 
  
#annex_name(annex, name, div) ⇒ Object
      76 77 78 79 80 81 82 83  | 
    
      # File 'lib/isodoc/function/section.rb', line 76 def annex_name(annex, name, div) div.h1 **{ class: "Annex" } do |t| t << "#{anchor(annex['id'], :label)}<br/><br/>" t.b do |b| name&.children&.each { |c2| parse(c2, b) } end end end  | 
  
#clause(isoxml, out) ⇒ Object
      64 65 66 67 68 69 70 71 72 73 74  | 
    
      # File 'lib/isodoc/function/section.rb', line 64 def clause(isoxml, out) isoxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each do |c| out.div **attr_code(id: c["id"]) do |s| clause_name(anchor(c['id'], :label), c&.at(ns("./title")), s, nil) c.elements.reject { |c1| c1.name == "title" }.each do |c1| parse(c1, s) end end end end  | 
  
#clause_name(num, title, div, header_class) ⇒ Object
      47 48 49 50 51 52 53 54 55 56 57 58  | 
    
      # File 'lib/isodoc/function/section.rb', line 47 def clause_name(num, title, div, header_class) header_class = {} if header_class.nil? div.h1 **attr_code(header_class) do |h1| if num && !@suppressheadingnumbers h1 << "#{num}#{clausedelim}" clausedelimspace(h1) end title.is_a?(String) ? h1 << title : title&.children&.each { |c2| parse(c2, h1) } end div.parent.at(".//h1") end  | 
  
#clause_parse(node, out) ⇒ Object
used for subclauses
      38 39 40 41 42 43 44 45  | 
    
      # File 'lib/isodoc/function/section.rb', line 38 def clause_parse(node, out) out.div **attr_code(id: node["id"]) do |div| clause_parse_title(node, div, node.at(ns("./title")), out) node.children.reject { |c1| c1.name == "title" }.each do |c1| parse(c1, div) end end end  | 
  
#clause_parse_title(node, div, c1, out) ⇒ Object
used for subclauses
      24 25 26 27 28 29 30 31 32 33 34 35  | 
    
      # File 'lib/isodoc/function/section.rb', line 24 def clause_parse_title(node, div, c1, out) if node["inline-header"] == "true" inline_header_title(out, node, c1) else div.send "h#{anchor(node['id'], :level, false) || '1'}" do |h| lbl = anchor(node['id'], :label, false) h << "#{lbl}#{clausedelim}" if lbl && !@suppressheadingnumbers clausedelimspace(out) if lbl && !@suppressheadingnumbers c1&.children&.each { |c2| parse(c2, h) } end end end  | 
  
#clausedelim ⇒ Object
      3 4 5  | 
    
      # File 'lib/isodoc/function/section.rb', line 3 def clausedelim "." end  | 
  
#clausedelimspace(out) ⇒ Object
      7 8 9  | 
    
      # File 'lib/isodoc/function/section.rb', line 7 def clausedelimspace(out) insert_tab(out, 1) end  | 
  
#copyright_parse(node, out) ⇒ Object
      212 213 214 215 216  | 
    
      # File 'lib/isodoc/function/section.rb', line 212 def copyright_parse(node, out) out.div **{class: "boilerplate-copyright"} do |div| node.children.each { |n| parse(n, div) } end end  | 
  
#feedback_parse(node, out) ⇒ Object
      230 231 232 233 234  | 
    
      # File 'lib/isodoc/function/section.rb', line 230 def feedback_parse(node, out) out.div **{class: "boilerplate-feedback"} do |div| node.children.each { |n| parse(n, div) } end end  | 
  
#foreword(isoxml, out) ⇒ Object
      169 170 171 172 173 174 175 176  | 
    
      # File 'lib/isodoc/function/section.rb', line 169 def foreword(isoxml, out) f = isoxml.at(ns("//foreword")) || return page_break(out) out.div **attr_code(id: f["id"]) do |s| s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @foreword_lbl } f.elements.each { |e| parse(e, s) unless e.name == "title" } end end  | 
  
#inline_header_title(out, node, c1) ⇒ Object
      11 12 13 14 15 16 17 18 19 20 21  | 
    
      # File 'lib/isodoc/function/section.rb', line 11 def inline_header_title(out, node, c1) out.span **{ class: "zzMoveToFollowing" } do |s| s.b do |b| if anchor(node['id'], :label, false) && !@suppressheadingnumbers b << "#{anchor(node['id'], :label)}#{clausedelim}" clausedelimspace(out) end c1&.children&.each { |c2| parse(c2, b) } end end end  | 
  
#introduction(isoxml, out) ⇒ Object
      157 158 159 160 161 162 163 164 165 166 167  | 
    
      # File 'lib/isodoc/function/section.rb', line 157 def introduction(isoxml, out) f = isoxml.at(ns("//introduction")) || return title_attr = { class: "IntroTitle" } page_break(out) out.div **{ class: "Section3", id: f["id"] } do |div| clause_name(nil, @introduction_lbl, div, title_attr) f.elements.each do |e| parse(e, div) unless e.name == "title" end end end  | 
  
#legal_parse(node, out) ⇒ Object
      224 225 226 227 228  | 
    
      # File 'lib/isodoc/function/section.rb', line 224 def legal_parse(node, out) out.div **{class: "boilerplate-legal"} do |div| node.children.each { |n| parse(n, div) } end end  | 
  
#license_parse(node, out) ⇒ Object
      218 219 220 221 222  | 
    
      # File 'lib/isodoc/function/section.rb', line 218 def license_parse(node, out) out.div **{class: "boilerplate-license"} do |div| node.children.each { |n| parse(n, div) } end end  | 
  
#preface(isoxml, out) ⇒ Object
      199 200 201 202 203 204 205 206 207 208 209 210  | 
    
      # File 'lib/isodoc/function/section.rb', line 199 def preface(isoxml, out) title_attr = { class: "IntroTitle" } isoxml.xpath(ns("//preface/clause")).each do |f| page_break(out) out.div **{ class: "Section3", id: f["id"] } do |div| clause_name(nil, f&.at(ns("./title")), div, title_attr) f.elements.each do |e| parse(e, div) unless e.name == "title" end end end end  | 
  
#scope(isoxml, out, num) ⇒ Object
      100 101 102 103 104 105 106 107 108 109 110  | 
    
      # File 'lib/isodoc/function/section.rb', line 100 def scope(isoxml, out, num) f = isoxml.at(ns("//clause[title = 'Scope']")) or return num out.div **attr_code(id: f["id"]) do |div| 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  | 
  
#symbols_abbrevs(isoxml, out, num) ⇒ Object
      138 139 140 141 142 143 144 145 146 147 148  | 
    
      # File 'lib/isodoc/function/section.rb', line 138 def symbols_abbrevs(isoxml, out, num) f = isoxml.at(ns("//sections/definitions")) or return num out.div **attr_code(id: f["id"], class: "Symbols") do |div| num = num + 1 clause_name(num, f&.at(ns("./title")) || @symbols_lbl, div, nil) f.elements.each do |e| parse(e, div) unless e.name == "title" end end num end  | 
  
#symbols_parse(isoxml, out) ⇒ Object
subclause
      151 152 153 154 155  | 
    
      # File 'lib/isodoc/function/section.rb', line 151 def symbols_parse(isoxml, out) isoxml.at(ns("./title")) or isoxml.children.first.previous = "<title>#{@symbols_lbl}</title>" clause_parse(isoxml, out) end  | 
  
#terms_defs(isoxml, out, num) ⇒ Object
      121 122 123 124 125 126 127 128 129 130 131  | 
    
      # File 'lib/isodoc/function/section.rb', line 121 def terms_defs(isoxml, out, num) f = isoxml.at(ns(TERM_CLAUSE)) or return num out.div **attr_code(id: f["id"]) do |div| num = num + 1 clause_name(num, terms_defs_title(f), div, nil) f.elements.each do |e| parse(e, div) unless %w{title source}.include? e.name end end num end  | 
  
#terms_defs_title(f) ⇒ Object
      112 113 114 115 116  | 
    
      # File 'lib/isodoc/function/section.rb', line 112 def terms_defs_title(f) symbols = f.at(ns(".//definitions")) return @termsdefsymbols_lbl if symbols @termsdef_lbl end  | 
  
#terms_parse(isoxml, out) ⇒ Object
subclause
      134 135 136  | 
    
      # File 'lib/isodoc/function/section.rb', line 134 def terms_parse(isoxml, out) clause_parse(isoxml, out) end  |