diff options
author | Guillaume Grossetie <ggrossetie@gmail.com> | 2019-07-10 10:30:10 +0200 |
---|---|---|
committer | Guillaume Grossetie <ggrossetie@gmail.com> | 2019-07-17 08:40:50 +0200 |
commit | 34c6f2723c3bc44aba1d9d886522fdfe8db6a9f6 (patch) | |
tree | 77511b4b3fb511c843ff49098f811bb8bcdba966 /spec | |
parent | 1e99c1b0a7b4e80be5a0be40aebb7f4cad0077de (diff) | |
download | gitlab-ce-34c6f2723c3bc44aba1d9d886522fdfe8db6a9f6.tar.gz |
Preserve footnote link ids
Diffstat (limited to 'spec')
-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 |