Hi, I am new to mediawiki. But I have to upgrade an old mediawiki that contains lots of page with source tags. Since it's deprecated by syntaxhighlight tag, how do I replace all source tags in all pages with syntaxhighlight tag in a batch way?
Topic on Extension talk:SyntaxHighlight
The way I'd do it is via AutoWikiBrowser (AWB) or a similar (semi)automated editing tool (if you're handy with a programming language and don't mind spending time on it, you could also write such a tool yourself). If you can install extensions yourself, or can request to have them installed, another option is Extension:ReplaceText , though personally I don't recommend this versus running AWB or similar.
Another possibility for linux is the pywikibot replace script (see Manual:Pywikibot/replace.py) with the following user-fix.py entry:
fixes['source_tag'] = {
'regex': False,
'msg': {
'_default': 'source-tag ersetzt durch syntaxhighlight',
},
'replacements': [
(r'<source', '<syntaxhighlight'),
(r'</source', '</syntaxhighlight'),
]
}
called like this:
python3 pwb.py replace -fix:source_tag -start:!
that worked for me
cat wiki.sql | sed 's/<source/<syntaxhighlight/g' | sed 's/<\/source/<\/syntaxhighlight/g' > wiki.new.sql
make sure to backup and check thoroughly after importing back