Page 1 of 1

Expression error in Oscillators with period _ categories

Posted: November 27th, 2019, 4:50 pm
by creeperman7002
Whenever I view a category for oscillators with a given period (on LifeWiki), this error message pops up:

Expression error: Unexpected < operator.

Re: Expression error in Oscillators with period _ categories

Posted: November 27th, 2019, 6:42 pm
by Ian07
This has been an issue ever since we updated to the latest MediaWiki version last month: viewtopic.php?p=83792#p83792

No one is exactly sure why it happened, so it looks like this is going to remain an issue until someone gets around to trying to find their way through this mess of code:

Code: Select all

<includeonly>{{#ifexpr:{{{p|0}}}>3|{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|offset={{#expr:{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|resultsheader={|format={#ifeq,:%TITLE%{{!}}{{{p|0}}}{{!}}%NR%{{!}}},}{{#ifeq,:{{!}}a}}}}+1}}|count=1|format=,[[:Category:Oscillators_with_period_%TITLE%|Period %TITLE%]],,}}&nbsp;'''·'''&nbsp;}}{{#ifexpr:{{{p|0}}}>2|{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|offset={{#expr:{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|resultsheader={|format={#ifeq,:%TITLE%{{!}}{{{p|0}}}{{!}}%NR%{{!}}},}{{#ifeq,:{{!}}a}}}}-0}}|count=1|format=,[[:Category:Oscillators_with_period_%TITLE%|Period %TITLE%]],,}}&nbsp;'''·'''&nbsp;}}{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|offset={{#expr:{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|resultsheader={|format={#ifeq,:%TITLE%{{!}}{{{p|0}}}{{!}}%NR%{{!}}},}{{#ifeq,:{{!}}a}}}}-1}}|count=1|format=,[[:Category:Oscillators_with_period_%TITLE%|Period %TITLE%]],,}}{{#ifexpr:{{#expr:{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|resultsheader={|format={#ifeq,:%TITLE%{{!}}{{{p|0}}}{{!}}%NR%{{!}}},}{{#ifeq,:{{!}}a}}}}-1}}>0|
{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|offset={{#expr:{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|resultsheader={|format={#ifeq,:%TITLE%{{!}}{{{p|5}}}{{!}}%NR%{{!}}},}{{#ifeq,:{{!}}a}}}}-0}}|count=1|format=&nbsp;'''·'''&nbsp;,[[:Category:Oscillators_with_period_%TITLE%|Period %TITLE%]],,}}}}{{#ifexpr:{{#expr:{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|order=descending|resultsheader={|format={#ifeq,:%TITLE%{{!}}{{{p|0}}}{{!}}%NR%{{!}}},}{{#ifeq,:{{!}}a}}}}-1}}>1|{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|offset={{#expr:{{#dpl:category=Oscillators_with_specific_period|replaceintitle=/Oscillators.with.period./,|ordermethod=sortkey|skipthispage=no|resultsheader={|format={#ifeq,:%TITLE%{{!}}{{{p|0}}}{{!}}%NR%{{!}}},}{{#ifeq,:{{!}}a}}}}+1}}|count=1|format=&nbsp;'''·'''&nbsp;,[[:Category:Oscillators_with_period_%TITLE%|Period %TITLE%]],,}}}}</includeonly><noinclude>This template displays the next and previous oscillator period category links from the oscillator period category pages.</noinclude>

Re: Expression error in Oscillators with period _ categories

Posted: November 28th, 2019, 9:45 am
by Nathaniel
Ah yeah, the DynamicPageList functionality of MediaWiki changed considerably with recent versions, and I'm not sure how to get it to do what we want there anymore. Unfortunately I think the cleanest solution at this point is to empty out that template so that it doesn't display anything at all (it used to display links to nearby oscillator period categories). If someone figures out another way to get those nearby category links, feel free to revert/fix that template.

Re: Expression error in Oscillators with period _ categories

Posted: February 10th, 2022, 8:32 am
by GUYTU6J
Bump! Now that another MediaWiki (and subsequently DPL) update has taken place, can we finally consider fixing this issue? Hopefully a similar instance of code can be found in another wiki with the same DPL version and copied here.

Re: Expression error in Oscillators with period _ categories

Posted: February 10th, 2022, 4:24 pm
by Ian07
GUYTU6J wrote:
February 10th, 2022, 8:32 am
Bump! Now that another MediaWiki (and subsequently DPL) update has taken place, can we finally consider fixing this issue? Hopefully a similar instance of code can be found in another wiki with the same DPL version and copied here.
Wikipedia has templates (e.g. Navseasoncats) like this, but they all use Lua invocation rather than DPL, so I decided to take matters into my one hands. Template:CategoryNav is a prototype for a general-purpose template, however there are a few issues that need to somehow be addressed before this can be introduced to the category space:
  • DPL does not seem to provide the ability to filter pages by sortkey, only by their actual title. So pages are sorted in the right order for, for example, yearly categories where alphabetical order and numerical order happen to be the same. However, it does not work for categories like those in Oscillators with specific period as the default sort order is along the lines of 1, 10, 100, 11, 12, 13, etc.
  • The display text is not customized for each link based on the subcategory title. As it is right now, the full subcategory name is displayed, which is rather clunky. I tried to pipe the links so that they would just display "1997", "1998", "1999", and so on, but because "%PAGE%" was already substituted, trying to apply any templates or parser functions to it only results in them being applied to the string "%PAGE%". So, for example, {{#len:%PAGE%}} will return 6 no matter what.
On the bright side, the edge cases seem to work okay - thanks to some trickery, the template should display with the correct count and offset for any four-digit year inputted.

PS: As a warning to anyone working with complex DPL queries, make sure you copy your edits elsewhere before clicking "preview" or "save". On multiple occasions today I lost my progress because I got a fatal error and couldn't go back to my edit.

Re: Expression error in Oscillators with period _ categories

Posted: February 13th, 2022, 12:54 pm
by GUYTU6J
Ian07 wrote:
February 10th, 2022, 4:24 pm
DPL does not seem to provide the ability to filter pages by sortkey, only by their actual title. So pages are sorted in the right order for, for example, yearly categories where alphabetical order and numerical order happen to be the same. However, it does not work for categories like those in Oscillators with specific period as the default sort order is along the lines of 1, 10, 100, 11, 12, 13, etc.
Would the idea of using complements work? Specifically, given a page title, extract the number N intended for numerical sorting and subtract that from a very large integer (say, 1000000), and then sort by decreasing alphabetical order of (1000000-N). If this can be implemented in wiki syntax, it will solve a bunch of other sorting problems at the same time, for instance the DYK thing.

Re: Expression error in Oscillators with period _ categories

Posted: June 6th, 2022, 2:55 am
by GUYTU6J
Good news: after a series of conversation I have fixed the Template:OscNumbers. A working example can be seen at Category:Oscillators with period 100.

Bad news: it is currently not generalizable to some other categories. The replaceintitle thing will not work for titles like Category:Patterns with between 1,000 and 9,999 cells created during the massive category merging last year, because the regular expression assumes that removing a continuous string in the title leaves a single clean number.

In an attempt to generalize the model to other numerical categories, I made an error:

Code: Select all

[Yp2i-dp60ctaI_uLNb7tzQABUAg] 2022-06-06 06:47:21: 类型“Wikimedia\Rdbms\DBTransactionStateError”的致命异常