isodoc 3.7.28 → 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 +4 -4
- data/lib/isodoc/css.rb +13 -4
- data/lib/isodoc/presentation_function/docid_semantic.rb +21 -0
- data/lib/isodoc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f9765f3c891cca29930972e25caa9ac605eeee3c773e2619ac96f891f1fcec1
|
|
4
|
+
data.tar.gz: c6addf143c820531cd95c78caa380b627d0192d56d9896354851cb39110693f5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
67
|
-
#
|
|
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
|
-
|
|
70
|
-
|
|
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)
|
|
@@ -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
|
data/lib/isodoc/version.rb
CHANGED