wpoa / recitation-bot

MediaWiki bot to upload content to Wikimedia projects and update corresponding citations on Wikipedia.
GNU General Public License v3.0
9 stars 3 forks source link

No more than 10 categories per article in Wikisource header template #12

Closed Daniel-Mietchen closed 9 years ago

Daniel-Mietchen commented 10 years ago

At https://en.wikisource.org/w/index.php?title=Wikisource:WikiProject_Open_Access/Programmatic_import_from_PubMed_Central/Schizophrenia_and_Violence_Systematic_Review_and_Meta-Analysis&oldid=4970952 , the category display is messed up because https://en.wikisource.org/w/index.php?title=Template:Header&oldid=4660353#Categories only allows for 10 categories. So we should provide a maximum of 10 and come up with some rules on which ones to eliminate if we have a longer list. Example: https://en.wikisource.org/w/index.php?title=Wikisource%3AWikiProject_Open_Access%2FProgrammatic_import_from_PubMed_Central%2FSchizophrenia_and_Violence_Systematic_Review_and_Meta-Analysis&diff=4970959&oldid=4970952 .

notconfusing commented 10 years ago

related https://github.com/wpoa/JATS-to-Mediawiki/issues/21

Daniel-Mietchen commented 10 years ago

No. The problem is that the header template can only handle 10 categories.

wrought commented 10 years ago

Seems one of the limitations is in the Header template https://en.wikisource.org/w/index.php?title=Template:Header_more_categories&action=edit

<!--
Categories
   -->{{#if:{{#titleparts:{{{categories|}}}|1|1}}|[[Category:{{#titleparts:{{{categories}}}|1|1}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|2}}|[[Category:{{#titleparts:{{{categories}}}|1|2}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|3}}|[[Category:{{#titleparts:{{{categories}}}|1|3}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|4}}|[[Category:{{#titleparts:{{{categories}}}|1|4}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|5}}|[[Category:{{#titleparts:{{{categories}}}|1|5}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|6}}|[[Category:{{#titleparts:{{{categories}}}|1|6}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|7}}|[[Category:{{#titleparts:{{{categories}}}|1|7}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|8}}|[[Category:{{#titleparts:{{{categories}}}|1|8}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|9}}|[[Category:{{#titleparts:{{{categories}}}|1|9}}]]}}<!--
   -->{{#if:{{#titleparts:{{{categories|}}}|1|10}}|[[Category:{{#titleparts:{{{categories}}}|1|10}}]]}}<!--

<!--

There is a ParserFunction called "#titleparts" being used for indeed up to 10 Categories. There are limitations to this function, including:

Warning: This function does not degrade gracefully if your input exceeds 255 characters. If the inputted string is 256 characters long or more, this function will simply toss the string back at you. -- https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23titleparts

Ideally, we should implement some sort of loop to process a high number of categories (apparently not too high as there are mediawiki transclusion limits that would prevent an arbitrary loop for fear of Denial-of-Service). However, Wikisource does not have many loop templates implemented (as wikipedia does for instance), so this is a bit of a tough problem. More info to follow

Daniel-Mietchen commented 10 years ago

I think we should stick to these 10 categories in the header template, but we can probably add additional ones outside the header template via the good old [[Category:XYZ]] syntax, either directly or via a separate template.

wrought commented 10 years ago

Pick the simplest solution even if an incomplete list of categories is displayed.

wrought commented 9 years ago

This has been fixed via https://en.wikisource.org/wiki/Template_talk:Header#Change_to_Support_More_than_10_Categories