User:Shushugah/DiplomacyDocumentation
Appearance
Diplomatic templates
[edit]If you are reading this, you probably found this link at the talk page of one of the templates. If you see any bugs, have questions, feel free to raise a question on the talk page of this page, or on my main User_talk page.
Example Templates created using this script
[edit]How can I help?
[edit]- If you see any bugs, have questions, feel free to raise a question on the talk page of this page, or on my main User_talk page
- These templates are mostly useful if people can see them, and if they have links to English Wikipedia articles and wiki articles from other language Wikipedias.
- To find all embassies in one country, for example Burundi click on the following Wikidata SPARQL query. Click through all results to see if there are Wikipedia articles in any language. If you want another country, you'll need to edit it (click on "Edit Visually" and enter the country name, OR "Edit SPARQL" and replace wd:Q967 with whatever country you want. (Credit to User:Finnusertop for this tip).
- To find all the embassies and consular services associated with one country (but located elsewhere) you can use this SPARQL query
- To find just consulates which have at least one Wikipedia article associated with them see
Embassy naming convention
[edit]Wikipedia:Break all rules applies here as well. Below are some case examples of different naming conventions
- Default/most common: Embassy of Iran, Moscow. The City name is important, because sometimes an embassy moves locations and there are two separate articles.
- Holy See Missions to the Holy See are a little different. Following is an example Apostolic Nunciature to Ireland, can also be a delegation, e.g. Apostolic Delegation to the Antilles
- Common wealth nations often refer to their missions as High Commission, e.g. High Commission of India, Islamabad
- Custom names, for example in Luxembourg castles are common embassy locations, such as Dommeldange Castle. A redirect can be useful for searchability, e.g. Embassy of China, Luxembourg City.
The script
[edit]Locally I have ruby installed (every Mac machine has it by default), which I use to open multiple browser windows at a time, by calling ruby wiki.rb 0..4
the first 5 Template previews and their associated talk pages. The real magic happens inside the templates that are preloaded. You can see the three preloaded templates I created:
- For talk pages User:Shushugah/IRTalk
- For Diplomatic missions in Country X User:Shushugah/Diplomatic_Missions_In_X
- For Diplomatic missions of Country X User:Shushugah/Diplomatic_Missions_Of_X
# named wiki.rb
COUNTRIES = [
'Afghanistan',
'Albania',
'Algeria',
'Angola',
'Antigua and Barbuda',
'Argentina',
'Armenia',
'Australia',
'Austria',
'Azerbaijan',
'the Bahamas',
'Bahrain',
'Bangladesh',
'Barbados',
'Belarus',
'Belgium',
'Belize',
'Benin',
'Bolivia',
'Bosnia and Herzegovina',
'Botswana',
'Brazil',
'Brunei',
'Bulgaria',
'Burkina Faso',
'Burundi',
'Cambodia',
'Cameroon',
'Canada',
'the Central African Republic',
'Chad',
'Chile',
'China',
'Taiwan',
'Colombia',
'the Democratic Republic of the Congo',
'the Republic of the Congo',
'Costa Rica',
'Croatia',
'Cuba',
'Cyprus',
'the Czech Republic',
'Denmark',
'Djibouti',
'the Dominican Republic',
'East Timor',
'Ecuador',
'Egypt',
'El Salvador',
'Equatorial Guinea',
'Eritrea',
'Estonia',
'Ethiopia',
'Finland',
'France',
'Gabon',
'Georgia',
'Germany',
'Ghana',
'Greece',
'Grenada',
'Guatemala',
'Guinea',
'Guinea-Bissau',
'Guyana',
'Holy See',
'Honduras',
'Hong Kong',
'Hungary',
'Iceland',
'India',
'Indonesia',
'Iran',
'Iraq',
'Ireland',
'Israel',
'Italy',
'Ivory Coast',
'Jamaica',
'Japan',
'Jordan',
'Kazakhstan',
'Kenya',
'Kosovo',
'Kuwait',
'Kyrgyzstan',
'Laos',
'Latvia',
'Lebanon',
'Lesotho',
'Liberia',
'Libya',
'Lithuania',
'Luxembourg',
'Madagascar',
'Malawi',
'Malaysia',
'Mali',
'Malta',
'Mauritania',
'Mauritius',
'Mexico',
'Moldova',
'Mongolia',
'Morocco',
'Mozambique',
'Myanmar',
'Namibia',
'Nepal',
'the Netherlands',
'New Zealand',
'Nicaragua',
'Niger',
'Nigeria',
'North Korea',
'North Macedonia',
'Norway',
'Oman',
'Pakistan',
'the State of Palestine',
'Panama',
'Papua New Guinea',
'Paraguay',
'Peru',
'the Philippines',
'Poland',
'Portugal',
'Qatar',
'Romania',
'Russia',
'Rwanda',
'Saudi Arabia',
'Senegal',
'Serbia',
'Seychelles',
'Sierra Leone',
'Singapore',
'Slovakia',
'Slovenia',
'Somalia',
'South Africa',
'South Korea',
'South Sudan',
'Spain',
'Sri Lanka',
'Sudan',
'Suriname',
'Sweden',
'Switzerland',
'Syria',
'Tajikistan',
'Tanzania',
'Thailand',
'Togo',
'Trinidad and Tobago',
'Tunisia',
'Turkey',
'Turkmenistan',
'Uganda',
'Ukraine',
'the United Arab Emirates',
'the United Kingdom',
'the United States',
'Uruguay',
'Uzbekistan',
'Venezuela',
'Vietnam',
'Yemen',
'Zambia',
'Zimbabwe'
]
def template_talk_link(country)
country = country.gsub('_', '%20')
"https://en.wikipedia.org/wiki/Template_talk:Diplomatic_missions_of_#{country}?veaction=editsource&redlink=1&preload=User%3AShushugah%2FIRTalk&preloadparams[]=#{country}"
end
def template_link(country)
country = country.gsub('_', '%20')
"https://en.wikipedia.org/wiki/Template:Diplomatic_missions_of_#{country}?veaction=editsource&redlink=1&preload=User%3AShushugah%2FDiplomatic_Missions_Of_X&preloadparams[]=#{country}"
end
Range.new(*ARGV[0].split('..').map(&:to_i)).each do |index|
country = COUNTRIES[index].split.join('_')
system("open", template_link(country))
system("open", template_talk_link(country))
end
See also
[edit]- MediaWiki preloaded
- WikiProject International Relations