metanorma-un 0.3.8 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,9 +30,22 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
38
  </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
@@ -141,6 +154,16 @@
141
154
  <data type="boolean"/>
142
155
  </attribute>
143
156
  </optional>
157
+ <optional>
158
+ <attribute name="keep-with-next">
159
+ <data type="boolean"/>
160
+ </attribute>
161
+ </optional>
162
+ <optional>
163
+ <attribute name="keep-lines-together">
164
+ <data type="boolean"/>
165
+ </attribute>
166
+ </optional>
144
167
  <oneOrMore>
145
168
  <ref name="BasicBlock"/>
146
169
  </oneOrMore>
@@ -119,6 +119,9 @@
119
119
  <optional>
120
120
  <ref name="session"/>
121
121
  </optional>
122
+ <optional>
123
+ <ref name="job_number"/>
124
+ </optional>
122
125
  </define>
123
126
  <define name="preface">
124
127
  <element name="preface">
@@ -138,6 +141,109 @@
138
141
  <ref name="Basic-Section"/>
139
142
  </element>
140
143
  </define>
144
+ <define name="Clause-Section">
145
+ <optional>
146
+ <attribute name="id">
147
+ <data type="ID"/>
148
+ </attribute>
149
+ </optional>
150
+ <optional>
151
+ <attribute name="language"/>
152
+ </optional>
153
+ <optional>
154
+ <attribute name="script"/>
155
+ </optional>
156
+ <optional>
157
+ <attribute name="inline-header">
158
+ <data type="boolean"/>
159
+ </attribute>
160
+ </optional>
161
+ <optional>
162
+ <attribute name="obligation">
163
+ <choice>
164
+ <value>normative</value>
165
+ <value>informative</value>
166
+ </choice>
167
+ </attribute>
168
+ </optional>
169
+ <optional>
170
+ <attribute name="unnumbered">
171
+ <data type="boolean"/>
172
+ </attribute>
173
+ </optional>
174
+ <optional>
175
+ <ref name="section-title"/>
176
+ </optional>
177
+ <group>
178
+ <group>
179
+ <zeroOrMore>
180
+ <ref name="BasicBlock"/>
181
+ </zeroOrMore>
182
+ <zeroOrMore>
183
+ <ref name="note"/>
184
+ </zeroOrMore>
185
+ </group>
186
+ <zeroOrMore>
187
+ <choice>
188
+ <ref name="clause-subsection"/>
189
+ <ref name="terms"/>
190
+ <ref name="definitions"/>
191
+ </choice>
192
+ </zeroOrMore>
193
+ </group>
194
+ </define>
195
+ <define name="Annex-Section">
196
+ <optional>
197
+ <attribute name="id">
198
+ <data type="ID"/>
199
+ </attribute>
200
+ </optional>
201
+ <optional>
202
+ <attribute name="language"/>
203
+ </optional>
204
+ <optional>
205
+ <attribute name="script"/>
206
+ </optional>
207
+ <optional>
208
+ <attribute name="inline-header">
209
+ <data type="boolean"/>
210
+ </attribute>
211
+ </optional>
212
+ <optional>
213
+ <attribute name="obligation">
214
+ <choice>
215
+ <value>normative</value>
216
+ <value>informative</value>
217
+ </choice>
218
+ </attribute>
219
+ </optional>
220
+ <optional>
221
+ <attribute name="unnumbered">
222
+ <data type="boolean"/>
223
+ </attribute>
224
+ </optional>
225
+ <optional>
226
+ <ref name="section-title"/>
227
+ </optional>
228
+ <group>
229
+ <group>
230
+ <zeroOrMore>
231
+ <ref name="BasicBlock"/>
232
+ </zeroOrMore>
233
+ <zeroOrMore>
234
+ <ref name="note"/>
235
+ </zeroOrMore>
236
+ </group>
237
+ <zeroOrMore>
238
+ <choice>
239
+ <ref name="annex-subsection"/>
240
+ <ref name="terms"/>
241
+ <ref name="definitions"/>
242
+ <ref name="references"/>
243
+ </choice>
244
+ </zeroOrMore>
245
+ </group>
246
+ </define>
141
247
  </include>
142
248
  <define name="session">
143
249
  <element name="session">
@@ -227,6 +333,11 @@
227
333
  </choice>
228
334
  </element>
229
335
  </define>
336
+ <define name="job_number">
337
+ <element name="job_number">
338
+ <text/>
339
+ </element>
340
+ </define>
230
341
  <define name="un-standard">
231
342
  <element name="un-standard">
232
343
  <ref name="bibdata"/>
@@ -2,6 +2,7 @@ require "isodoc/un/metadata"
2
2
  require "isodoc/un/html_convert"
