Protoball:Expand Acronyms.py

From Protoball
Jump to navigation Jump to search
def expand_acronyms(site, regions):
	acronyms = {}
	acronyms["AAA"] = "Albany Atlas and Argus"
	acronyms["BDC"] = "Buffalo Daily Courier"
	acronyms["BDE"] = "Brooklyn Daily Eagle"
	acronyms["BE&KCD"] = "Brooklyn Eagle, and Kings County Democrat"
	acronyms["BH"] = "Boston Herald"
	acronyms["BS"] = "Baltimore Sun"
	acronyms["CDPT"] = "Chicago Daily Press and Tribune"
	acronyms["DMN"] = "Daily Milwaukee News"
	acronyms["LG"] = "Lansingburgh Gazette"
	acronyms["MS"] = "Milwaukee Sentinel"
	acronyms["NDA"] = "Newark Daily Advertiser"
	acronyms["NYC"] = "New York Clipper"
	acronyms["NYDT"] = "New York Daily Times"
	acronyms["NYH"] = "New York Herald"
	acronyms["NYMN"] = "New York Morning News"
	acronyms["NYSM"] = "New York Sunday Mercury"
	acronyms["NYT"] = "New York Times"
	acronyms["PI"] = "Philadelphia Inquirer"
	acronyms["PSOT"] = u"Porter\u2019s Spirit of the Times"
	acronyms["PT"] = "Chicago Press and Tribune"
	acronyms["RU&A"] = "Rochester Union and Advertiser"
	acronyms["SG"] = "Trenton State Gazette"
	acronyms["SOT"] = "The Spirit of the Times"
	acronyms["TS"] = "The True Sun"
	acronyms["TDW"] = "Troy Daily Whig"
	acronyms["WSOT"] = u"Wilkes\u2019 Spirit of the Times"

	for region in regions:
		page = site.Pages['Games_Tab:' + region]
		text = page.edit()
		for acronym, name in acronyms.iteritems():
			text = text.replace("<i>" + acronym, "<i>" + name)
		page.save(text, "Expand acronyms")