diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-04-03 16:52:05 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-04-03 16:52:05 -0600 |
| commit | 3d07d2490f132d8e11a4a19b1c737d5d4ae77d6e (patch) | |
| tree | a0ccb4cf98760bd698e637a991df66e5befca60b /spec/index_spec.rb | |
| parent | 6507020daf9650867e47b85db2019c576fe8e997 (diff) | |
add test case for #1902
Diffstat (limited to 'spec/index_spec.rb')
| -rw-r--r-- | spec/index_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/index_spec.rb b/spec/index_spec.rb index 76ad735c..f68afcd1 100644 --- a/spec/index_spec.rb +++ b/spec/index_spec.rb @@ -166,6 +166,43 @@ describe 'Asciidoctor::PDF::Converter - Index' do (expect term_pgnum).to be 2 end + it 'should target first occurance of index term, not in xreftext' do + pdf = to_pdf <<~'EOS', analyze: true + = Document Title + :doctype: book + :notitle: + + == Install + + .((node.install)) + [[node-install]] + $ nvm install node + + == Version + + .((node.version)) + [[node-version]] + $ node -v + + <<node-install>> + + == Uninstall + + .((node.uninstall) + [[node-uninstall]] + $ nvm uninstall node + + <<node-install>> + + [index] + == Index + EOS + + index_pgnum = (pdf.find_text 'Index')[0][:page_number] + index_lines = pdf.lines pdf.find_text page_number: index_pgnum + (expect index_lines).to eql ['Index', 'N', 'node.install, 1', 'node.version, 2'] + end + it 'should not assign number or chapter label to index section' do pdf = to_pdf <<~'EOS', doctype: :book, analyze: true = Cats & Dogs |