3
3
  require "isodoc/un/word_convert"
4
4
  require "isodoc/un/pdf_convert"
5
+ require "isodoc/un/presentation_xml_convert"
5
6
 
6
7
  module IsoDoc
7
8
  module UN
@@ -1,6 +1,6 @@
1
1
  require_relative "metadata"
2
+ require_relative "xref"
2
3
  require "fileutils"
3
- require "roman-numerals"
4
4
 
5
5
  module IsoDoc
6
6
  module UN
@@ -10,9 +10,13 @@ module IsoDoc
10
10
  @meta.set(:toc, @toc)
11
11
  end
12
12
 
13
+ def xref_init(lang, script, klass, labels, options)
14
+ @xrefs = Xref.new(lang, script, klass, labels, options)
15
+ end
16
+
13
17
  def annex_name(annex, name, div)
14
18
  div.h1 **{ class: "Annex" } do |t|
15
- t << "#{anchor(annex['id'], :label)}"
19
+ t << "#{@xrefs.anchor(annex['id'], :label)}"
16
20
  t.br
17
21
  t.b do |b|
18
22
  name&.children&.each { |c2| parse(c2, b) }
@@ -30,186 +34,13 @@ module IsoDoc
30
34
  File.join(File.dirname(__FILE__), loc)
31
35
  end
32
36
 
