Page MenuHomePhabricator

Add example to #arraymap function documentation
Closed, DeclinedPublic

Description

The latest release of PageForms, in particular, its #arraymap function does not work.

To replicate the bug, please creates the following template and pages. The "Sandbox 2" page will not show categories. The "Sandbox 3" page will not show anything either.

  • in template 'Categories':
{{#arraymap:{{{Categories|}}}|,|x|[[Category:x]]|\s|}}
  • in page 'Sandbox 2':
__NOCACHE__
{{Categories|CAA,CAB,CAC}}
  • in page 'Sandbox 3':
__NOCACHE__
{{#show: Sandbox 2|?Category}}

System setup:
Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0 x86_64)
PHP version 7.4.3
MediaWiki 1.35.1
MagicNoCache Extension
Semantic MediaWiki Extension

Event Timeline

I think you need to change the #arrraymap call to:

{{#arraymap:{{{1|}}}|,|x|[[Category:x]]|\s|}}

...or change the template call to:

{{Categories|Categories=CAA,CAB,CAC}}

thank you Yaron, it works now.
I copied my template from this page https://www.mediawiki.org/wiki/Extension:Page_Forms/Page_Forms_and_templates, I guess this help page needs to be updated a tiny bit to make things easier to understand...

Well, there's nothing incorrect in that documentation, although it may be helpful to include a sample template call.

yeah, it does not contradict anything, it just would be helpful if there were a full example, say:

  • here's the template
  • here's the example of a call to that template...

this is what I meant.

Aklapper renamed this task from #arraymap function does not work. to Add example to #arraymap function documentation.Dec 29 2020, 5:08 PM

I've decided to "decline" this bug - I think the #arraymap documentation is fine as it is; explaining how templates and their parameters work is outside the scope of that documentation. That said, if you think it could benefit from another example, feel free to add it in directly to the documentation.