Skip to content

Commit

Permalink
issue warning on non-existing index/@to: metanorma/bipm-si-brochure#273
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Dec 20, 2024
1 parent f7cb56e commit 27ef3ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/metanorma/standoc/validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def repeat_id_validate(doc)

# manually check for xref/@target, xref/@to integrity
def xref_validate(doc)
@doc_xrefs = doc.xpath("//xref/@target | //xref/@to")
@doc_xrefs = doc.xpath("//xref/@target | //xref/@to | //index/@to")
.each_with_object({}) do |x, m|
m[x.text] = x
@doc_ids[x.text] and next
Expand Down
5 changes: 4 additions & 1 deletion spec/metanorma/validate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@
.to include("Could not resolve footnoteblock:[id1]")
end

it "Warning if xref/@target does not point to a real identifier" do
it "Warning if xref/@target, (xref/@to), index/@to does not point to a real identifier" do
FileUtils.rm_f "test.err.html"
Asciidoctor.convert(<<~INPUT, *OPTIONS)
= Document title
Expand All @@ -1275,9 +1275,12 @@
:no-pdf:
<<id1>>
index-range:id3[(((A)))]
INPUT
expect(File.read("test.err.html"))
.to include("Crossreference target id1 is undefined")
expect(File.read("test.err.html"))
.to include("Crossreference target id3 is undefined")
end

it "Warns if illegal nessting of assets within assets" do
Expand Down

0 comments on commit 27ef3ae

Please sign in to comment.