Open wikipedia-mabdul opened 11 years ago
I would think {{tlx|Non-free logo|image has rationale{{=}}yes}}
would not only look better but be easier to do than trying to wrap things in <nowiki>...</nowiki>
tags.
.replace(/\{\{(.*?)\}\}/g, '{{tlx|$1}}').replace('=', '{{=}}');
you missed to replace the additional pipes so another
.replace(/\{\{(.*?)\}\}/g, '{{tlx|$1}}').replace(/=/g, '{{=}}').replace(/\|/g, '{{!}}');
and then
.replace(/\{\{\!\}\}/, '\|');
(first global, then one time rereplace)
but actually it IS easier...
.replace(/\{\{(.*?)\}\}/g, '{{tlx|\<nowiki\<$1\<\/nowiki\>}}');
not really that hard, if you check the above code...
and... btw: this is a bad regex.
moreover we would detect ALL templates (also afc comments, archive bottom etc...)
I'm working on that
There are regular users (requester) providing full information and templates for proposed uploads like:
The cleanup should transform that stuff to
see edit by [[User:Armbrust]]
https://en.wikipedia.org/w/index.php?title=Wikipedia:Files_for_upload&curid=9176046&diff=576246132&oldid=576225994