diff options
author | Turo Soisenniemi <turo.soisenniemi@outlook.com> | 2018-02-14 19:41:13 +0000 |
---|---|---|
committer | Turo Soisenniemi <turo.soisenniemi@outlook.com> | 2018-02-14 20:40:47 +0000 |
commit | 9a450aedc2c81f8ce17e4c9b4238c58edbef8269 (patch) | |
tree | e65b54cb2d6620c03a21a0780a076b8ee3b04e95 | |
parent | dd633bc1888453a07474d045eca91a9e66302ce0 (diff) | |
download | gitlab-ce-9a450aedc2c81f8ce17e4c9b4238c58edbef8269.tar.gz |
Set Asciidoctor outfilesuffix to default .adoc
Without setting outfilesuffix Asciidoctor defaults to .html. When .html is used,
inter-document cross references do not work in Gitlab's repository / file renderer.
See more information from
http://asciidoctor.org/docs/user-manual/#navigating-between-source-files
and
http://asciidoctor.org/docs/user-manual/#inter-document-cross-references
-rw-r--r-- | changelogs/unreleased/asciidoc_inter_document_cross_references.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/asciidoc.rb | 3 | ||||
-rw-r--r-- | spec/lib/gitlab/asciidoc_spec.rb | 8 |
3 files changed, 15 insertions, 1 deletions
diff --git a/changelogs/unreleased/asciidoc_inter_document_cross_references.yml b/changelogs/unreleased/asciidoc_inter_document_cross_references.yml new file mode 100644 index 00000000000..34b26753312 --- /dev/null +++ b/changelogs/unreleased/asciidoc_inter_document_cross_references.yml @@ -0,0 +1,5 @@ +--- +title: Asciidoc now support inter-document cross references between files in repository +merge_request: 17125 +author: Turo Soisenniemi +type: changed diff --git a/lib/gitlab/asciidoc.rb b/lib/gitlab/asciidoc.rb index ee7f4be6b9f..62c41801d75 100644 --- a/lib/gitlab/asciidoc.rb +++ b/lib/gitlab/asciidoc.rb @@ -8,7 +8,8 @@ module Gitlab module Asciidoc DEFAULT_ADOC_ATTRS = [ 'showtitle', 'idprefix=user-content-', 'idseparator=-', 'env=gitlab', - 'env-gitlab', 'source-highlighter=html-pipeline', 'icons=font' + 'env-gitlab', 'source-highlighter=html-pipeline', 'icons=font', + 'outfilesuffix=.adoc' ].freeze # Public: Converts the provided Asciidoc markup into HTML. diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index f668f78c2b8..2a0e19ae796 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -95,6 +95,14 @@ module Gitlab expect(render(input, context)).to include('<p><code data-math-style="inline" class="code math js-render-math">2+2</code> is 4</p>') end end + + context 'outfilesuffix' do + it 'defaults to adoc' do + output = render("Inter-document reference <<README.adoc#>>", context) + + expect(output).to include("a href=\"README.adoc\"") + end + end end def render(*args) |