User:Utcursch/Migrate Infobox Indian Jurisdiction to Infobox settlement/main.js: Difference between revisions

Content deleted Content added
m m
m m
Line 51:
 
/**
* BuildParse the Infobox settlementinfobox string to extract parameter-value pairs
*
* @param infobox_text the infobox string
Line 113:
state_name = state_name.replace("[[", "");
state_name = state_name.replace("]]", "");
 
 
// Location map
var pushpin_map = "India";
 
if (state_name != "") {
// don't have ___location map templates for these
// http://en.wikipedia.org/wiki/Category:India_location_map_templates
var states_with_no_map = {
"Lakshadweep" : 1,
"Chandigarh" : 1,
"Daman and Diu" : 1,
"Daman & Diu" : 1
};
if (state_name != "" && (! states_with_no_map[state_name]) ) {
pushpin_map = "India " + state_name;
}
if (orig_infobox_params[state_name == "metroPunjab, India"] ) {
// don't want "India Punjab, India"
if (orig_infobox_params["metro"] == "Chennai" ||
pushpin_map = "India Punjab";
orig_infobox_params["metro"] == "Chennai" ||
}
orig_infobox_params["metro"] == "Bangalore" ||
// these cities have a ___location map template -- use it as the pushpin_map
orig_infobox_params["metro"] == "Bengaluru" ||
var metros_with_map = {
orig_infobox_params["metro"] == "Mumbai"
"Bangalore" : 1,
) {
"Bengaluru" : 1,
pushpin_map = "India " + orig_infobox_params["metro"];
"Bhopal" : 1,
}
"Chennai" : 1,
"Delhi" : 1,
"Kochi" : 1,
"Mumbai" : 1,
"Tiruchirapalli" : 1
}
if (orig_infobox_params["metro"] && metros_with_map[orig_infobox_params["metro"]] ) {
pushpin_map = "India " + orig_infobox_params["metro"];
}
 
Line 142 ⟶ 160:
if (state_name != "") {
subdivisions["[[States and territories of India|State]]"] = "[[" + state_name + "]]";
}
// display "Punjab" instead of "Punjab, India" (India is already displayed a line above)
if (state_name !== "Punjab, India") {
subdivisions["[[States and territories of India|State]]"] = "[[Punjab, India|Punjab]]";
}
if (orig_infobox_params["region"]) {
Line 313 ⟶ 335:
"| native_name_lang = " + (orig_infobox_params["native_name_lang"] ? orig_infobox_params["native_name_lang"] : "") + "\n" +
"| other_name = " + (orig_infobox_params["other_name"] ? orig_infobox_params["other_name"] : "") + "\n" +
"| nickname = " + (orig_infobox_params["nickname"] ? orig_infobox_params["nickname"] : "") + "\n" +
"| settlement_type = " + (orig_infobox_params["type"] ? orig_infobox_params["type"] : "") + "\n" +
"| image_skyline = " + (orig_infobox_params["skyline"] ? orig_infobox_params["skyline"] : "") + "\n" +
"| image_alt = " + (orig_infobox_params["skyline_alt"] ? orig_infobox_params["skyline_alt"] : "") + "\n" +
"| image_caption = " + (orig_infobox_params["skyline_caption"] ? orig_infobox_params["skyline_caption"] : "") + "\n";
 
if (orig_infobox_params["metroimage_flag"]) == "Chennai" ||{
new_infobox_str +=
"| image_flag = " + orig_infobox_params["image_flag"] + "\n" +
"| flag_size = " + (orig_infobox_params["flag_size"] ? orig_infobox_params["flag_size"] : "") + "\n" +
"| flag_alt = " + (orig_infobox_params["flag_alt"] ? orig_infobox_params["flag_alt"] : "") + "\n";
}
 
if (orig_infobox_params["image_seal"]) {
Line 325 ⟶ 355:
}
 
if (orig_infobox_params["metrobase_map"]) == "Chennai" ||{
new_infobox_str +=
new_infobox_str +=
"| nickname = " + (orig_infobox_params["nickname"] ? orig_infobox_params["nickname"] : "") + "\n" +
"| image_map = " + (orig_infobox_params["base_map"] ? orig_infobox_params["base_map"] : "") + "\n" +
"| map_alt = " + (orig_infobox_params["base_map_alt"] ? orig_infobox_params["base_map_alt"] : "") + "\n" +
"| map_caption = " + (orig_infobox_params["map_caption"] ? orig_infobox_params["map_caption"] : "") + "\n" +;
}
 
new_infobox_str +=
"| pushpin_map = " + (orig_infobox_params["latd"] ? pushpin_map : ("<!--" + pushpin_map + "-->")) + "\n" +
"| pushpin_label_position = " + (orig_infobox_params["locator_position"] ? orig_infobox_params["locator_position"] : "") + "\n" +
Line 351 ⟶ 384:
*/
"| subdivision_type = Country" + "\n" +
"| subdivision_name = " + "[[India]]\n";
 
 
Line 536 ⟶ 569:
"Odisha" : "[[Oriya language|Oriya]]",
"Punjab" : "[[Punjabi language|Punjabi]]",
"Punjab, India" : "[[Punjabi language|Punjabi]]",
"Rajasthan" : "[[Hindi language|Hindi]]",
"Sikkim" : "[[Nepali language|Nepali]], [[Bhutia language|Bhutia]], [[Lepcha language|Lepcha]], [[Limbu language|Limbu]], [[Newari language|Newari]], [[Kiranti languages|Rai]], [[Gurung language|Gurung]], Mangar, [[Sherpa language|Sherpa]], [[Tamang language|Tamang]] and [[Sunwar language|Sunwar]]",