diff options
author | Nick Thomas <nick@gitlab.com> | 2019-07-17 15:19:07 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-17 15:19:07 +0000 |
commit | 2860cfaaff0a435792081b72a5f97de85e0d4f70 (patch) | |
tree | c453cd91a055b7b776fb04c00a6080beb1696276 /spec/lib | |
parent | f6399f1dfe7d2ff9f1bdfc278901b4919c85479f (diff) | |
parent | 34c6f2723c3bc44aba1d9d886522fdfe8db6a9f6 (diff) | |
download | gitlab-ce-2860cfaaff0a435792081b72a5f97de85e0d4f70.tar.gz |
Merge branch 'issue-64645-asciidoctor-footnote-links' into 'master'
Preserve footnote link ids
Closes #64645
See merge request gitlab-org/gitlab-ce!30790
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/asciidoc_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index 5293732ead1..cbd4a509a55 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -110,6 +110,56 @@ module Gitlab expect(render(input, context)).to include(output.strip) end + + it 'removes non footnote def ids' do + input = <<~ADOC + ++++ + <div id="def">Footnote definition</div> + ++++ + ADOC + + output = <<~HTML + <div>Footnote definition</div> + HTML + + expect(render(input, context)).to include(output.strip) + end + + it 'removes non footnote ref ids' do + input = <<~ADOC + ++++ + <a id="ref">Footnote reference</a> + ++++ + ADOC + + output = <<~HTML + <a>Footnote reference</a> + HTML + + expect(render(input, context)).to include(output.strip) + end + end + + context 'with footnotes' do + it 'preserves ids and links' do + input = <<~ADOC + This paragraph has a footnote.footnote:[This is the text of the footnote.] + ADOC + + output = <<~HTML + <div> + <p>This paragraph has a footnote.<sup>[<a id="_footnoteref_1" href="#_footnotedef_1" title="View footnote.">1</a>]</sup></p> + </div> + <div> + <hr> + <div id="_footnotedef_1"> + <a href="#_footnoteref_1">1</a>. This is the text of the footnote. + </div> + </div> + HTML + + expect(render(input, context)).to include(output.strip) + end end context 'with section anchors' do |