aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-01-10 15:52:59 +0100
committerJochen Topf <jochen@topf.org>2013-01-10 15:52:59 +0100
commit7b929479f8d941666ceb26b1dc476b7f1ef315cd (patch)
treec322fc2410aaacfdee5c5094638177956a8da202 /web/lib
parent4817d853f45f699b959a76ca1c6ec74833875b47 (diff)
downloadtaginfo-7b929479f8d941666ceb26b1dc476b7f1ef315cd.tar
taginfo-7b929479f8d941666ceb26b1dc476b7f1ef315cd.tar.gz
Improved display of wiki links.
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/utils.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/web/lib/utils.rb b/web/lib/utils.rb
index 2549b57..c27241e 100644
--- a/web/lib/utils.rb
+++ b/web/lib/utils.rb
@@ -83,6 +83,11 @@ def external_link(id, title, link, new_window=false)
%Q{<a id="#{id}" #{target}rel="nofollow" class="extlink" href="#{link}">#{title}</a>}
end
+def wiki_link(title)
+ prefix = 'http://wiki.openstreetmap.org/wiki/'
+ external_link('wikilink_' + title.gsub(%r{[^A-Za-z0-9]}, '_'), title, prefix + title)
+end
+
def tagcloud_size(tag)
x = tag['scale1'].to_f / 20 + tag['pos'] / 4
(x * 40 + 12).to_i