Rosetta Code/Fix code tags: Difference between revisions

+ AutoHotkey
No edit summary
(+ AutoHotkey)
Line 11:
 
<pre>cat wikisource.txt | ./convert.py > converted.txt</pre>
=={{header|AutoHotkey}}==
<lang AutoHotkey>
;usage: fixtags.ahk input.txt output.txt
FileRead, text, %1%
langs = ada,awk,autohotkey,etc
slang = </lang>
loop, parse, langs, `,
{
tag1 = <%A_LoopField%>
tag2 = </%A_LoopField%>
text := Regexreplace(text, tag1,"<lang " . A_LoopField . ">")
text := Regexreplace(text, tag2, slang)
text := RegexReplace(text, "<code (.+?)>(.*?)</code>", "<lang $1>$2</lang>")
}
FileAppend, % text, %2%
</lang>
 
=={{header|Perl}}==
Anonymous user