This issue has been created
 
 
Confluence / cid:jira-generated-image-avatar-47ceaee2-e0f9-4b6d-b605-93c3f75c8713 CONFLUENCE-551 Open

Convert Refined's ui-children macro like the children macro

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-983e2902-c79d-49c9-a2ed-88869bca510b Christophe CN created this issue on 12/Nov/26 14:49
 
Summary: Convert Refined's ui-children macro like the children macro
Issue Type: cid:jira-generated-image-avatar-47ceaee2-e0f9-4b6d-b605-93c3f75c8713 Improvement
Affects Versions: 9.96.7
Assignee: Unassigned
Components: XML
Created: 12/Nov/26 14:49
Priority: cid:jira-generated-image-static-major-2294c43c-9d22-4e37-affa-3b7e8774acc8 Major
Reporter: Christophe CN
Description:

The ui-children macro of Refined Toolkit for Confluence Data Center lists the child pages of the current page or of a given page.

It is currently not converted.

Its parameters (https://help.refined.com/space/TOOLKITDC/4704436363):

  • page: empty (current page), a page link or a page id
  • sort: creation, title or modified (default: alphabetical)
  • reverse: true for descending order
  • columns: number of columns of the list
  • display: inline or block (full width)

page, sort and reverse have exactly the same meaning and values as for the Confluence children macro, which ChildrenMacroConverter already handles (through AbstractWithSortAndReverseMacroConverter: creation -> creationDate, title -> title, modified -> date, reverse -> ":desc").

Proposed change: let ChildrenMacroConverter also handle ui-children (add the "ui-children" hint, as was done for Refined's rw-pagetree in CONFLUENCE-286). columns and display have no XWiki equivalent and would be reported with markUnhandledParameterValue.

Examples (storage format -> expected output):

<ac:structured-macro ac:name="ui-children" ac:schema-version="1">

<ac:parameter ac:name="columns">2</ac:parameter>

<ac:parameter ac:name="display">block</ac:parameter>

<ac:parameter ac:name="sort">modified</ac:parameter>

<ac:parameter ac:name="reverse">true</ac:parameter>

</ac:structured-macro>

{{children sort="date:desc"/}}

and, with a page:

<ac:structured-macro ac:name="ui-children" ac:schema-version="1">

<ac:parameter ac:name="page"><ac:link><ri:page ri:content-title="Some page" /></ac:link></ac:parameter>

<ac:parameter ac:name="sort">creation</ac:parameter>

</ac:structured-macro>

{{documentTree root="document:<converted reference of Some page>" sortDocumentsBy="creationDate"/}}

 

Related bug, same converter: without a page, ChildrenMacroConverter produces children sortDocumentsBy="..."/, but the children wiki macro (XWiki.ChildrenMacro, identical in 17.10.2 and 18.6.0) only has the root and sort parameters: sortDocumentsBy is silently ignored and children are always sorted by title.

For children, the sort should be written in "sort".

We checked on XWiki 17.10.2 and 18.6.0 that children sort="..."/ honours title, title:desc, date:desc, creationDate and creationDate:desc, and that documentTree sortDocumentsBy="..."/ honours date:desc and creationDate.

Without this fix, the sort of ui-children (and children) is lost in the most common case (no page parameter). 

We can open a separate issue for it if you prefer.

Questions:

  1. Is a conversion of ui-children already planned or done elsewhere (e.g. in a non-public module)?
  1. Is reusing ChildrenMacroConverter fine with you, rather than a dedicated converter?

We are willing to provide the pull request, with filter tests (ui-children.test, and an updated children.test whose expected output currently contains sortDocumentsBy).