diff --git a/.github/workflows/rake.yml b/.github/workflows/rake.yml
index a65cc67..9c45288 100644
--- a/.github/workflows/rake.yml
+++ b/.github/workflows/rake.yml
@@ -7,6 +7,7 @@ on:
branches: [ master, main ]
tags: [ v* ]
pull_request:
+ workflow_dispatch:
jobs:
rake:
diff --git a/lib/relaton/bibcollection.rb b/lib/relaton/bibcollection.rb
index bc1e5c5..d30a711 100644
--- a/lib/relaton/bibcollection.rb
+++ b/lib/relaton/bibcollection.rb
@@ -32,8 +32,8 @@ def <<(item)
# @param source [Nokogiri::XML::Element]
def self.from_xml(source)
- title = find_text("./relaton-collection/title", source)
- author = find_text(
+ title = find_html("./relaton-collection/title", source)
+ author = find_html(
"./relaton-collection/contributor[role/@type='author']/organization/"\
"name", source
)
diff --git a/lib/relaton/element_finder.rb b/lib/relaton/element_finder.rb
index cdb1230..84afe40 100644
--- a/lib/relaton/element_finder.rb
+++ b/lib/relaton/element_finder.rb
@@ -6,6 +6,10 @@ def find_text(xpath, element = nil)
find(xpath, element)&.text
end
+ def find_html(xpath, element = nil)
+ find(xpath, element)&.inner_html
+ end
+
def find(xpath, element = nil)
(element || document).at(apply_namespace(xpath))
end
diff --git a/relaton-cli.gemspec b/relaton-cli.gemspec
index 0971551..3535a31 100644
--- a/relaton-cli.gemspec
+++ b/relaton-cli.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = ">= 3.0.0"
spec.add_runtime_dependency "liquid", "~> 5"
- spec.add_runtime_dependency "relaton", "~> 1.20.2"
+ spec.add_runtime_dependency "relaton", "~> 1.20.3"
spec.add_runtime_dependency "thor"
spec.add_runtime_dependency "thor-hollaback"
diff --git a/spec/assets/index-with-markup.xml b/spec/assets/index-with-markup.xml
new file mode 100644
index 0000000..c42f9b0
--- /dev/null
+++ b/spec/assets/index-with-markup.xml
@@ -0,0 +1,23 @@
+
+ Use of ActualText & Reference structure elements
+
+
+
+ Acme & Co
+
+
+
+
+ Sample doc title
+ http://example.org/sample.pdf
+ EX 1
+
+ 2026-01-01
+
+ Published
+
+ TC EX
+
+
+
+
diff --git a/spec/relaton/cli/xml_to_html_renderer_spec.rb b/spec/relaton/cli/xml_to_html_renderer_spec.rb
index 500a6d4..4ce740b 100644
--- a/spec/relaton/cli/xml_to_html_renderer_spec.rb
+++ b/spec/relaton/cli/xml_to_html_renderer_spec.rb
@@ -31,6 +31,29 @@
end
end
+ context "with markup and entities in the collection title and author" do
+ let(:html) do
+ renderer.render(File.read("spec/assets/index-with-markup.xml"))
+ end
+
+ it "preserves markup and & in the coverpage title" do
+ expect(html).to include(
+ 'Use of ActualText ' \
+ "& Reference structure elements",
+ )
+ end
+
+ it "strips inline tags but keeps & in " do
+ head_title = html[/([^<]*(?:<(?!\/title)[^<]*)*)<\/title>/m, 1]
+ expect(head_title).to include("&")
+ expect(head_title).not_to include("")
+ end
+
+ it "preserves & in the rendered author" do
+ expect(html).to include("Acme & Co")
+ end
+ end
+
context "with a document containing other collections" do
let(:html) do
renderer.render(File.read("spec/assets/with-collections.xml"))
diff --git a/templates/_index.liquid b/templates/_index.liquid
index 4b2c97b..9d36d84 100644
--- a/templates/_index.liquid
+++ b/templates/_index.liquid
@@ -1,7 +1,7 @@
- {{ title }}
+ {{ title | strip_html }}