| 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:
- Is a conversion of ui-children already planned or done elsewhere (e.g. in a non-public module)?
- 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). |