Page MenuHomePhabricator

`fromsection` and `tosection` attributes of `pages` tag will not work when empty `onlysection` present
Open, In Progress, LowPublicBUG REPORT

Description

  • using <pages index="book.pdf" from="19" to="20" fromsection="s-2" tosection="" onlysection="" /> will get the whole page 19.
  • using <pages index="book.pdf" from="19" to="20" fromsection="" tosection="s-1" onlysection="" /> will get the whole page 20.
  • using <pages index="book.pdf" from="19" to="20" fromsection="" tosection="s-1" /> and <pages index="book.pdf" from="19" to="20" fromsection="s-2" tosection="" /> are OK.

So empty onlysection attribute affect to stop working of fromsection and tosection attributes.

Event Timeline

I'm struggling to comprehend which part of this is not intended behavior ?

I'm struggling to comprehend which part of this is not intended behavior ?

<pages index="book.pdf" from="19" to="20" fromsection="s-2" tosection="" onlysection="" /> must get from section s-2 of page 19 not whole page 19 as <pages index="book.pdf" from="19" to="20" fromsection="" tosection="s-1" /> but the empty onlysection prevent if from that so now:
<pages index="book.pdf" from="19" to="20" fromsection="s-2" tosection="" onlysection="" /> == <pages index="book.pdf" from="19" to="20" />
valued fromsection and valued tosection have no effect when empty onlysection is present.

Change #1108477 had a related patch set uploaded (by Hubaishan; author: Hubaishan):

[mediawiki/extensions/ProofreadPage@master] fix fromsection and tosection attributes of pages ignored

https://gerrit.wikimedia.org/r/1108477

hubaishan changed the task status from Open to In Progress.Jan 6 2025, 8:12 PM
hubaishan claimed this task.
hubaishan triaged this task as Low priority.

Thank you for raising this! Currently all <pages> parameters are considered to be set when their value is the empty string. The suggested change would change the behavior only for the onlysection parameter. Hence, I am a bit reluctant to apply it. What would be an intended use case of the change?

@Tpt see this revision on صفحات template in arwikisource I create it to simplify access to pages tag with only local language (Arabic) parameters , this is important for beginners. But it does not work for sections because of empty onlysection.

@hubaishan Thank you! A workaround is to write {{#if:{{{فقط الفصل|}}}|onlysection={{{فقط الفصل}}}}} instead of onlysection={{{فقط الفصل|}}} to only set the onlysection parameter only if فقط الفصل is set

@hubaishan Thank you! A workaround is to write {{#if:{{{فقط الفصل|}}}|onlysection={{{فقط الفصل}}}}} instead of onlysection={{{فقط الفصل|}}} to only set the onlysection parameter only if فقط الفصل is set

this will not work when فقط الفصل has value, I think it parsed like if you type |2=onlysection{{=}}{{{فقط الفصل}}}