isodoc 3.7.27 → 3.7.29

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: 6bd9655ddbd59430b936707386eb40c25b1307ed261b2371be49283f9fbfe4f2
4
- data.tar.gz: c602b4cd0a5fdd6698ef700506520bcebf2f8c7eea219d21745c8bcaf44ac09b
3
+ metadata.gz: 4f9765f3c891cca29930972e25caa9ac605eeee3c773e2619ac96f891f1fcec1
4
+ data.tar.gz: c6addf143c820531cd95c78caa380b627d0192d56d9896354851cb39110693f5
5
5
  SHA512:
6
- metadata.gz: 2cb5b12fa9813e8b99d40d66806562893cf3d1364da11906b3ac09645c856b74632027f0d0cf5d29d3c42615ada141ffc6a44700ff09f921eff43e3edf1f792e
7
- data.tar.gz: 4025281005795810e9368c0c7758f746c37816041664ee9001878aec71ca9b9b7ab8f2a16e20045bb2f55263795e1e9829127867388e70938c16b90a9e040a7b
6
+ metadata.gz: 5ce6a7be080582f6fb0c96c55e63f2f851a82a0a70d71ebf38d0a7ff3c05dab48f68295c4082680394dad10e667212af054f10d755de9ac83ba9677e27335c12
7
+ data.tar.gz: 9f6397f9157c44ad4d28518ed5a6731ae287782721c8d30825f4b749797595ba4c36e6671b3a58429e29c68f24055dd1f58a9a4a619d62fedfb296f1cfe9bad9
data/lib/isodoc/css.rb CHANGED
@@ -63,11 +63,20 @@ module IsoDoc
63
63
 
64
64
  # Font names reach font-family declarations through SCSS variables;
65
65
  # a raw multi-word name ("Source Sans 3") or a stack ("Arial, sans-serif")
66
- # emits unquoted and browsers reject or mis-parse it. Quote unless the
67
- # flavor already brings its own quoting.
66
+ # emits unquoted and browsers reject or mis-parse it. Quote per
67
+ # comma-separated segment: whole-value wrapping mangles stacks whose
68
+ # segments carry their own quotes (the string token ends at the first
69
+ # embedded quote), and generic family keywords must never be quoted.
70
+ GENERIC_CSS_FAMILIES = /\A(?:inherit|serif|sans-serif|monospace|cursive|fantasy|system-ui|ui-sans-serif|ui-serif|ui-monospace|ui-rounded|math|fangsong)\z/i.freeze
71
+
68
72
  def quote_css_font(value)
69
- v = value.to_s.strip
70
- v.start_with?("\"", "'") ? v : "\"#{v}\""
73
+ value.to_s.split(",").map do |segment|
74
+ s = segment.strip
75
+ next s if s.empty? || GENERIC_CSS_FAMILIES.match?(s) ||
76
+ s.start_with?("\"", "'")
77
+
78
+ "\"#{s}\""
79
+ end.join(", ")
71
80
  end
72
81
 
73
82
  def scss_fontheader(is_html_css)
@@ -82,7 +82,9 @@ module IsoDoc
82
82
  end
83
83
  para&.name == "p" and children_parse(para, p)
84
84
  end
85
- para&.name != "p" and parse(para, div)
85
+ # para is nil for a termnote whose block body has no elements;
86
+ # the name-based guard must not pass that nil into parse.
87
+ para and para.name != "p" and parse(para, div)
86
88
  end
87
89
 
88
90
  def semx_termref_parse(node, out); end
@@ -1,5 +1,15 @@
1
1
  module IsoDoc
2
2
  class PresentationXMLConvert < ::IsoDoc::Convert
3
+ # pubid_parse is a pure function of its input (the flavor registry is
4
+ # process-static), and the same docidentifier strings repeat across a
5
+ # document's references. Each miss runs every registered pubid flavor
6
+ # - and the IEEE-family parses re-register their parsanol grammar per
7
+ # call (profiled at ~54% of a warm smol collection build). Results
8
+ # memoize process-wide; the cap bounds memory on adversarial input.
9
+ PUBID_PARSE_MEMO = {}
10
+ PUBID_PARSE_MEMO_LOCK = Mutex.new
11
+ PUBID_PARSE_MEMO_MAX = 100_000
12
+
3
13
  # Wrap token sub-spans of a standard docidentifier (publisher, document
4
14
  # number, part, year, ...) in <span class="..."> markers for CSS styling.
5
15
  # Flavors opt in by overriding `annotate_docid?`; they customise span
@@ -42,6 +52,17 @@ module IsoDoc
42
52
  # the caller uses the regex fallback, which preserves the
43
53
  # original string (1.x's ParseError path).
44
54
  def pubid_parse(string)
55
+ PUBID_PARSE_MEMO_LOCK.synchronize do
56
+ return PUBID_PARSE_MEMO[string] if PUBID_PARSE_MEMO.key?(string)
57
+ end
58
+ result = pubid_parse_uncached(string)
59
+ PUBID_PARSE_MEMO_LOCK.synchronize do
60
+ PUBID_PARSE_MEMO[string] = result if PUBID_PARSE_MEMO.size < PUBID_PARSE_MEMO_MAX
61
+ end
62
+ result
63
+ end
64
+
65
+ def pubid_parse_uncached(string)
45
66
  Pubid.eager_load_flavors!
46
67
  parsed_any = false
47
68
  plain_roundtrip = false
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "3.7.27".freeze
2
+ VERSION = "3.7.29".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.7.27
4
+ version: 3.7.29
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-11-29 00:00:00.000000000 Z
11
+ date: 2026-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64