User:Hirmuolio Pine/sandbox5

From EVE University Wiki
Jump to: navigation, search

import re

  1. This python file removes template:icon from a page and replaces it with direct image links.
  2. Code is not formatted for wiki. Edit page and copy it from there.
  3. Paste the article contents to "input.txt" and the processed article will be saved into "output.txt"
trimmed_template = ",rr,remote armor,remote armor rep,remote armor reps,remote armor repair,remote armor repairs,remote armor repairer,remote armor repairers,remote armour,remote armour rep,remote armour reps,remote armour repair,remote armour repairs,=icon_remote_armor_repair_i.png\n\
,remote shield booster,remote shield boosters,st,shield transfer,shield transfers,shield transporter,shield transporters,=icon_shield_transporter_i.png\n\
,remote hull repair,remote hull repairs,=icon_remote_hull_repair_i.png\n\
,remote capacitor transmitter,energy transfer array,capacitor transmitter,energy transfer,rct,eta,ct,et,=icon_remote_capacitor_transmitter_i.png\n\
,remote tracking computer,remote tracking link,tracking link,rtc,rtl,tl,=Icon_remote_tracking_computer_i.png\n\
,remote eccm,eccm projector,remote eccm projector,=Icon eccm projector i.png\n\
,wl,warfare,warfare link,warfare links,=Warfare-links.pn\n\
,charisma,cha,=icon_charisma.png\n\
,intelligence,int,=icon_intelligence.png\n\
,memory,mem,=icon_memory.png\n\
,perception,per,=icon_perception.png\n\
,willpower,will,=icon_willpower.png\n\
,social adaptation clip,charisma implant,cha imp,=Charisma.png\n\
,cybernetic subprocessor,intelligence implant,int imp,=Intelligence.png\n\
,memory augmentation,memory implant,mem imp,=Memory.png\n\
,ocular filter,perception implant,per imp,=Perception.png\n\
,neural boost,willpower implant,will imp,=Willpower.png\n\
,charisma attribute,cha att,=icon_attribute_charisma.png\n\
,intelligence attribute,int att,=icon_attribute_intelligence.png\n\
,memory attribute,mem att,=icon_attribute_memory.png\n\
,perception attribute,per att,=icon_attribute_perception.png\n\
,willpower attribute,will att,=icon_attribute_willpower.png\n\
,br capsule,bracket capsule,=icon_bracket_capsule.png\n\
,br shuttle,bracket shuttle,=icon_bracket_shuttle.png\n\
,br rookie,bracket rookie,=icon_bracket_rookie.png\n\
,br frigate,bracket frigate,=icon_bracket_frigate.png\n\
,br destroyer,bracket destroyer,=icon_bracket_destroyer.png\n\
,br cruiser,bracket cruiser,=icon_bracket_cruiser.png\n\
,br battlecruiser,bracket battlecruiser,=icon_bracket_battlecruiser.png\n\
,br battleship,bracket battleship,=icon_bracket_battleship.png\n\
,br carrier,=icon_bracket_carrier.png\n\
,br dreadnought,br dread,=icon_bracket_dreadnought.png\n\
,br supercarrier,=Icon_bracket_supercarrier.png\n\
,br titan,bracket titan,=icon_bracket_titan.png\n\
,br mining frigate,bracket mining frigate,=icon_bracket_mining_frigate.png\n\
,br mining barge| bracket mining barge,=Icon_bracket_mining_barge.png\n\
,br industrial,bracket industrial,=icon_bracket_industrial.png\n\
,br industrial command,bracket industrial ommand,=icon_bracket_industrial_command_ship.png\n\
,br industrial capital,bracket industrial capital,=icon_bracket_industrial_capital.png\n\
,br sentry,br sentry tower,br sentry gun,=icon_bracket_tower.png\n\
,br drone| bracket drone,=icon_bracket_drone.png\n\
,br sentry drone| bracket sentry drone,=icon_bracket_sentry_drone.png\n\
,br fighter| bracket fighter,=icon_bracket_fighter.png\n\
,white capsule,=icon_white_capsule.png\n\
,white shuttle,=icon_white_shuttle.png\n\
,white rookie,=icon_white_rookie.png\n\
,white frigate,=icon_white_frigate.png\n\
,white destroyer,=icon_white_destroyer.png\n\
,white cruiser,=icon_white_cruiser.png\n\
,white battlecruiser,=icon_white_battlecruiser.png\n\
,white battleship,=icon_white_battleship.png\n\
,white carrier,=icon_white_carrier.png\n\
,white dreadnought,br dread,=icon_white_dreadnought.png\n\
,white supercarrier,=icon_white_supercarrier.png\n\
,white titan,=icon_white_titan.png\n\
,white mining frigate,=icon_white_mining_frigate.png\n\
,white mining barge| bracket mining barge,=icon_white_mining_barge.png\n\
,white industrial,=icon_white_industrial.png\n\
,white industrial command,=icon_white_industrial_command_ship.png\n\
,white industrial capital,=icon_white_industrial_capital.png\n\
,white sentry,=icon_bracket_tower.png\n\
,white drone,=icon_bracket_drone.png\n\
,white sentry drone,=icon_bracket_sentry_drone.png\n\
,white fighter,=icon_bracket_fighter.png\n\
,red capsule,=icon_red_capsule.png\n\
,red shuttle,=icon_red_shuttle.png\n\
,red rookie,=icon_red_rookie.png\n\
,red frigate,=icon_red_frigate.png\n\
,red destroyer,=icon_red_destroyer.png\n\
,red cruiser,=icon_red_cruiser.png\n\
,red battlecruiser,=icon_red_battlecruiser.png\n\
,red battleship,=icon_red_battleship.png\n\
,red carrier,=icon_red_carrier.png\n\
,red dreadnought,br dread,=icon_red_dreadnought.png\n\
,red supercarrier,=icon_red_supercarrier.png\n\
,red titan,=icon_red_titan.png\n\
,red mining frigate,=icon_red_mining_frigate.png\n\
,red mining barge| bracket mining barge,=icon_red_mining_barge.png\n\
,red industrial,=icon_red_industrial.png\n\
,red industrial command,=icon_red_industrial_command_ship.png\n\
,red industrial capital,=icon_red_industrial_capital.png\n\
,red sentry,=icon_red_tower.png\n\
,red drone,=icon_red_drone.png\n\
,red sentry drone,=icon_red_sentry_drone.png\n\
,red fighter,=icon_red_fighter.png\n\
,blue capsule,=icon_blue_capsule.png\n\
,blue shuttle,=icon_blue_shuttle.png\n\
,blue rookie,=icon_blue_rookie.png\n\
,blue frigate,=icon_blue_frigate.png\n\
,blue destroyer,=icon_blue_destroyer.png\n\
,blue cruiser,=icon_blue_cruiser.png\n\
,blue battlecruiser,=icon_blue_battlecruiser.png\n\
,blue battleship,=icon_blue_battleship.png\n\
,blue carrier,=icon_blue_carrier.png\n\
,blue dreadnought,br dread,=icon_blue_dreadnought.png\n\
,blue supercarrier,=icon_blue_supercarrier.png\n\
,blue titan,=icon_blue_titan.png\n\
,blue mining frigate,=icon_blue_mining_frigate.png\n\
,blue mining barge| bracket mining barge,=icon_blue_mining_barge.png\n\
,blue industrial,=icon_blue_industrial.png\n\
,blue industrial command,=icon_blue_industrial_command_ship.png\n\
,blue industrial capital,=icon_blue_industrial_capital.png\n\
,blue sentry,=icon_blue_tower.png\n\
,blue drone,=icon_blue_drone.png\n\
,blue sentry drone,=icon_blue_sentry_drone.png\n\
,blue fighter,=icon_blue_fighter.png\n\
,br constellation,bracket constellation,=icon_bracket_constellation.png\n\
,br npc,bracket npc,=icon_bracket_npc_indicator.png\n\
,br region,bracket region,=icon_bracket_region.png\n\
,br solar system,bracket solar system,=icon_bracket_solar_system.png\n\
,br acceleration gate,bracket acceleration gate,=icon bracket accelerationgate.png\n\
,br asteroid,bracket asteroid,=Icon_bracket_asteroid.png\n\
,br asteroid field,bracket asteroid field,=Icon_bracket_asteroidfield.png\n\
,br beacon,bracket beacon,=Icon_bracket_beacon.png\n\
,br billboard,bracket billboard,=Icon_bracket_billboard.png\n\
,br container,bracket container,=Icon_bracket_container.png\n\
,br red container,bracket red container,=Icon_bracket_container_red.png\n\
,br moon,bracket moon,=Icon_bracket_moon.png\n\
,br stargate,bracket stargate,=Icon_bracket_stargate.png\n\
,br station,bracket station,=Icon_bracket_station.png\n\
,br structure,bracket structure,=Icon_bracket_structure.png\n\
,br tower,bracket tower,=Icon_bracket_tower.png\n\
,br force field,bracket force field,=Icon_bracket_forcefield.png\n\
,br wormhole,bracket wormhole,=Icon_bracket_wormhole.png\n\
,br gas cloud,bracket gas cloud,=Gas_cloud.png\n\
,br hackable,bracket hackable,=Icon_bracket_hackable.png\n\
,br agent| bracket agent,=Icon_bracket_agent.png\n\
,container large secure,large secure container,=icon_container_large_secure.png\n\
,container large,large container,=icon_container_large.png\n\
,container large green,large green container,=icon_container_large_green.png\n\
,container large cyan,large cyan container,=icon_container_large_cyan.png\n\
,container medium secure,medium secure container,=icon_container_medium_secure.png\n\
,container medium,medium container,=icon_container_medium.png\n\
,container medium green,medium green container,=icon_container_medium_green.png\n\
,container medium cyan,medium cyan container,=icon_container_medium_cyan.png\n\
,container small secure,small secure container,=icon_container_small_secure.png\n\
,cargo,container small,small container,=icon_container_small.png\n\
,shiny cargo,container small green,small green container,=icon_container_small_green.png\n\
,container small cyan,small cyan container,=icon_container_small_cyan.png\n\
,\n\
,w,web,webifier,stasis web,stasis webifier,=icon_stasis_webifier_i.png\n\
,s,sc,scram,scramble,scrambler,ws,warp scram,warp scrambler,=icon_warp_scrambler_i.png\n\
,d,disruptor,wd,warp disruptor,point,=icon_warp_disruptor_i.png\n\
,burst,ecm burst,recm,remote ecm,remote ecm burst,=icon_remote_ecm_burst_i.png\n\
,j,jam,jamming,ecm,=Icon_target_max.png\n\
,p,painter,painters,tp,target painter,target painters,=icon_target_painter_i.png\n\
,v,vamp,vampire,energy vampire,=Vamp.png\n\
,n,neut,neuts,neutralizer,en,energy neutralizer,=icon_energy_neutralizer_i.png\n\
,damp,rsd,sensor damp,sensor dampening,=icon_remote_sensor_dampening.png\n\
,td,track disruptor,=icon_track_disruptor_64.png\n\
,gd,guidance disruptor,=icon_missile_guidance_computer_i.png\n\
,amarr empire,amarr,=Logo_faction_amarr_empire.png\n\
,amarr2,amarr clean,=logo_faction_amarr_empire_clean.png\n\
,amarr3,amarr chinese,=logo_faction_amarr_empire_chinese.png\n\
,amarr4,amarr shiny,=logo_faction_amarr_empire_shiny.png\n\
,caldari state,caldari,=Logo_faction_caldari_state.png\n\
,caldari2,caldari clean,=Logo_faction_caldari_state_clean.png\n\
,caldari3,caldari chinese,=Logo_faction_caldari_state_chinese.png\n\
,caldari4,caldari shiny,=logo_faction_caldari_state_shiny.png\n\
,gallente federation,gallente,=Logo_faction_gallente_federation.png\n\
,gallente2,gallente clean,=Logo_faction_gallente_federation_clean.png\n\
,gallente3,gallente chinese,=Logo_faction_gallente_federation_chinese.png\n\
,gallente4,gallente shiny,=logo_faction_gallente_federation_shiny.png\n\
,minmatar republic,minmatar,=Logo_faction_minmatar_republic.png\n\
,minmatar2,minmatar clean,=Logo_faction_minmatar_republic_clean.png\n\
,minmatar3,minmatar chinese,=Logo_faction_minmatar_republic_chinese.png\n\
,minmatar4,minmatar shiny,=logo_faction_minmatar_republic_shiny.png\n\
,jove empire,jove,=Logo_faction_jove_empire.png\n\
,ammatar mandate,ammatar,=logo_faction_ammatar_mandate.png\n\
,khanid kingdom,khanid,=logo_faction_khanid_kingdom.png\n\
,thukker tribe,thukker,=logo_faction_thukker_tribe.png\n\
,sansha's nation,sansha,=logo_faction_sanshas_nation.png\n\
,concord assembly,concord,=logo_faction_concord_assembly.png\n\
,the interbus,interbus,=logo_faction_the_interbus.png\n\
,the servant sisters of eve,servant sisters of eve,servant sisters,sisters of eve,sisters,=logo_faction_sisters_of_eve.png\n\
,the society of conscious thought,society of conscious thought,society,=logo_faction_the_society.png\n\
,the syndicate,syndicate,=logo_faction_the_syndicate.png\n\
,outer ring excavations,ore,=logo_faction_outer_ring_excavations.png\n\
,mordu's legion,mordu,=logo_faction_mordus_legion.png\n\
,angel cartel,angels,=logo_faction_angel_cartel.png\n\
,guristas pirates,guristas,=logo_faction_guristas_pirates.png\n\
,serpentis corporation,serpentis,=logo_faction_serpentis.png\n\
,blood raider covenant,blood raiders,covenant,=logo_faction_the_blood_raider_covenant.png\n\
,drifter,drifters,=logo faction drifters.png\n\
,trig,triglavian,triglavians,triglavian collective,=Logo_faction_triglavian_collective.png\n\
,cpu,=icon_cpu.png\n\
,pg,powergrid,power grid,=icon_powergrid.png\n\
,range,=Icon_target_range.png\n\
,falloff,=Icon_falloff_mod.png\n\
,sig,=Icon_ship_sig.png\n\
,vel,velocity,=Icon_velocity.png\n\
,shield,=Icon_shield.png\n\
,armor,=Icon_armor.png\n\
,hull,=icon_hull.png\n\
,capacity,=Icon_capacity.png\n\
,sensor resolution,sensor res,remote sensor booster,remote sebo,rsb,=Icon_sensor_resolution.png\n\
,target,=Icon_target_max.png\n\
,inertia,=Icon_inertia.png\n\
,align,align time,=icon_align_time.png\n\
,time,warp time,=icon warp time.png\n\
,warp speed,=icon_warp_speed.png\n\
,volume,vol,=Icon_volume.png\n\
,tracking,track,=Icon_tracking.png\n\
,turret,tur,=icon_turret.png\n\
,turret new,new turret,=icon_gunnery_turret.png\n\
,missile,mis,=icon_torpedoes.png\n\
,missile new,new missile,=icon_missiles.png\n\
,alpha,turret alpha,=icon_turret_volley.png\n\
,burst,volley,missile burst,missile volley,missile burst,=icon_burst.png\n\
,drones,=icon_drones.png\n\
,armour repairer,armor repairer,armour repair,armor repair,=icon_armor_repairer_i.png‎ \n\
,shield booster,=icon_shield_glow.png\n\
,hull repairer,structure repairer,hull repair,structure repair,=icon_hull_repairer_i.png\n\
,high slot,hislot,hi slot,slot high,slot hi,fit high,fit hi,=icon_fit_high.png\n\
,medium slot,midslot,mid slot,med slot,slot medium,slot mid,fit medium,fit mid,=icon_fit_medium.png\n\
,low slot,lowslot,loslot,lo slot,slot low,slot lo,fit low,fit lo,=icon_fit_low.png\n\
,rig slot,rigslot,slot rig,fit rig,=icon_fit_rig.png\n\
,drone slot,droneslot,slot drone,fit drone,=icon_fit_drone.png\n\
,resource slot,resslot,res slot,slot resource,slot res,fit resource,fit res,=icon_fit_resource.png\n\
,fitting browser,fit browser,=icon_fit_browser.png\n\
,fitting skins,skins,skin,fit skin,fit skins,=icon_fit_skins.png\n\
,fitting cargo hold,fitting cargo,fit cargo,fit hold,hold,cargo,cargo hold,=icon_fit_cargo.png\n\
,fitting dps,fit dps,=icon_fit_dps.png\n\
,fitting alpha,fit alpha,=icon_fit_alpha.png\n\
,fitting skills,fit skills,fitting skill,fit skill,=icon_fit_skills.png\n\
,isis amarr,isis amarr empire,=isis_amarr.png\n\
,isis angel,isis angel cartel,=isis_angel.png\n\
,isis blood,isis blood raiders,=isis_blood_raiders.png\n\
,isis caldari,isis caldari state,=isis_caldari.png\n\
,isis gallente,isis gallente federation,=isis_gallente.png\n\
,isis guristas,isis guristas pirates,=isis_guristas.png\n\
,isis minmatar,isis minmatar republic,=isis_minmatar.png\n\
,isis mordu,isis mordus,isis mordu's legion,=isis_mordus.png\n\
,isis ore,isis o.r.e.,isis outer ring excavations,=isis_ore.png\n\
,isis sansha,isis sanshas,isis sansha's nation,=isis_sansha.png\n\
,isis serpentis,isis serpentis corporation,=isis_serpentis.png\n\
,isis soe,isis sisters,isis sisters of eve,=isis_soe.png\n\
,isis triglavian,isis triglavian collective,=isis_triglavian.png\n\
,isis,=ISIS.png\n\
,isis armor,isis armour,=Icon ISIS defense armor.png\n\
,isis attack,=Icon ISIS attack.png\n\
,isis combat,=Icon ISIS Combat.png\n\
,isis disruption,=Icon ISIS Disruption.png\n\
,isis ecm,=Icon ISIS Ecm.png\n\
,isis energy destabilization,isis neut,isis vamp,isis ed,=Icon ISIS Energydestabilization.png\n\
,isis exploration,=Icon ISIS Exploration.png\n\
,isis hauling,=Icon ISIS Hauling.png\n\
,isis harvesting,isis resource harvesting,=Icon ISIS Resourceharvesting.png\n\
,isis dampening,isis sensor dampening,isis sd,=Icon ISIS Sensordampening.png\n\
,isis shield,=Icon ISIS defense Shields.png\n\
,isis dual tanked,isis shield and armor,isis shield and armour,=Icon ISIS defense Shieldsarmor.png\n\
,isis web,isis webifying,isis stasis webifying,=Icon ISIS Stasiswebifying.png\n\
,isis support,=Icon ISIS Support.png\n\
,isis tackling,=Icon ISIS Tackling.png\n\
,isis tp| painting,isis target painting,=Icon ISIS Targetpainting.png\n\
,isis tracking disruption,isis td,=Icon ISIS Trackingdisruption.png\n\
,isis warp,warp prevention,isis point,isis scram,isis bubble,=Icon ISIS Warpprevention.png\n\
,isis hybrids,isis hybrid turrets,=Icon ISIS weapon Hybridturrets.png\n\
,isis lasers,isis energy turrets,=Icon ISIS weapon Energyturrets.png\n\
,isis missiles,isis missile launchers,=Icon ISIS weapon Missiles.png\n\
,isis projectiles,isis projectile turrets,=Icon ISIS weapon Projectileturrets.png\n\
,isis drones,=Icon ISIS weapon Drones.png\n\
,isis xl,isis extra large,=Icon ISIS size Xlarge.png\n\
,isis l,isis large,=Icon ISIS size Large.png\n\
,isis m,isis medium,=Icon ISIS size Medium.png\n\
,isis s,isis small,=Icon ISIS size Small.png\n\
,isis bc,isis battlecruiser,=isis_battlecruiser.png\n\
,isis bs,isis battleship,=isis_battleship.png\n\
,isis cap,isis capital,=isis_capital.png\n\
,isis pod,isis capsule,=isis_capsule.png\n\
,isis c,isis cr,isis cruiser,=isis_cruiser.png\n\
,isis d,isis destroyer,=isis_destroyer.png\n\
,isis fr,isis freighter,=isis_freighter.png\n\
,isis f,isis frigate,=isis_frigate.png\n\
,isis indy,isis industrial,=isis_industrial.png\n\
,isis industrial command,isis industrial command ship,=isis_industrialcommand.png\n\
,isis barge,isis mining barge,=isis_miningbarge.png\n\
,isis mining frigate,=isis_miningfrigate.png\n\
,isis rookie,isis rookie ship,=isis_rookie.png\n\
,isis shuttle,=isis_shuttle.png\n\
,isis super,isis super capital,=isis_supercapital.png\n\
,isis carrier,super carrier,=isis_supercarrier.png\n\
,isis titan,=isis_titan.png\n\
,wallet,=icon_wallet.png\n\
,bounty office,=icon_bounties.png\n\
,x,red x,large red x,=icon_large_red_x.png\n\
,check,green check,large green check,=icon_large_green_check.png\n\
,tick,=Tick.png\n\
,cross,=Cross.png\n\
,small info,=Small_Info.png\n\
,constellation,=icon_constellation.png\n\
,corporation,alliance,=icon_corporation.png\n\
,orbit,=icon_orbit.png\n\
,chat,=icon talking.png\n\
,mail glow,mail glowing,glowing mail,=icon_mail_glow.png\n\
,ccp,=icon_ccp.png\n\
,windows,win,=icon_os_windows.png\n\
,macintosh,mac,=icon_os_macintosh.png\n\
,linux,=icon_os_linux.png\n\
,mumble,=icon_mumble.png\n\
,slack,=icon_slack.png\n\
,isk,ISK,interstellar kredits,inter stellar kredits,money,coins,=icon_money.png\n\
,bounty,bounties,=icon_bounty.png\n\
,dice,d6,=icon_dice.png\n\
,pin,=icon_pin.png\n\
,concentrated veldspar,dense veldspar,veldspar,=ore_veldspar.png\n\
,condensed scordite,massive scordite,scordite,=ore_scordite.png\n\
,solid pyroxeres,viscous pyroxeres,pyroxeres,=ore_pyroxeres.png\n\
,azure plagioclase,rich plagioclase,plagioclase,=ore_plagioclase.png\n\
,silvery omber,golden omber,omber,=ore_omber.png\n\
,luminous kernite,fiery kernite,kernite,=ore_kernite.png\n\
,pure jaspet,pristine jaspet,jaspet,=ore_jaspet.png\n\
,vivid hemorphite,radiant hemorphite,hemorphite,=ore_hemorphite.png\n\
,vitric hedbergite,glazed hedbergite,hedbergite,=ore_hedbergite.png\n\
,iridescent gneiss,prismatic gneiss,gneiss,=ore_gneiss.png\n\
,onyx ochre,obsidian ochre,dark ochre,=ore_dark ochre.png\n\
,bright spodumain,gleaming spodumain,spodumain,=ore_spodumain.png\n\
,sharp crokite,crystalline crokite,crokite,=ore_crokite.png\n\
,triclinic bistot,monoclinic bistot,bistot,=ore_bistot.png\n\
,crimson arkonor,prime arkonor,arkonor,=ore_arkonor.png\n\
,magma mercoxit,vitreous mercoxit,mercoxit,=ore_mercoxit.png\n\
,tritanium,=mineral_tritanium.png\n\
,pyerite,=mineral_pyerite.png\n\
,mexallon,=mineral_mexallon.png\n\
,isogen,=mineral_isogen.png\n\
,nocxium,=mineral_nocxium.png\n\
,megacyte,=mineral_megacyte.png\n\
,zydrine,=mineral_zydrine.png\n\
,morphite,=mineral_morphite.png\n\
,water,heavy water,=mineral_heavy_water.png\n\
,helium,helium isotopes,=mineral_helium_isotopes.png\n\
,hydrogen,hydrogen isotopes,=mineral_hydrogen_isotopes.png\n\
,ozone,liquid ozone,=mineral_liquid_ozone.png\n\
,nitrogen,nitrogen isotopes,=mineral_nitrogen_isotopes.png\n\
,oxygen,oxygen isotopes,=mineral_oxygen_isotopes.png\n\
,strontium,strontium clathrates,=mineral_strontium_clathrates.png\n\
,blue ice,thick blue ice,=ice_blue_ice.png\n\
,clear icicle,enriched clear icicle,=ice_clear_icicle.png\n\
,glacial mass,smooth glacial mass,=ice_glacial_mass.png\n\
,white glaze,pristine white glaze,=ice_white_glaze.png\n\
,dark glitter,=ice_dark_glitter.png\n\
,gelidus,=ice_gelidus.png\n\
,glare crust,=ice_glare_crust.png\n\
,krystallos,=ice_krystallos.png\n\
,tag check,=Overview-BoxChecked9.gif\n\
,tag uncheck,=ColorTagBG-Grey.gif\n\
,tag war,=ColorTag-StarRed9.gif\n\
,tag war militia,=ColorTag-StarOrange9.gif\n\
,tag fleetmember,tag fleet member,tag fleet,=ColorTag-FleetMember9.gif\n\
,tag corporation member,tag corporation,tag corp,=ColorTag-StarGreen9.gif\n\
,tag alliance,tag ally,=ColorTag-StarBlue9.gif \n\
,tag excellent standing,tag excellent,tag 10,=ColorTag-PlusDarkBlue9.gif\n\
,tag good standing,tag good,tag 5,=ColorTag-PlusLightBlue9.gif\n\
,tag outlaw,=ColorTag-SkullOrange9.gif\n\
,tag criminal,=ColorTag-SkullRedBlack9.gif\n\
,tag suspect,=ColorTag-SkullYellowBlack9.gif\n\
,tag limited engagement,tag limited,tag le,=ColorTag-SkullTurquoise9.gif\n\
,tag kill right,tag kill,=ColorTag-CrosshairOrange9.gif\n\
,tag terrible,tag -10,=ColorTag-MinusRed9.gif\n\
,tag bad,tag -5,=ColorTag-MinusOrange9.gif\n\
,tag militia,tag militia ally,=ColorTag-StarPurple9.gif\n\
,tag war ally,=ColorTag-StarBlue9.gif \n\
,tag security below zero,tag below zero,tag pirate,=ColorTag-SkullYellow9.gif\n\
,tag neutral standing,tag neutral,=ColorTag-Neutral.gif\n\
,tag interactable,tag agent,=ColorTag-ChatBlue9.gif\n\
,tag bounty,=ColorTag-SkullBlack9.gif\n\
,tag no standing,tag no,=ColorTag-Neutral.gif\n\
,bg red,=ColorTagBG-Red.gif\n\
,bg orange,=ColorTagBG-Orange.gif\n\
,bg purple\n\
,bg purple dark,=ColorTagBG-PurpleDark.gif\n\
,bg purple light,=ColorTagBG-PurpleLight.gif\n\
,bg green\n\
,bg green dark,=ColorTagBG-GreenDark.gif\n\
,bg blue\n\
,bg blue dark,=ColorTagBG-BlueDark.gif\n\
,bg blue light,=ColorTagBG-BlueLight.gif\n\
,bg yellow,=ColorTagBG-Yellow.gif\n\
,bg black,=ColorTagBG-Black.gif\n\
,bg grey,=ColorTagBG-Grey.gif\n\
,bg white,=ColorTagBG-White.gif\n\
,bg turquoise\n\
,bg turquoise dark,=ColorTagBG-DarkTurquoise.gif\n\
,bg turquoise light,=ColorTagBG-Turquoise.gif\n\
,micro,micro target,drone,=icon_target_drone.png\n\
,small,small target,frigate,=icon_target_frigate.png\n\
,destroyer,destroyer target,destroyer,=icon_target_destroyer.png\n\
,medium,medium target,cruiser,=icon_target_cruiser.png\n\
,battlecruiser,battlecruiser target,battlecruiser,=icon_target_battlecruiser.png\n\
,large,large target,battleship,=icon_target_battleship.png\n\
,sentry,tower,sentry tower,=icon_target_tower.png\n\
,industrial,industrial target,=icon_target_industrial.png\n\
,industrial2,industrial target2,=icon_target_industrial2.png\n\
,freighter| freighter target,=icon_target_freighter.png\n\
,carrier,carrier target,=Icon_target_carrier.png\n\
,supercapital,supercapital target,=Icon_target_supercapital.png\n\
,fighter target,=Icon_target_fighter.png\n\
,small neutral,small neutral npc,small neutral ship,=icon_small_neutral_ship.png\n\
,medium neutral,medium neutral npc,medium neutral ship,=icon_medium_neutral_ship.png\n\
,large neutral,large neutral npc,large neutral ship,=icon_large_neutral_ship.png\n\
,small ship,small player,small player ship,=icon_small_ship.png\n\
,medium ship,medium player,medium player ship,=icon_medium_ship.png\n\
,large ship,large player,large player ship,=icon_large_ship.png\n\
,capital ship,capital player,capital player ship,=icon_capital_ship.png\n\
,industrial ship,industrial player ship,large industrial ship,large industrial player ship,=icon_large_industrial_ship.png\n\
,fb,fighter,fighters,bomber,bombers,fighter bombers,=icon_drone_bandwith.png\n\
,em resist,em resists,electromagnetic resists,=icon_resist_em.png\n\
,th resist,th resists,thermal resist,thermal resists,thermic resist,thermic resists,=icon_resist_therm.png\n\
,ex resist,ex resists,explosive resist,explosive resists,=icon_resist_exp.png\n\
,ki resist,ki resists,kinetic resist,kinetic resists,=icon_resist_kin.png\n\
,em damage,electromagnetic damage,=icon_damage_em.png\n\
,th damage,thermal damage,thermic damage,=icon_damage_therm.png\n\
,ex damage,explosive damage,=icon_damage_exp.png\n\
,ki damage,kinetic damage,=icon_damage_kin.png\n\
,timer booster,=icon_timer_booster.png\n\
,timer pvp,timer capsuleer,=icon_timer_capsuleer.png\n\
,timer criminal,timer gcc,=icon_timer_criminal.png\n\
,timer jump activation,=icon_timer_jump_activation.png\n\
,timer jump fatigue,=icon_timer_jump_fatigue.png\n\
,timer le,timer limited,timer limited engagement,=icon_timer_limited_engagement.png\n\
,timer npc,timer non-capsuleer,=icon_timer_non-capsuleer.png\n\
,timer suspect,=icon_timer_suspect.png\n\
,timer weapon,timer weapons,=icon_timer_weapons.png\n\
,fw,faction warfare,factional warfare,=icon_fw.png\n\
,beam xl,beam laser xl,xl beam,xl beam laser,=icon_turret_beam_xl.png\n\
,beam large,beam laser large,large beam,large beam laser,=icon_turret_beam_large.png\n\
,beam medium,beam laser medium,medium beam,medium beam laser,=icon_turret_beam_medium.png\n\
,beam small,beam laser small,small beam,small beam laser,=icon_turret_beam_small.png\n\
,pulse xl,pulse laser xl,xl pulse,xl pulse laser,=icon_turret_pulse_xl.png\n\
,pulse large,pulse laser large,large pulse,large pulse laser,=icon_turret_pulse_large.png\n\
,pulse medium,pulse laser medium,medium pulse,medium pulse laser,=icon_turret_pulse_medium.png\n\
,pulse small,pulse laser small,small pulse,small pulse laser,=icon_turret_pulse_small.png\n\
,railgun xl,xl railgun,=icon_turret_railgun_xl.png\n\
,railgun large,large railgun,=icon_turret_railgun_large.png\n\
,railgun medium,medium railgun,=icon_turret_railgun_medium.png\n\
,railgun small,small railgun,=icon_turret_railgun_small.png\n\
,blaster xl,xl blaster,=icon_turret_blaster_xl.png\n\
,blaster large,large blaster,=icon_turret_blaster_large.png\n\
,blaster medium,medium blaster,=icon_turret_blaster_medium.png\n\
,blaster small,small blaster,=icon_turret_blaster_small.png\n\
,artillery xl,xl artillery,=icon_turret_artillery_xl.png\n\
,artillery large,large artillery,=icon_turret_artillery_large.png\n\
,artillery medium,medium artillery,=icon_turret_artillery_medium.png\n\
,artillery small,small artillery,=icon_turret_artillery_small.png\n\
,autocannon xl,xl autocannon,=icon_turret_autocannon_xl.png\n\
,autocannon large,large autocannon,=icon_turret_autocannon_large.png\n\
,autocannon medium,medium autocannon,=icon_turret_autocannon_medium.png\n\
,autocannon small,small autocannon,=icon_turret_autocannon_small.png\n\
,citadel torpedo,citadel torpedo missile,missile citadel torpedo,=icon_missiles_citadel_torpedo.png\n\
,citadel cruise,citadel cruise missile,missile citadel cruise,=icon_missiles_citadel_cruise.png\n\
,torpedo,torpedo missile,missile torpedo,=Icon torpedoes.png\n\
,cruise missile,missile cruise,=icon_missiles_cruise.png\n\
,heavy assault,heavy assault missile,missile heavy assault,=icon_missiles_heavy_assault.png\n\
,heavy missile,missile heavy,=icon_missiles_heavy.png\n\
,rapid heavy,rapid heavy missile,missile heavy rapid,=icon_missiles_heavy_rapid.png\n\
,light missile,missiles light,=icon_missiles_light.png\n\
,rapid light,rapid light missile,missile light rapid\n\
,rocket,missile rocket,=icon_missiles_rocket.png\n"

