From 49f1686e7faa41a1c79a95e941c845ea1d5095c3 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Tue, 2 Apr 2019 01:06:42 +0200 Subject: Add .adoc extension to all xref paths --- README.adoc | 4 ++-- spec/fixtures/b/c/doc-c.adoc | 2 +- spec/fixtures/b/doc-b.adoc | 2 +- spec/integration_spec.rb | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.adoc b/README.adoc index af8c70b..a2d294c 100644 --- a/README.adoc +++ b/README.adoc @@ -24,7 +24,7 @@ This project is an http://asciidoctor.org/[Asciidoctor] extension providing impl When you define a cross reference to another document “other.adoc” _without_ a label, e.g.: ---- -xref:other#[] +xref:other.adoc#[] ---- Asciidoctor converts it into a plain link with the target document’s path as a text: @@ -47,7 +47,7 @@ where “Other Document” is a *title* of the _other.adoc_. Similarly with cross reference to a section in another document, e.g.: ---- -xref:other#sec1[] +xref:other.adoc#sec1[] ---- Asciidoctor converts it in the same way as above, but this extensions converts it into: diff --git a/spec/fixtures/b/c/doc-c.adoc b/spec/fixtures/b/c/doc-c.adoc index 7da2676..40877bf 100644 --- a/spec/fixtures/b/c/doc-c.adoc +++ b/spec/fixtures/b/c/doc-c.adoc @@ -1,3 +1,3 @@ = Document C -xref:../doc-b#[] +xref:../doc-b.adoc#[] diff --git a/spec/fixtures/b/doc-b.adoc b/spec/fixtures/b/doc-b.adoc index 9ed3a43..4f24989 100644 --- a/spec/fixtures/b/doc-b.adoc +++ b/spec/fixtures/b/doc-b.adoc @@ -1,3 +1,3 @@ = Document B -xref:c/doc-c#[] +xref:c/doc-c.adoc#[] diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index 826fa5b..19655bf 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -31,24 +31,24 @@ describe 'Intengration Tests' do context 'without fragment' do it 'renders title of the referenced document as reftext' do - given 'xref:doc-a#[]' + given 'xref:doc-a.adoc#[]' should have_anchor href: 'doc-a.html', text: 'Document A' end end context 'with fragment' do it 'renders title of the referenced section with implicit id as reftext' do - given 'xref:doc-a#_first_section[]' + given 'xref:doc-a.adoc#_first_section[]' should have_anchor href: 'doc-a.html#_first_section', text: 'First Section' end it 'renders title of the referenced section with explicit id as reftext' do - given 'xref:doc-a#sec2[]' + given 'xref:doc-a.adoc#sec2[]' should have_anchor href: 'doc-a.html#sec2', text: 'Second Section' end it 'renders reftext of the referenced section with explicit reftext' do - given 'xref:doc-a#_third_section[]' + given 'xref:doc-a.adoc#_third_section[]' should have_anchor href: 'doc-a.html#_third_section', text: '3rd Section' end end @@ -66,7 +66,7 @@ describe 'Intengration Tests' do context 'when extension is not active' do specify 'renders path of the referenced document as reftext' do - given 'xref:doc-a#[]', extensions: [] + given 'xref:doc-a.adoc#[]', extensions: [] # Note: Asciidoctor 1.5.6 and 1.5.6.1 behaves differently. should have_anchor href: 'doc-a.html', text: /doc-a/ end @@ -77,7 +77,7 @@ describe 'Intengration Tests' do context 'without fragment' do it 'renders path of the non-existent document as reftext' do - given 'xref:missing#[]' + given 'xref:missing.adoc#[]' # Note: Asciidoctor 1.5.6 and 1.5.6.1 behaves differently. should have_anchor href: 'missing.html', text: /missing/ end @@ -85,7 +85,7 @@ describe 'Intengration Tests' do context 'with non-existent fragment' do it 'renders path of the referenced document as reftext' do - given 'xref:doc-a#missing[]' + given 'xref:doc-a.adoc#missing[]' # Note: Asciidoctor 1.5.6 and 1.5.6.1 behaves differently. should have_anchor href: 'doc-a.html#missing', text: /doc-a/ end @@ -94,7 +94,7 @@ describe 'Intengration Tests' do context 'document with valid inter-document xref with reftext' do it 'renders provided reftext' do - given 'xref:doc-a#[My Title]' + given 'xref:doc-a.adoc#[My Title]' should have_anchor href: 'doc-a.html', text: 'My Title' end end -- cgit v1.2.3