summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--lib/asciidoctor/rx.rb2
-rw-r--r--test/substitutions_test.rb14
3 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 40f10adf..0938d5a9 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -22,6 +22,7 @@ Bug Fixes::
* Don't clobber cgi-style options on language when enabling start_inline option on the Rouge PHP lexer (#3336)
* Fix parsing of wrapped link and xref text, including when an attrlist signature is detected (#3331)
* Restore deprecated writable number property on AbstractBlock
+ * Allow a bibliography reference to be used inside a footnote (#3325)
Improvements::
diff --git a/lib/asciidoctor/rx.rb b/lib/asciidoctor/rx.rb
index 5dc19467..746cf971 100644
--- a/lib/asciidoctor/rx.rb
+++ b/lib/asciidoctor/rx.rb
@@ -469,7 +469,7 @@ module Asciidoctor
# footnoteref:[id,text] (legacy)
# footnoteref:[id] (legacy)
#
- InlineFootnoteMacroRx = /\\?footnote(?:(ref):|:([#{CC_WORD}-]+)?)\[(?:|(#{CC_ALL}*?[^\\]))\]/m
+ InlineFootnoteMacroRx = /\\?footnote(?:(ref):|:([#{CC_WORD}-]+)?)\[(?:|(#{CC_ALL}*?[^\\]))\](?!<\/a>)/m
# Matches an image or icon inline macro.
#
diff --git a/test/substitutions_test.rb b/test/substitutions_test.rb
index c2a74946..ef16aba1 100644
--- a/test/substitutions_test.rb
+++ b/test/substitutions_test.rb
@@ -1127,6 +1127,20 @@ context 'Substitutions' do
assert_xpath '//a[@class="footnote"][text()="1"]', output, 2
end
+ test 'should be able to reference a bibliography entry in a footnote' do
+ input = <<~'EOS'
+ Choose a design pattern.footnote:[See <<gof>> to find a collection of design patterns.]
+
+ [bibliography]
+ == Bibliography
+
+ * [[[gof]]] Erich Gamma, et al. _Design Patterns: Elements of Reusable Object-Oriented Software._ Addison-Wesley. 1994.
+ EOS
+
+ result = convert_string_to_embedded input
+ assert_include '<a href="#_footnoteref_1">1</a>. See <a href="#gof">[gof]</a> to find a collection of design patterns.', result
+ end
+
test 'a single-line index term macro with a primary term should be registered as an index reference' do
sentence = "The tiger (Panthera tigris) is the largest cat species.\n"
macros = ['indexterm:[Tigers]', '(((Tigers)))']