Task

Fix Rosetta Code deprecated code tags, with these rules:

Change <%s> to <lang %s>
Change </%s> to </lang>
Change <code %s> to <lang %s>
Change </code> to </lang>



Usage

./convert.py < wikisource.txt > converted.txt



#Used <#/lang> to desensitize wiki
txt := FileTools[Text][ReadFile]("C:/Users/username/Desktop/text.txt"):
#langs should be a real list of programming languages 
langs := ['foo', 'bar', 'baz', 'barf'];
for lan in langs do
	txt := StringTools:-SubstituteAll(txt, cat("<", lan, ">"), cat ("<lang ", lan, ">")):
	txt := StringTools:-SubstituteAll(txt, cat("</", lan, ">"), "<#/lang>"):
	txt := StringTools:-SubstituteAll(txt, cat("<code ", lan, ">"), cat ("<lang ", lan, ">")):
	txt := StringTools:-SubstituteAll(txt, "</code>", "<#/lang>"):
end do;
print(txt);