Handle implicit issue link at start of line (#2987)
This treats a line starting with #123 - where 123 is a valid
issue or pull request ID - as an implicit link, rather than as
a header line.
Doing this is a bit complicated, as markdown does header line
processing early, in the block processors (that's before the
inline patterns we usually use). So we can't do this entirely
with inline patterns. We have to add a preprocessor that runs
before the block processors, and mungs the relevant strings so
the block processor doesn't turn them into header HTML. Then
we adjust the ImplicitIssuePattern to handle these modified
strings as well.
This also adds tests for implicit links, enabled by mocking out
enough bits of flask that `_get_ns_repo_user` is happy. There
are tests not only for implicit links at the start of a line but
also other cases, including the case of an implicit link not
surrounded by whitespace that was fixed in the previous commit.
Fixes https://pagure.io/pagure/issue/2987
Signed-off-by: Adam Williamson <awilliam@redhat.com>