def find_file( icon_name ):
	print( "Searching: " + icon_name )
	#with open("template-icon-trimmed.txt", "r") as file :
	#	data_text = file.read()
	
	pattern = "," + icon_name + ",.*=(.*)"
	file_list = re.findall(pattern, trimmed_template)
	
	if len(file_list)==0:
		return icon_name
	
	return file_list[0]
	

def substitute( matchobject ):
	arguments = re.split("\|", matchobject.group(0))
	
	# arguments[0] = "{{icon"
	# arguments[1] = icon name
	# arguments[2] = icon size
	# arguments[3] = hoover hint
	
	# Output: [[image:FILENAME|SIZEpx|link=|HINT]]
	replacement = "[[image:"
	
	filename = arguments[1].replace("}", "")
	filename = find_file( filename.strip() ) #"icon_bracket_capsule.png"
	
	replacement += filename
	
	if len(arguments) > 2:
		replacement += "|" + str(arguments[2].replace("}", "").strip()) + "px"
	else:
		replacement += "|32px"
	
	replacement += "|link="
	
	if len(arguments) > 3:
		replacement += "|" + str(arguments[3].replace("}", "").strip())
	
	replacement += "]]"
	
	return replacement

def do_the_thing():
	# Start by reading the input.
	with open('input.txt', 'r', encoding='utf-8') as file :
		full_text = file.read()
	
	full_text = re.sub("{{icon\|.*?}}", substitute, full_text)
	
	# Everything done. Save the output.
	with open('output.txt', 'w', encoding='utf-8') as file:
		file.write(full_text)


do_the_thing()