relaton-bib 2.1.3 → 2.1.5
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/relaton/bib/sanitizer.rb +23 -2
- data/lib/relaton/bib/version.rb +1 -1
- data/lib/relaton/bib.rb +1 -1
- metadata +3 -7
- data/grammars/basicdoc.rng +0 -2140
- data/grammars/biblio-compile.rng +0 -11
- data/grammars/biblio-standoc.rng +0 -268
- data/grammars/biblio.rng +0 -2125
- /data/{grammars → lib/relaton/bib}/versions.json +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6cd10d57ba0df13f6955cd1f4de3281605a5e6aca2e18f36a03d2b43a5198ea
|
|
4
|
+
data.tar.gz: d63fcf1de920b8563ad07061949f12695965c876f89539cd6cd05e735f16a3bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ead9da7e9c7b37c5b59c97d1e64358bad682ce125f47bf5fe149fbfc36a1cd3de0acd3e7fe56ea0ad7e1406a0aecc85b2992af31d33e3b0f473f92d27c1c81bd
|
|
7
|
+
data.tar.gz: a19370e34930cc03dd25750518c29707673fb710da209f7ecb96eba789a74e797935c4f7f3e7980d7e6ebec3aeded874a161787f02751d454146da1e590c12b1
|
|
@@ -3,14 +3,33 @@ require "nokogiri"
|
|
|
3
3
|
module Relaton
|
|
4
4
|
module Bib
|
|
5
5
|
# Strips inline markup not in the basicdoc PureTextElement set
|
|
6
|
-
# (plus <p>, <eref>, <xref>) from raw marked-up content strings.
|
|
6
|
+
# (plus <p>, <eref>, <xref>, <fn>) from raw marked-up content strings.
|
|
7
7
|
# Disallowed elements are unwrapped: tags removed, inner text kept.
|
|
8
|
+
#
|
|
9
|
+
# <fn> is admitted beyond strict PureTextElement because bibliographic
|
|
10
|
+
# titles in real Metanorma input routinely carry footnotes (e.g. ISO
|
|
11
|
+
# standards titles with a disclaimer footnote), and downstream
|
|
12
|
+
# consumers — notably relaton-render's own inline-tag allow-list —
|
|
13
|
+
# already accept <fn> as a legitimate child of <title>. Stripping it
|
|
14
|
+
# here would break the round-trip.
|
|
15
|
+
#
|
|
16
|
+
# OPAQUE elements (currently <stem>) are also allowed, but the
|
|
17
|
+
# sanitiser does not descend into them: their contents are out-of-band
|
|
18
|
+
# inline notation (MathML, AsciiMath, LaTeX) rather than basicdoc
|
|
19
|
+
# markup, and must be preserved verbatim. Without the opaque-skip,
|
|
20
|
+
# the recursive walk would unwrap MathML / AsciiMath elements down to
|
|
21
|
+
# bare text nodes — see #116 for the round-trip-loss symptom.
|
|
8
22
|
module Sanitizer
|
|
9
23
|
ALLOWED = %w[
|
|
10
24
|
em strong sub sup tt underline strike smallcap br stem
|
|
11
|
-
p eref xref
|
|
25
|
+
p eref xref fn
|
|
12
26
|
].freeze
|
|
13
27
|
|
|
28
|
+
# Elements whose children are non-basicdoc inline notation
|
|
29
|
+
# (MathML, AsciiMath, LaTeX, …) and must be preserved verbatim
|
|
30
|
+
# rather than sanitised against ALLOWED.
|
|
31
|
+
OPAQUE = %w[stem].freeze
|
|
32
|
+
|
|
14
33
|
RENAME = {
|
|
15
34
|
"italic" => "em",
|
|
16
35
|
}.freeze
|
|
@@ -37,6 +56,8 @@ module Relaton
|
|
|
37
56
|
next unless child.element?
|
|
38
57
|
|
|
39
58
|
child.name = RENAME[child.name] if RENAME.key?(child.name)
|
|
59
|
+
next if OPAQUE.include?(child.name)
|
|
60
|
+
|
|
40
61
|
sanitize_children(child)
|
|
41
62
|
child.replace(child.children) unless ALLOWED.include?(child.name)
|
|
42
63
|
end
|
data/lib/relaton/bib/version.rb
CHANGED
data/lib/relaton/bib.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Relaton
|
|
|
33
33
|
# @return [Hash{String=>String}] schema versions
|
|
34
34
|
#
|
|
35
35
|
def schema_versions
|
|
36
|
-
@@schema_versions ||= JSON.parse File.read(File.join(__dir__, "
|
|
36
|
+
@@schema_versions ||= JSON.parse File.read(File.join(__dir__, "bib/versions.json"))
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bibtex-ruby
|
|
@@ -160,11 +160,6 @@ files:
|
|
|
160
160
|
- bin/rspec
|
|
161
161
|
- bin/setup
|
|
162
162
|
- docs/hash.adoc
|
|
163
|
-
- grammars/basicdoc.rng
|
|
164
|
-
- grammars/biblio-compile.rng
|
|
165
|
-
- grammars/biblio-standoc.rng
|
|
166
|
-
- grammars/biblio.rng
|
|
167
|
-
- grammars/versions.json
|
|
168
163
|
- lib/relaton/bib.rb
|
|
169
164
|
- lib/relaton/bib/converter/asciibib.rb
|
|
170
165
|
- lib/relaton/bib/converter/asciibib/to_asciibib.rb
|
|
@@ -235,6 +230,7 @@ files:
|
|
|
235
230
|
- lib/relaton/bib/sanitizer.rb
|
|
236
231
|
- lib/relaton/bib/util.rb
|
|
237
232
|
- lib/relaton/bib/version.rb
|
|
233
|
+
- lib/relaton/bib/versions.json
|
|
238
234
|
- relaton-bib.gemspec
|
|
239
235
|
homepage: https://github.com/relaton/relaton-bib
|
|
240
236
|
licenses:
|