From 2e4bc5836e99346d6e4ad407b8387520b666e9b9 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Fri, 25 Sep 2015 19:47:06 +0300 Subject: [PATCH 1/2] [generator] More comments for wikipedia tags processing --- generator/osm2meta.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/osm2meta.hpp b/generator/osm2meta.hpp index 82d7f1b14e..87e1870af2 100644 --- a/generator/osm2meta.hpp +++ b/generator/osm2meta.hpp @@ -219,7 +219,7 @@ protected: if (i == string::npos || i < 2 || i + 2 > v.length()) return string(); - // URL encode lang:title, so URL can be reconstructed faster + // URL encode lang:title (lang is at most 3 chars), so URL can be reconstructed faster if (i <= 3 || v.substr(0, i) == "be-x-old") return v.substr(0, i + 1) + WikiUrlEncode(v.substr(i + 1)); @@ -227,7 +227,7 @@ protected: if (v[i+1] == '/' && i + minUrlPartLength < v.length()) { // Convert URL to "lang:title" - i += 3; + i += 3; // skip "://" string::size_type const j = v.find('.', i + 1); static string const wikiUrlPart = ".wikipedia.org/wiki/"; if (j != string::npos && v.substr(j, wikiUrlPart.length()) == wikiUrlPart) From f7b87e2b861e2d0499df0c7497b92eb9eb665852 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Fri, 25 Sep 2015 20:30:10 +0300 Subject: [PATCH 2/2] [generator] Dots --- generator/osm2meta.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generator/osm2meta.hpp b/generator/osm2meta.hpp index 87e1870af2..474b9ea722 100644 --- a/generator/osm2meta.hpp +++ b/generator/osm2meta.hpp @@ -214,19 +214,19 @@ protected: string ValidateAndFormat_wikipedia(string const & v) const { - // Find prefix before ':', shortest case: "lg:aa" + // Find prefix before ':', shortest case: "lg:aa". string::size_type i = v.find(':'); if (i == string::npos || i < 2 || i + 2 > v.length()) return string(); - // URL encode lang:title (lang is at most 3 chars), so URL can be reconstructed faster + // URL encode lang:title (lang is at most 3 chars), so URL can be reconstructed faster. if (i <= 3 || v.substr(0, i) == "be-x-old") return v.substr(0, i + 1) + WikiUrlEncode(v.substr(i + 1)); static string::size_type const minUrlPartLength = string("//be.wikipedia.org/wiki/AB").length(); if (v[i+1] == '/' && i + minUrlPartLength < v.length()) { - // Convert URL to "lang:title" + // Convert URL to "lang:title". i += 3; // skip "://" string::size_type const j = v.find('.', i + 1); static string const wikiUrlPart = ".wikipedia.org/wiki/";