Difference between revisions of "Issue:Subpages as sublists"
(→Problem: Typo) |
(→Problem) |
||
Line 15: | Line 15: | ||
Now some of the pages in the category are subpages so I get a display like this | Now some of the pages in the category are subpages so I get a display like this | ||
− | + | <pre><nowiki> | |
* [[Greek/Mycenean]] | * [[Greek/Mycenean]] | ||
* [[Greek/Mycenean/Texts]] | * [[Greek/Mycenean/Texts]] | ||
* [[Greek/Mycenean/Writing]] | * [[Greek/Mycenean/Writing]] | ||
* [[Greek/Mycenean/Writing/Syllabary]] | * [[Greek/Mycenean/Writing/Syllabary]] | ||
− | + | </nowiki></pre> | |
* [[Greek/Mycenean]] | * [[Greek/Mycenean]] | ||
* [[Greek/Mycenean/Texts]] | * [[Greek/Mycenean/Texts]] | ||
Line 27: | Line 27: | ||
I would like them to appear as an hierarchical listing | I would like them to appear as an hierarchical listing | ||
− | + | <pre><nowiki> | |
* [[Greek]] | * [[Greek]] | ||
** [[Greek/Mycenean|Mycenean]] | ** [[Greek/Mycenean|Mycenean]] | ||
Line 33: | Line 33: | ||
*** [[Greek/Mycenean/Writing|Writing]] | *** [[Greek/Mycenean/Writing|Writing]] | ||
**** [[Greek/Mycenean/Writing/Syllabary|Syllabary]] | **** [[Greek/Mycenean/Writing/Syllabary|Syllabary]] | ||
− | + | </nowiki></pre> | |
* [[Greek]] | * [[Greek]] | ||
** [[Greek/Mycenean|Mycenean]] | ** [[Greek/Mycenean|Mycenean]] |
Revision as of 17:49, 21 April 2009
Description: | How to list subpages as sublists |
Extension / Version: | DPL / ? |
Type / Status: | Change Request / open |
Problem
I have a statement like this
<dpl> category=Mycenean </dpl>
Now some of the pages in the category are subpages so I get a display like this
* [[Greek/Mycenean]] * [[Greek/Mycenean/Texts]] * [[Greek/Mycenean/Writing]] * [[Greek/Mycenean/Writing/Syllabary]]
I would like them to appear as an hierarchical listing
* [[Greek]] ** [[Greek/Mycenean|Mycenean]] *** [[Greek/Mycenean/Texts|Texts]] *** [[Greek/Mycenean/Writing|Writing]] **** [[Greek/Mycenean/Writing/Syllabary|Syllabary]]
N.B. That [[Category:Greek]]
would have further subpages [[Greek/Writing]]
, [[Greek/Dialects]]
and whatever which shouldn't appear in a listing of category=Mycenean
, but [[Greek]]
itself should, as the top page in the category=Mycenean hierarchy is itself a subpage of that page.
As for constructing code which translates the current wikitext into the desired one this Perl regex does the trick,
except that they don't add the [[Greek]]
top node (There would need to be some check to see if the category named in a category=
parameter is itself a subcategory and if so add the supercategory/-ies):
s{^\*[ ](\[\[.+?([^/]+)\]\])}{ $l = $1; $c = ($l =~ s#/#/#g); ## Count the number of slashes in the link and add 1. $l =~ s#([^/]+)\]\]$#$1\|$1\]\]#; ## Copy link text "\*" x $c ." ".$l; ## Print out the right number of asterisks and the link }egm;
This is the concept. A bit harder of course if done on HTML rather than wikitext.
Melroch 10:51, 21 April 2009 (UTC)