forked from organicmaps/organicmaps
[generator] More review fixes
This commit is contained in:
parent
a373e62142
commit
809c163037
2 changed files with 10 additions and 4 deletions
|
@ -149,6 +149,14 @@ UNIT_TEST(Metadata_ValidateAndFormat_wikipedia)
|
|||
p("wikipedia", "https://en.wikipedia.org/wiki/");
|
||||
TEST(params.GetMetadata().Empty(), ("Null wiki"));
|
||||
|
||||
p("wikipedia", "http://.wikipedia.org/wiki/Whatever");
|
||||
TEST(params.GetMetadata().Empty(), ("Null lang", params.GetMetadata().Get(feature::Metadata::FMD_WIKIPEDIA)));
|
||||
|
||||
// We ignore incorrect prefixes
|
||||
p("wikipedia", "ht.tps://en.wikipedia.org/wiki/Whuh");
|
||||
TEST_EQUAL(params.GetMetadata().Get(feature::Metadata::FMD_WIKIPEDIA), "en:Whuh", ("ht.tp:"));
|
||||
params.GetMetadata().Drop(feature::Metadata::FMD_WIKIPEDIA);
|
||||
|
||||
p("wikipedia", "http://ru.google.com/wiki/wutlol");
|
||||
TEST(params.GetMetadata().Empty(), ("Google"));
|
||||
}
|
||||
|
|
|
@ -196,10 +196,8 @@ protected:
|
|||
escaped.fill('0');
|
||||
escaped << hex;
|
||||
|
||||
for (string::const_iterator i = value.cbegin(), n = value.cend(); i != n; ++i)
|
||||
for (auto const & c : value)
|
||||
{
|
||||
string::value_type c = (*i);
|
||||
|
||||
// Keep alphanumeric and other accepted characters intact
|
||||
// Convert spaces to '_' as wikipedia does
|
||||
// Turn other characters to '%00' sequences
|
||||
|
@ -230,7 +228,7 @@ protected:
|
|||
{
|
||||
// Convert URL to "lang:title"
|
||||
i += 3;
|
||||
string::size_type const j = v.find('.');
|
||||
string::size_type const j = v.find('.', i + 1);
|
||||
string const wikiUrlPart = ".wikipedia.org/wiki/";
|
||||
if (j != string::npos && v.substr(j, wikiUrlPart.length()) == wikiUrlPart)
|
||||
return v.substr(i, j - i) + ":" + v.substr(j + wikiUrlPart.length());
|
||||
|
|
Loading…
Add table
Reference in a new issue