33
- MIDDLE_CLAUSE = "//clause[parent::sections]".freeze
34
-
35
- def initial_anchor_names(d)
36
- preface_names(d.at(ns("//preface/abstract")))
37
- preface_names(d.at(ns("//foreword")))
38
- preface_names(d.at(ns("//introduction")))
39
- d.xpath(ns("//preface/clause")).each do |c|
40
- preface_names(c)
41
- end
42
- preface_names(d.at(ns("//acknowledgements")))
43
- sequential_asset_names(
44
- d.xpath(ns("//preface/abstract | //foreword | //introduction | "\
45
- "//preface/clause | //acknowledgements")))
46
- middle_section_asset_names(d)
47
- clause_names(d, 0)
48
- termnote_anchor_names(d)
49
- termexample_anchor_names(d)
50
- end
51
-
52
- def clause_names(docxml, sect_num)
53
- q = "//clause[parent::sections]"
54
- @paranumber = 0
55
- docxml.xpath(ns(q)).each_with_index do |c, i|
56
- section_names(c, (i + sect_num), 1)
57
- end
58
- end
59
-
60
- def levelnumber(num, lvl)
61
- case lvl % 3
62
- when 1 then RomanNumerals.to_roman(num)
63
- when 2 then ("A".ord + num - 1).chr
64
- when 0 then num.to_s
65
- end
66
- end
67
-
68
- def annex_levelnum(num, lvl)
69
- case lvl % 3
70
- when 0 then RomanNumerals.to_roman(num)
71
- when 1 then ("A".ord + num - 1).chr
72
- when 2 then num.to_s
73
- end
74
- end
75
-
76
- NONTERMINAL =
77
- "./clause | ./term | ./terms | ./definitions | ./references".freeze
78
-
79
- def leaf_section?(clause)
80
- !clause.at(ns(NONTERMINAL)) &&
81
- !%w(definitions annex terms).include?(clause.name) &&
82
- clause.at(ns("./p | ./bibitem"))
83
- end
84
-
85
- def label_leaf_section(clause, lvl)
86
- @paranumber += 1
87
- @anchors[clause["id"]] = {label: @paranumber.to_s,
88
- xref: "paragraph #{@paranumber}",
89
- level: lvl, type: "paragraph" }
90
- end
91
-
92
- def label_annex_leaf_section(clause, num, lvl)
93
- @paranumber += 1
94
- @anchors[clause["id"]] = {label: @paranumber.to_s,
95
- xref: "paragraph #{num}.#{@paranumber}",
96
- level: lvl, type: "paragraph" }
97
- end
98
-
99
- def section_names(clause, num, lvl)
100
- return num if clause.nil?
101
- leaf_section?(clause) and label_leaf_section(clause, lvl) and return
102
- num = num + 1
103
- lbl = levelnumber(num, 1)
104
- @anchors[clause["id"]] = { label: lbl, level: lvl, type: "clause",
105
- xref: l10n("#{@clause_lbl} #{lbl}") }
106
- i = 1
107
- clause.xpath(ns(NONTERMINAL)).each do |c|
108
- section_names1(c, "#{lbl}.#{levelnumber(i, lvl + 1)}", lvl + 1)
109
- i += 1 if !leaf_section?(c)
110
- end
111
- num
112
- end
113
-
114
- def section_names1(clause, num, level)
115
- leaf_section?(clause) and label_leaf_section(clause, level) and return
116
- /\.(?<leafnum>[^.]+$)/ =~ num
117
- @anchors[clause["id"]] = { label: leafnum, level: level, type: "clause",
118
- xref: l10n("#{@clause_lbl} #{num}") }
119
- i = 1
120
- clause.xpath(ns(NONTERMINAL)).each do |c|
121
- section_names1(c, "#{num}.#{levelnumber(i, level + 1)}", level + 1)
122
- i += 1 if !leaf_section?(c)
123
- end
124
- end
125
-
126
- def annex_name_lbl(clause, num)
127
- l10n("<b>#{@annex_lbl} #{num}</b>")
128
- end
129
-
130
- SUBCLAUSES =
131
- "./clause | ./references | ./term | ./terms | ./definitions".freeze
132
-
133
-
134
- def annex_names(clause, num)
135
- hierarchical_asset_names(clause, num)
136
- leaf_section?(clause) and
137
- label_annex_leaf_section(clause, num, 1) and return
138
- @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
139
- type: "clause",
140
- xref: "#{@annex_lbl} #{num}", level: 1 }
141
- if a = single_annex_special_section(clause)
142
- annex_names1(a, "#{num}", 1)
143
- else
144
- i = 1
145
- clause.xpath(ns(SUBCLAUSES)).each do |c|
146
- annex_names1(c, "#{num}.#{annex_levelnum(i, 2)}", 2)
147
- i += 1 if !leaf_section?(c)
148
- end
149
- end
150
- end
151
-
152
- def annex_names1(clause, num, level)
153
- leaf_section?(clause) and
154
- label_annex_leaf_section(clause, num, level) and return
155
- /\.(?<leafnum>[^.]+$)/ =~ num
156
- @anchors[clause["id"]] = { label: leafnum, xref: "#{@annex_lbl} #{num}",
157
- level: level, type: "clause" }
158
- i = 1
159
- clause.xpath(ns("./clause | ./references")).each do |c|
160
- annex_names1(c, "#{num}.#{annex_levelnum(i, level + 1)}", level + 1)
161
- i += 1 if !leaf_section?(c)
162
- end
163
- end
164
-
165
- def back_anchor_names(docxml)
166
- docxml.xpath(ns("//annex")).each_with_index do |c, i|
167
- @paranumber = 0
168
- annex_names(c, RomanNumerals.to_roman(i + 1))
169
- end
170
- docxml.xpath(ns("//bibliography/clause |"\
171
- "//bibliography/references")).each do |b|
172
- preface_names(b)
173
- end
174
- docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
175
- reference_names(ref)
176
- end
177
- end
178
-
179
- def sequential_admonition_names(clause)
180
- i = 0
181
- clause.xpath(ns(".//admonition")).each do |t|
182
- i += 1 unless t["unnumbered"]
183
- next if t["id"].nil? || t["id"].empty?
184
- @anchors[t["id"]] = anchor_struct(i.to_s, nil, @admonition_lbl,
185
- "box", t["unnumbered"])
186
- end
187
- end
188
-
189
- def hierarchical_admonition_names(clause, num)
190
- i = 0
191
- clause.xpath(ns(".//admonition")).each do |t|
192
- i += 1 unless t["unnumbered"]
193
- next if t["id"].nil? || t["id"].empty?
194
- @anchors[t["id"]] =
195
- anchor_struct("#{num}.#{i}", nil, @admonition_lbl, "box",
196
- t["unnumbered"])
197
- end
198
- end
199
-
200
- def sequential_asset_names(clause)
201
- super
202
- sequential_admonition_names(clause)
203
- end
204
-
205
- def hierarchical_asset_names(clause, num)
206
- super
207
- hierarchical_admonition_names(clause, num)
37
+ def middle_clause
38
+ "//clause[parent::sections]"
208
39
  end
209
40
 
210
41
  def admonition_name_parse(node, div, name)
211
42
  div.p **{ class: "AdmonitionTitle", style: "text-align:center;" } do |p|
212
- lbl = anchor(node['id'], :label)
43
+ lbl = @xrefs.anchor(node['id'], :label)
213
44
  lbl.nil? or p << l10n("#{@admonition_lbl} #{lbl}")
214
45
  name and !lbl.nil? and p << "&nbsp;&mdash; "
215
46
  name and name.children.each { |n| parse(n, div) }
@@ -218,7 +49,7 @@ module IsoDoc
218
49
 
219
50
  def admonition_parse(node, out)
220
51
  name = node.at(ns("./name"))
221
- out.div **{ class: "Admonition" } do |t|
52
+ out.div **admonition_attrs(node) do |t|
222
53
  admonition_name_parse(node, t, name) if name
223
54
  node.children.each do |n|
224
55
  parse(n, t) unless n.name == "name"
