Markdown.pl: _PrefixURL more intelligently
commitac94bf3bbfd59ca5f5069c3421b6e6f77af56cff
authorKyle J. McKay <mackyle@gmail.com>
Wed, 14 Feb 2018 10:12:30 +0000 (14 02:12 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Wed, 14 Feb 2018 10:12:30 +0000 (14 02:12 -0800)
tree64306cdb2bc6896b327115e436886e193eb878f3
parentd943c07ae69f38ddbe350312b14beb97349e4c44
Markdown.pl: _PrefixURL more intelligently

Instead of turning an empty URL into an href="" attribute that
effectively does nothing, change it into an href="#" attribute that
creates a link to the current page.

When adding a relative/image prefix leave fragment-only links
unmolested.  They are meant to link somewhere on the current page
and must not be changed.

When inspecting the destination to determine whether to use the -i
prefix instead of the -r prefix when both are given, ignore any
trailing fragment.  Fragments don't really make sense on image links
and should never actually be sent to the server anyway by a behaving
client, but match them properly in any case.

Also make sure that URLs only get a prefix added at most once.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Markdown.pl