summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-09-13 15:44:15 -0600
committerDan Allen <dan.j.allen@gmail.com>2019-09-13 15:44:15 -0600
commitddb4718e475a38d762ae8b00c3f21bcad0f9a770 (patch)
tree7bed7b99f1c4d53e7f8cc8443dd7f2fa13d2fc29
parenta3073b17ccb91f8eef6939500235b2dc0db4ac3c (diff)
verify self-referencing interdoc xref jumps to top of document body
-rw-r--r--spec/dest_spec.rb8
-rw-r--r--spec/fixtures/reference-to-self.adoc8
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/dest_spec.rb b/spec/dest_spec.rb
index 985b81bb..a83f5150 100644
--- a/spec/dest_spec.rb
+++ b/spec/dest_spec.rb
@@ -18,6 +18,14 @@ describe 'Asciidoctor::PDF::Converter - Dest' do
(expect top_y).to eql page_height
end
+ it 'should link self-referencing interdocument xref to built-in __anchor-top ref' do
+ pdf = to_pdf Pathname.new fixture_file 'reference-to-self.adoc'
+ (expect Pathname.new output_file 'reference-to-self.pdf').to exist
+ annotations = get_annotations pdf
+ (expect annotations).to have_size 1
+ (expect annotations[0][:Dest]).to eql '__anchor-top'
+ end
+
it 'should define a dest at the location of an inline anchor' do
['[[details]]details', '[#details]#details#'].each do |details|
pdf = to_pdf <<~EOS
diff --git a/spec/fixtures/reference-to-self.adoc b/spec/fixtures/reference-to-self.adoc
new file mode 100644
index 00000000..c1fe4b30
--- /dev/null
+++ b/spec/fixtures/reference-to-self.adoc
@@ -0,0 +1,8 @@
+= Document Title
+:doctype: book
+
+first page of content
+
+<<<
+
+<<reference-to-self#,go to top>>