def sub_inline_anchors(text, found = nil)
if (!found || found[:square_bracket]) && text.include?('[[[')
text = text.gsub(InlineBiblioAnchorRx) {
m = $~
if m[0].start_with? '\\'
next m[0][1..-1]
end
id = reftext = m[1]
Inline.new(self, :anchor, reftext, :type => :bibref, :target => id).convert
}
end
if ((!found || found[:square_bracket]) && text.include?('[[')) ||
((!found || found[:macroish]) && text.include?('anchor:'))
text = text.gsub(InlineAnchorRx) {
m = $~
if m[0].start_with? '\\'
next m[0][1..-1]
end
if ::RUBY_ENGINE_OPAL
m[1] = nil if m[1] == ''
m[2] = nil if m[2] == ''
m[4] = nil if m[4] == ''
end
id = m[1] || m[3]
reftext = m[2] || m[4] || %([#{id}])
Inline.new(self, :anchor, reftext, :type => :ref, :target => id).convert
}
end
text
end