isodoc 3.6.2 → 3.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bf1ffcc456d731a2c304e57a434c843fb15c35160b1a9f986edd708d6c69778
4
- data.tar.gz: ac599e110c10a0ea9937d2068f01feff1cace361da16668a2effb79d01a8e71f
3
+ metadata.gz: 9e9e4612fb1a8151ba500dfc561dca2f22434b6b4981b842a3188d1203226a85
4
+ data.tar.gz: d7cd554782c88320a59b7bf5d0240c7d81deffdfb4e90861618d01e9f6690c7d
5
5
  SHA512:
6
- metadata.gz: a10380f99ba7cb208b32ef3c4631e5ca4cb41173c77c925d069cb17c72dcfd4c55bdd0a63a23080ecb0c0d6783e08b2e351bfc694c7280ade2b960779da8c1be
7
- data.tar.gz: b394e8f2e6e78fe1f1c00b9df1f1d233b053118daee4e70e6927009725afddb851031d47ed52272cdf09a8931d6710e47b83b478b99c97725c4a57e21f766356
6
+ metadata.gz: 3fc09b5a526d031454b9c28f43e1bd1d682120bc9c3014ecc49deb9b9d82728e79f6b0e6410e1b3c5c0913a06499bc6b36b21ee447c8597e37152bd571182a54
7
+ data.tar.gz: 8dac1e10327f3b69ec52011f5ab4754726cc0973b31bcfebf594778672b5f487b3caba951bb636df3266959853c00fcdbf1b40940ab6e71885dc2c23c1a554f3
@@ -131,7 +131,9 @@
131
131
  background-color: $colorBg;
132
132
  color: $colorFg !important;
133
133
  cursor: pointer;
134
- z-index: 100;
134
+ left: 0;
135
+ top: 0;
136
+ z-index: 103;
135
137
 
136
138
  span {
137
139
  text-align: center;
@@ -13,24 +13,51 @@
13
13
  const jqToggle = $('#toggle');
14
14
  const animationSpeed = 'slow';
15
15
 
16
+ if(!jqNav.length || !jqToggle.length) {
17
+ return;
18
+ }
19
+
20
+ const navWidthExpanded = jqNav.outerWidth();
21
+ const bodyPaddingLeftExpanded =
22
+ parseFloat(jqBody.css('paddingLeft')) > 0 ?
23
+ jqBody.css('paddingLeft') : navWidthExpanded + 'px';
24
+ const expandedToggleLeft = navWidthExpanded + 'px';
25
+ let bandWidth = 0;
26
+
27
+ $('.document-stage-band:visible, .document-type-band:visible')
28
+ .each(function() {
29
+ const bounds = this.getBoundingClientRect();
30
+ bandWidth = Math.max(bandWidth, bounds.right);
31
+ });
32
+
33
+ const toggleWidth = jqToggle.outerWidth();
34
+ const collapsedToggleLeft = bandWidth + 'px';
35
+ const collapsedBodyPaddingLeft = bandWidth + toggleWidth + 'px';
36
+ jqToggle.css({
37
+ 'left': jqNav.is(':visible') ? expandedToggleLeft : collapsedToggleLeft,
38
+ 'top': '0px'
39
+ });
40
+
16
41
  jqToggle.on('click', function() {
17
42
  const isNavVisible = jqNav.is(':visible');
18
- const fullNavWidth = jqNav.outerWidth();
19
- const navLeft = isNavVisible ? '-' + fullNavWidth + 'px' : '0px';
20
- const bodyMarginLeft = isNavVisible ? '0px' : fullNavWidth + 'px';
43
+ const navLeft = isNavVisible ? '-' + navWidthExpanded + 'px' : '0px';
44
+ const bodyPaddingLeft =
45
+ isNavVisible ? collapsedBodyPaddingLeft : bodyPaddingLeftExpanded;
46
+ const toggleLeft =
47
+ isNavVisible ? collapsedToggleLeft : expandedToggleLeft;
21
48
 
22
- // Stop current animations
23
49
  jqNav.stop(true, true);
24
50
  jqBody.stop(true, true);
51
+ jqToggle.stop(true, true);
25
52
 
26
53
  if(!isNavVisible) {
27
- jqNav.show();
54
+ jqNav.show();
28
55
  }
29
56
  jqNav.animate({'left': navLeft}, animationSpeed, function() {
30
57
  if(isNavVisible) {jqNav.hide()}
31
58
  });
32
- jqBody.animate({'marginLeft': bodyMarginLeft}, animationSpeed);
33
-
59
+ jqBody.animate({'paddingLeft': bodyPaddingLeft}, animationSpeed);
60
+ jqToggle.animate({'left': toggleLeft}, animationSpeed);
34
61
  });
35
62
  })();
36
63
  </script>
@@ -215,4 +242,3 @@ for (i = 0; i < coll.length; i++) {
215
242
  });
216
243
  }
217
244
  </script>
