Remove blank &page= parameter when page isn't specified, and indicate
page in the link's text when it is.
This commit is contained in:
Toks
2014-08-01 17:59:59 -04:00
parent 76f31bd6b5
commit b22a77d4c5

View File

@@ -103,7 +103,8 @@ class DText
def self.parse_id_links(str)
str = str.gsub(/\bpost #(\d+)/i, %{<a href="/posts/\\1">post #\\1</a>})
str = str.gsub(/\bforum #(\d+)/i, %{<a href="/forum_posts/\\1">forum #\\1</a>})
str = str.gsub(/\btopic #(\d+)(?:\/p(\d+))?/i, %{<a href="/forum_topics/\\1?page=\\2">topic #\\1</a>})
str = str.gsub(/\btopic #(\d+)(?!\/p\d|\d)/i, %{<a href="/forum_topics/\\1">topic #\\1</a>})
str = str.gsub(/\btopic #(\d+)\/p(\d+)/i, %{<a href="/forum_topics/\\1?page=\\2">topic #\\1/p\\2</a>})
str = str.gsub(/\bcomment #(\d+)/i, %{<a href="/comments/\\1">comment #\\1</a>})
str = str.gsub(/\bpool #(\d+)/i, %{<a href="/pools/\\1">pool #\\1</a>})
str = str.gsub(/\buser #(\d+)/i, %{<a href="/users/\\1">user #\\1</a>})