hallowelt / migrate-confluence

Tool to migrate content from Confluence export files into a MediaWiki compatible import source
GNU General Public License v3.0
35 stars 8 forks source link

Template:Subpagelist #77

Open markus-96 opened 1 year ago

markus-96 commented 1 year ago

For me, the template Subpagelist does not work at all, and I dont know why. But that is not the point of this issue. If in Confluence you have a TOC on the Landing Page of a space, which gets converted to the Main Page of the namespace in mediawiki, there are no Subpages you can refer to. I hope you understand what I mean.. The following is working, but a bit ugly:

{{#arraydefine: pages | {{#ask: [[{{{namespace}}}:!~*/*]][[Modification date::+]]|link=none|format=array|sep=!}} |!}}
Hauptseiten: {{#arraysize:pages}}

{{#loop: i
|0
|{{#arraysize:pages}}
|<nowiki />
{{#arraydefine: value | {{ #arrayindex:pages | {{ #var:i }} }} | ;}}
{{#ask:[[{{#arrayindex: value | 0}}]]}}
{{#ifexpr: {{#expr:{{#subpagecount:{{#arrayindex: value | 0}}}} > 0}}|{{#subpages: {{#arrayindex: value | 0}}}}}}
}}
<noinclude>
<templatedata>
{
    "params": {
        "namespace": {
            "label": "Namensraum",
            "type": "string",
            "required": true
        }
    },
    "description": "Erstellt eine Liste aller Seiten eines Namespace sowie ihrer Unterseiten."
}
</templatedata>
</noinclude>
osnard commented 5 months ago

Thank you very much for your contribution! We'll check it we can use it. In the meantime I'll keep this topic open as a reference for others.