218
-
@@ -0,0 +1,65 @@
1
+ module IsoDoc
2
+ class PresentationXMLConvert < ::IsoDoc::Convert
3
+ # Wrap token sub-spans of a standard docidentifier (publisher, document
4
+ # number, part, year, ...) in <span class="..."> markers for CSS styling.
5
+ # Flavors opt in by overriding `annotate_docid?`; they customise span
6
+ # class naming via `std_docid_span_classes`. Pubid parsing is shared.
7
+ def std_docid_semantic(id)
8
+ annotate_docid?(id) or return id
9
+ id.nil? || id.empty? || id == "IEV" || /^\[?\d+\]?$/.match?(id) and
10
+ return id
11
+ nbsp = id.include?("\u00a0")
12
+ bracket = id.match?(/\A\[.+\]\Z/m)
13
+ id = id.gsub("\u00a0", " ").sub(/\A\[(.+)\]\Z/m, "\\1")
14
+ ret = std_docid_span_classes(std_docid_semantic_parse(id))
15
+ std_docid_semantic_restore_format(ret, nbsp, bracket)
16
+ end
17
+
18
+ def std_docid_semantic_parse(id)
19
+ parsed = Pubid::Registry.parse(id)
20
+ # Pubid::Ieee in particular happily parses any "letters+digits" token
21
+ # as an IEEE Std identifier and synthesises an "IEEE Std" prefix that
22
+ # wasn't in the input (e.g. "REF4" -> "IEEE Std REF4"). Refuse to
23
+ # annotate when the parser has invented structure not present in the
24
+ # input -- detected by a non-identity round-trip.
25
+ return id if parsed.to_s != id
26
+ parsed.to_s(annotated: true)
27
+ rescue Pubid::Core::Errors::ParseError
28
+ std_docid_semantic_full(id)
29
+ end
30
+
31
+ # Regex-based fallback when Pubid::Registry cannot parse the id. Emits
32
+ # the same generic class names that Pubid uses (publisher, docnumber,
33
+ # part, year) so that flavors' `std_docid_span_classes` remaps work
34
+ # uniformly across both the Pubid-parse path and this fallback.
35
+ def std_docid_semantic_full(ident)
36
+ ident
37
+ .sub(/^([^0-9]+)(\p{Zs}|$)/, '<span class="publisher">\1</span>\2')
38
+ .sub(/([0-9]+)/, '<span class="docnumber">\1</span>')
39
+ .sub(/-([0-9]+)/, '-<span class="part">\1</span>')
40
+ .sub(/:([0-9]{4})(?!\d)/, ':<span class="year">\1</span>')
41
+ end
42
+
43
+ # Default: pass through Pubid's generic class names unchanged. Flavors
44
+ # override to remap (e.g. ISO -> "stdpublisher", IEEE -> "std_publisher").
45
+ def std_docid_span_classes(id)
46
+ id
47
+ end
48
+
49
+ def std_docid_semantic_restore_format(id, nbsp, bracket)
50
+ nbsp and Nokogiri::XML(id).traverse do |n|
51
+ n.text? or next
52
+ n.replace(n.text.gsub(" ", "\u00a0"))
53
+ end
54
+ bracket and id = "[#{id}]"
55
+ id
56
+ end
57
+
58
+ # Flavors opt in by overriding to return true. Default is off so that
59
+ # downstream consumers of IsoDoc::PresentationXMLConvert that have not
60
+ # explicitly opted in (ITU, NIST, OGC, ...) keep their current behaviour.
61
+ def annotate_docid?(_id)
62
+ false
63
+ end
64
+ end
65
+ end
@@ -160,14 +160,15 @@ module IsoDoc
160
160
 
161
161
  # if ids is just a number, only use that ([1] Non-Standard)
162
162
  # else, use both ordinal, as prefix, and ids
163
+ # The footnote (datefn) always lands between the bracketed ordinal and
164
+ # the <tab/>, regardless of whether the docidentifier is present, so
165
+ # placement stays consistent across bibitems.
163
166
  def biblio_ref_entry_code(ordinal, ids, _standard, datefn, _bib)
164
167
  ret = esc(ids[:ordinal]) || esc(ids[:content]) || esc(ids[:metanorma]) ||
165
168
  "[#{esc ordinal.to_s}]"
169
+ ret = prefix_bracketed_ref("#{ret}#{datefn}")
166
170
  if ids[:sdo] && !ids[:sdo].empty?
167
- ret = prefix_bracketed_ref(ret)
168
- ret += "#{esc ids[:sdo]}#{datefn}, "
169
- else
170
- ret = prefix_bracketed_ref("#{ret}#{datefn}")
171
+ ret += "#{esc ids[:sdo]}, "
171
172
  end
172
173
  ret
173
174
  end
@@ -16,6 +16,7 @@ require_relative "presentation_function/annex"
16
16
  require_relative "presentation_function/title"
17
17
  require_relative "presentation_function/refs"
18
18
  require_relative "presentation_function/docid"
19
+ require_relative "presentation_function/docid_semantic"
19
20
  require_relative "presentation_function/index"
20
21
  require_relative "presentation_function/bibdata"
21
22
  require_relative "presentation_function/metadata"
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "3.6.2".freeze
2
+ VERSION = "3.6.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.2
4
+ version: 3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-15 00:00:00.000000000 Z
11
+ date: 2026-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -264,6 +264,7 @@ files:
264
264
  - lib/isodoc/presentation_function/concepts.rb
265
265
  - lib/isodoc/presentation_function/designations.rb
266
266
  - lib/isodoc/presentation_function/docid.rb
267
+ - lib/isodoc/presentation_function/docid_semantic.rb
267
268
  - lib/isodoc/presentation_function/erefs.rb
268
269
  - lib/isodoc/presentation_function/erefs_locality.rb
269
270
  - lib/isodoc/presentation_function/footnotes.rb