Combine multiple {{Expert-subject}} tags (e.g. https://en.wikipedia.org/w/index.php?title=Tom_Dowd_and_the_Language_of_Music&type=revision&diff=675796939&oldid=631768122 )
Description
Event Timeline
If there are two date fields with 2 different values: Just pick any date field. I am OK with that.
I searched 65% of the July 2015 database dump for regex "Expert-subject.*Expert-subject". 50 matches i.e. much less to fix.
@GoingBatty would you like to have a go?
@Magioladitis - Will do. Some of the articles found have {{expert-subject}} in different sections, so they aren't appropriate to be combined.
@Magioladitis - I found 50 articles in the Sep 2015 dump and fixed about 25 of them using the following Regex:
- FIND: {{expert-subject\s*\|(.*?)\|date\s*=\s*\w+ \d{4}}}\n?{{expert-subject\s*\|(?:1\=)?(.*?\|date\s*=\s*\w+ \d{4})}}
- REPLACE: {{expert-subject|$1|ex2=$2}}
I then had to tweak (or revert) the results when templates had "section" and/or "reason", or when there were three templates. For others, when one template was at the top of the article, I could remove a redundant template that was in a section.
Thanks!
So, in fact we only have to fix the following example case
FIND:
{{Expert-subject|Foo|date=Some date}}
{{Expert-subject|Bar|date=Some different or same date}}
REPLACE:
{{Expert-subject|Foo|ex2=Bar|date=Some date}}
And do nothing if any of the two templates has 3 or more parameters.
You could also choose to merge templates if the reason and/or talk parameters are the same:
FIND:
{{Expert-subject|Foo|reason=fubar|date=Some date}}
{{Expert-subject|Bar|reason=fubar|date=Some different or same date}}
REPLACE:
{{Expert-subject|Foo|ex2=Bar|reason=fubar|date=Some date}}
FIND:
{{Expert-subject|Foo|talk=Fubar|date=Some date}}
{{Expert-subject|Bar|talk=Fubar|date=Some different or same date}}
REPLACE:
{{Expert-subject|Foo|ex2=Bar|talk=Fubar|date=Some date}}