Class: IsoDoc::NIST::PresentationXMLConvert
- Inherits:
-
PresentationXMLConvert
- Object
- PresentationXMLConvert
- IsoDoc::NIST::PresentationXMLConvert
show all
- Includes:
- Init
- Defined in:
- lib/isodoc/nist/presentation_xml_convert.rb
Instance Method Summary
collapse
Methods included from Init
#fileloc, #i18n_init, #metadata_init, #suppress_biblio_title, #xref_init
Instance Method Details
#annex1(f) ⇒ Object
33
34
35
36
37
38
39
40
41
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 33
def annex1(f)
lbl = @xrefs.anchor(f['id'], :label)
if t = f.at(ns("./title"))
t.children = "<strong>#{t.children.to_xml}</strong>"
end
prefix_name(f, " — ", lbl, "title")
t = f.at(ns("./title"))
t["xref"] = lbl.gsub(/<[^>]+>/, "")
end
|
#clause1(f) ⇒ Object
71
72
73
74
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 71
def clause1(f)
return if f.name == "references" && suppress_biblio_title(f)
super
end
|
#convert1(docxml, filename, dir) ⇒ Object
7
8
9
10
11
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 7
def convert1(docxml, filename, dir)
info docxml, nil
insert_preface_sections(docxml)
super
end
|
#get_linkend(node) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 22
def get_linkend(node)
contents = non_locality_elems(node).select { |c| !c.text? || /\S/.match(c) }
return unless contents.empty?
link = anchor_linkend(node, docid_l10n(node["target"] ||
wrap_brackets(node['citeas'])))
link += eref_localities(node.xpath(ns("./locality | ./localityStack")),
link)
non_locality_elems(node).each { |n| n.remove }
node.add_child(link)
end
|
#insert_keywords(docxml) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 52
def insert_keywords(docxml)
kw = @meta.get[:keywords]
kw.empty? and return
if abstract = docxml.at(ns("//preface/abstract"))
abstract.next = keyword_clause(kw)
elsif foreword = docxml.at(ns("//preface/foreword"))
foreword.next = keyword_clause(kw)
else
preface_init_insert_pt(docxml)&.children&.first&.
add_previous_sibling(keyword_clause(kw))
end
end
|
#insert_preface_sections(docxml) ⇒ Object
13
14
15
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 13
def insert_preface_sections(docxml)
insert_keywords(docxml)
end
|
#keyword_clause(kw) ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 43
def keyword_clause(kw)
<<~END
<clause id="_#{UUIDTools::UUID.random_create}" type="keyword">
<title>#{@i18n.keywords}</title>
#{@i18n.keywords_intro}
<p>#{@i18n.l10n(kw.join("; "))}</p></clause>
END
end
|
#preface_init_insert_pt(docxml) ⇒ Object
65
66
67
68
69
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 65
def preface_init_insert_pt(docxml)
docxml.at(ns("//preface")) ||
docxml.at(ns("//sections")).
add_previous_sibling("<preface> </preface>").first
end
|
#wrap_brackets(txt) ⇒ Object
17
18
19
20
|
# File 'lib/isodoc/nist/presentation_xml_convert.rb', line 17
def wrap_brackets(txt)
return txt if /^\[.*\]$/.match txt
"[#{txt}]"
end
|