Dplmatrix/test matrix: Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
imported>FrozenPlum
m (Add demo classes (no license selected on the wiki) from: https://followthescore.org/dpldemo/index.php?title=MediaWiki:Common.css)
Line 26: Line 26:
|<pre>{{#dplmatrix:a simple demo matrix||||
|<pre>{{#dplmatrix:a simple demo matrix||||
one
one
apple
oho
apricot
aha
two ~~ Two
two ~~ Two
banana
ehem
three
three
four
four
grape
aha
uhui ~~ UHU
mango ~~ MANGO
two ~~ Two
two ~~ Two
uhui ~~ UHU
mango ~~ MANGO
}}</pre>
}}</pre>
|<pre>{{#dplmatrix:a simple demo matrix|<big>&bull;</big>|.|flip|
|<pre>{{#dplmatrix:a simple demo matrix|<big>&bull;</big>|.|flip|
one
one
apple
oho
apricot
aha
two ~~ Two
two ~~ Two
banana
ehem
three
three
four
four
grape
aha
uhui ~~ UHU
mango ~~ MANGO
two ~~ Two
two ~~ Two
uhui ~~ UHU
mango ~~ MANGO
}}</pre>
}}</pre>
|--
|--
Line 54: Line 54:
{{#dplmatrix:a simple demo matrix||||
{{#dplmatrix:a simple demo matrix||||
one
one
apple
oho
apricot
aha
two ~~ Two
two ~~ Two
banana
ehem
three
three
four
four
grape
aha
uhui ~~ UHU
mango ~~ MANGO
two ~~ Two
two ~~ Two
uhui ~~ UHU
mango ~~ MANGO
}}
}}
|
|
{{#dplmatrix:a simple demo matrix|<big>&bull;</big>|.|flip|
{{#dplmatrix:a simple demo matrix|<big>&bull;</big>|.|flip|
one
one
apple
oho
apricot
aha
two ~~ Two
two ~~ Two
banana
ehem
three
three
four
four
grape
aha
uhui ~~ UHU
mango ~~ MANGO
two ~~ Two
two ~~ Two
uhui ~~ UHU
mango ~~ MANGO
}}
}}
|}
|}
Line 95: Line 95:
{{#dpl:
{{#dpl:
|debug=1
|debug=1
|category=DPL Manual
|category=All DPL3
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=DPL Manual¦namespace=}²,
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL¦namespace=}²,
}}
}}
}}
}}
</pre>
</pre>

'''Result:'''<br>
{{#dplmatrix:''links from articles to the DPL manual''|'''x'''|-|flip|
{{#dpl:
|debug=1
|category=All DPL3
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL¦namespace=}²,
}}
}}

Contents of Test matrix2:
Contents of Test matrix2:
<pre>
<pre>
Line 115: Line 125:
{{#dpl:
{{#dpl:
|debug=1
|debug=1
|category=DPL Manual
|category=All DPL3
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=DPL Manual¦namespace=}²,
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=DPL Manual¦namespace=}²,
}}
}}

Revision as of 00:55, 2 April 2022

Test matrix

generating a matrix from an indented list

Input is:

one
 oho
 aha
two ~~ Two
 ehem
three
four
 aha
 uhui ~~ UHU
two ~~ Two
   uhui ~~ UHU

Output is:

normal flipped
{{#dplmatrix:a simple demo matrix||||
one
 apple
 apricot
two ~~ Two
 banana
three
four
 grape
 mango ~~ MANGO
two ~~ Two
   mango ~~ MANGO
}}
{{#dplmatrix:a simple demo matrix|<big>•</big>|.|flip|
one
 apple
 apricot
two ~~ Two
 banana
three
four
 grape
 mango ~~ MANGO
two ~~ Two
   mango ~~ MANGO
}}

{{#dplmatrix:a simple demo matrix|||| one

apple
apricot

two ~~ Two

banana

three four

grape
mango ~~ MANGO

two ~~ Two

  mango ~~ MANGO

}}

{{#dplmatrix:a simple demo matrix||.|flip| one

apple
apricot

two ~~ Two

banana

three four

grape
mango ~~ MANGO

two ~~ Two

  mango ~~ MANGO

}}

  • "from" items ("source") start in col 1
  • "to" items ("target") are indented by at least one space
  • source appears in input sequence
  • target is sorted by alphabet
  • items are treated as pages and shown as a link
  • the label can be defined by adding it after the iterm, separated by "~~"
  • symbols for "yes" and "no" can be defined
  • via the stylesheet in Mediawiki:Common.css you can control the layout (class=dplmatrix)

Links to DPL Manual pages

Now we use two nested DPL queries and what would be a separate page, Test matrix2, to generate the indented list:

{{#dplmatrix:''links from articles to the DPL manual''|'''x'''|-|flip|
  {{#dpl:
    |debug=1
    |category=All DPL3
    |format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL¦namespace=}²,
  }}
}}

Result:
{{#dplmatrix:links from articles to the DPL manual|x|-|flip|

 {{#dpl:
   |debug=1
   |category=All DPL3
   |format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL¦namespace=}²,
 }}

}}

Contents of Test matrix2:

{{#dpl:
 |debug=1
 |{{#if:{{{namespace|}}}|{{#ifeq:{{{namespace}}}|main|namespace=|namespace={{{namespace}}}|}}}}
 |{{#if:{{{category|}}}|category={{{category}}}}}
 |linksfrom={{{page}}}
 |shownamespace=no
 |format=,   %PAGE% ~~ %TITLE%\n,
}}

{{#dplmatrix:links from articles to the DPL manual|x|-|flip|

 {{#dpl:
   |debug=1
   |category=All DPL3
   |format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=DPL Manual¦namespace=}²,
 }}

}}