Class: IsoDoc::Plateau::PresentationXMLConvert

Inherits:
Jis::PresentationXMLConvert
  • Object
show all
Includes:
Init
Defined in:
lib/isodoc/plateau/presentation_xml_convert.rb

Instance Method Summary collapse

Methods included from Init

#bibrenderer, #i18n_init, #metadata_init, #xref_init

Constructor Details

#initialize(options) ⇒ PresentationXMLConvert

Returns a new instance of PresentationXMLConvert.



6
7
8
9
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 6

def initialize(options)
  @iso = ::IsoDoc::Iso::PresentationXMLConvert.new(options)
  super
end

Instance Method Details

#commentary_title_hdr(elem) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 69

def commentary_title_hdr(elem)
  ret = <<~COMMENTARY
    <p class="CommentaryStandardNumber">#{@meta.get[:docnumber_undated]}
  COMMENTARY
  yr = @meta.get[:docyear] and
    ret += ": <span class='CommentaryEffectiveYear'>#{yr}</span>"
  elem.previous = ret
end

#listsource(elem) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 44

def listsource(elem)
  source1(elem)
  elem.parent or return
  elem.name = "p"
  elem.delete("status")
  elem.parent.next = elem
end

#middle_title(docxml) ⇒ Object



52
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 52

def middle_title(docxml); end

#ol_depth(node) ⇒ Object



78
79
80
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 78

def ol_depth(node)
  @iso.ol_depth(node)
end

#parasource(elem) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 35

def parasource(elem)
  source1(elem)
  # if we haven't already removed it...
  elem.parent or return
  elem.name = "p"
  elem.delete("status")
  elem.parent.next = elem
end

#preface_init_insert_pt(docxml) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 18

def preface_init_insert_pt(docxml)
  ret = docxml.at(ns("//preface")) ||
    docxml.at(ns("//sections | //annex | //bibliography"))
      &.add_previous_sibling("<preface> </preface>")&.first
  ret.nil? and return nil
  ret.children.empty? and ret << " "
  ret
end

#rearrange_clauses(docxml) ⇒ Object



54
55
56
57
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 54

def rearrange_clauses(docxml)
  super
  revhistory(docxml)
end

#revhistory(docxml) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 59

def revhistory(docxml)
  a = docxml.at(ns("//clause[@type = 'revhistory']"))&.remove or return
  pref = preface_init_insert_pt(docxml) or return nil
  ins = if b = pref.at(ns("./abstract[last()]"))
          b.after(" ").next
        else pref.children.first
        end
  ins.previous = a
end

#source(docxml) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 27

def source(docxml)
  super
  docxml.xpath(ns("//p/source")).each { |f| parasource(f) }
  docxml.xpath(ns("//ul/source")).each { |f| listsource(f) }
  docxml.xpath(ns("//ol/source")).each { |f| listsource(f) }
  docxml.xpath(ns("//dl/source")).each { |f| listsource(f) }
end

#toc_title_insert_pt(docxml) ⇒ Object



11
12
13
14
15
16
# File 'lib/isodoc/plateau/presentation_xml_convert.rb', line 11

def toc_title_insert_pt(docxml)
  i = preface_init_insert_pt(docxml) or return nil
  a = i.at(ns("./abstract[last()] | ./clause[@type = 'revhistory']")) and
    return a.after(" ").next
  i.children.first
end