@@ -228,7 +59,7 @@ module IsoDoc
228
59
 
229
60
  def inline_header_title(out, node, c1)
230
61
  out.span **{ class: "zzMoveToFollowing" } do |s|
231
- if lbl = anchor(node['id'], :label)
62
+ if lbl = @xrefs.anchor(node['id'], :label)
232
63
  s << "#{lbl}. " unless @suppressheadingnumbers
233
64
  insert_tab(s, 1)
234
65
  end
@@ -242,6 +73,18 @@ module IsoDoc
242
73
  return true if docxml&.at(ns("//bibdata/ext/session/*"))
243
74
  false
244
75
  end
76
+
77
+ def note_label(node)
78
+ n = @xrefs.get[node["id"]]
79
+ lbl = case node["type"]
80
+ when "source" then "Source"
81
+ when "abbreviation" then "Abbreviations"
82
+ else
83
+ @note_lbl
84
+ end
85
+ return "#{lbl}:" # if n.nil? || n[:label].nil? || n[:label].empty?
86
+ #l10n("#{lbl} #{n[:label]}:")
87
+ end
245
88
  end
246
89
  end
247
90
  end
@@ -42,13 +42,16 @@ $('#toggle').on('click', function(){
42
42
  </script>
43
43
 
44
44
  <script>
45
- /**
46
- * AnchorJS - v4.1.0 - 2017-09-20
47
- * https://github.com/bryanbraun/anchorjs
48
- * Copyright (c) 2017 Bryan Braun; Licensed MIT
49
- */
50
- !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function e(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64}function t(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}function i(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"], style'))?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(" .anchorjs-link { opacity: 0; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }",e.sheet.cssRules.length),e.sheet.insertRule(" *:hover > .anchorjs-link, .anchorjs-link:focus { opacity: 1; }",e.sheet.cssRules.length),e.sheet.insertRule(" [data-anchorjs-icon]::after { content: attr(data-anchorjs-icon); }",e.sheet.cssRules.length),e.sheet.insertRule(' @font-face { font-family: "anchorjs-icons"; src: url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype"); }',e.sheet.cssRules.length)}}this.options=A||{},this.elements=[],e(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var n,o,s,a,r,c,h,l,u,d,f,p=[];if(e(this.options),"touch"===(f=this.options.visible)&&(f=this.isTouchDevice()?"always":"hover"),A||(A="h2, h3, h4, h5, h6"),0===(n=t(A)).length)return this;for(i(),o=document.querySelectorAll("[id]"),s=[].map.call(o,function(A){return A.id}),r=0;r<n.length;r++)if(this.hasAnchorJSLink(n[r]))p.push(r);else{if(n[r].hasAttribute("id"))a=n[r].getAttribute("id");else if(n[r].hasAttribute("data-anchor-id"))a=n[r].getAttribute("data-anchor-id");else{u=l=this.urlify(n[r].textContent),h=0;do{void 0!==c&&(u=l+"-"+h),c=s.indexOf(u),h+=1}while(-1!==c);c=void 0,s.push(u),n[r].setAttribute("id",u),a=u}a.replace(/-/g," "),(d=document.createElement("a")).className="anchorjs-link "+this.options.class,d.href="#"+a,d.setAttribute("aria-label",this.options.ariaLabel),d.setAttribute("data-anchorjs-icon",this.options.icon),"always"===f&&(d.style.opacity="1"),""===this.options.icon&&(d.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(d.style.lineHeight="inherit")),"left"===this.options.placement?(d.style.position="absolute",d.style.marginLeft="-1em",d.style.paddingRight="0.5em",n[r].insertBefore(d,n[r].firstChild)):(d.style.paddingLeft="0.375em",n[r].appendChild(d))}for(r=0;r<p.length;r++)n.splice(p[r]-r,1);return this.elements=this.elements.concat(n),this},this.remove=function(A){for(var e,i,n=t(A),o=0;o<n.length;o++)(i=n[o].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(n[o]))&&this.elements.splice(e,1),n[o].removeChild(i));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){var t=/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\]/g;return this.options.truncate||e(this.options),A.trim().replace(/\'/gi,"").replace(t,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&(" "+A.firstChild.className+" ").indexOf(" anchorjs-link ")>-1,t=A.lastChild&&(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ")>-1;return e||t||!1}}}); </script>
51
-
45
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
46
+ //
47
+ // AnchorJS - v4.2.2 - 2020-04-20
48
+ // https://www.bryanbraun.com/anchorjs/
49
+ // Copyright (c) 2020 Bryan Braun; Licensed MIT
50
+ //
51
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
52
+ !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
53
+ // @license-end
54
+ </script>
52
55
  <script>
53
56
  /*
54
57
  $('document').ready(function() {