If the user is logged in then consider all their preferred
languages rather than just the UI language, and use the full
locale matching algorithm instead of just checking parents.
Fixes#2636
Wikidata entities should be linked using concept URIs, which are
permanent. This is the right way of linking web resources according
to the Linked Data principles.
Closes#1884
With this commit, the prefixed wikidata-tags get linked to the
corresponding wikidata.org-page in the current interface-language.
Multiple semicolon-separated wikidata-IDs are shown as multiple
semicolon-separated links to wikidata.
This commit contains also some tests for those links.
It turns out that the PHP urlencode encodes more characters than
the ruby URI.encode does by default, so specify our own characters
to encode based on http://php.net/manual/en/function.urlencode.php
with the extra exclusion of colon, which the mediawiki code reverses
after the encoding is done.
Fixes#967
Analogous to wikipedia tags this links any wikidata tag with its item
page on wikidata.
For now it's restricted to the plain wikidata=* tag (namespaces like
operator:wikidata=* and similar are not yet supported) and only accepts
the values with the format Q<number>.
International phone numbers become links using the official URI scheme
as per http://tools.ietf.org/html/rfc3966.
It is not limited to key=phone, so it can be used in other keys as well.
When creating a wikipedia link from a tag, the function
is (correctly) appending "?userlang=#{I18N.lang}" to the URL,
but doing this breaks the reference to a specific section
of a wikipedia article (if there is any).
For example, if the tag is "wikipedia=Article#Section", the function
would create a link to "../Article#Section?uselang=xx", and then the
browser wouldn't be able to correctly find the section. The correct
link result should be "../Article?uselang=xx#Section".
This commit fixes this by verifying if there is a reference to a
specific section of the article, and then putting "?uselang=#{I18N.lang}"
between the article's name and the section name.
The update-wiki-pages script normalizes " " to "_" (since MediaWiki
does it by design), but I didn't normalize it back in the
browse_helper.
Consequently objects with tags like "source=Isle of Man Government
aerial imagery (2001)" were never linked to the wiki correctly.