Dplmatrix/test matrix: Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
m (Add demo classes (no license selected on the wiki) from: https://followthescore.org/dpldemo/index.php?title=MediaWiki:Common.css)
imported>FrozenPlum
m (Undo revision 2014 by Lens0021 (talk) - as stated on the feedback/discussion page, the examples here are going to get separated out into pages that can be categorized and pre-loaded like the rest. For this reason, it's important to not complicate the example with extra formatting and templates (as explained on the discussion/feedback page).)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Test Matrix==
{|border=1 width=100% cellspacing=0
Below is an example of a test matrix.
|style=padding-left:5px width=120px id=n-Test | '''Test'''
|style=padding-left:5px | matrix
|-
|}


===generating a matrix from an indented list ===
===Generating a matrix from an indented list ===
Input is:
Input is:
one
one
oho
apple
aha
apricot
two ~~ Two
two ~~ Two
ehem
banana
three
three
four
four
aha
grape
uhui ~~ UHU
mango ~~ MANGO
two ~~ Two
two ~~ Two
uhui ~~ UHU
mango ~~ MANGO


Output is:
Output is:
Line 92: Line 89:
Now we use two nested DPL queries and what would be a separate page, Test matrix2, to generate the indented list:
Now we use two nested DPL queries and what would be a separate page, Test matrix2, to generate the indented list:
<pre>
<pre>
{{#dplmatrix:''links from articles to the DPL manual''|'''x'''|-|flip|
{{#dplmatrix:''links from articles to one of the Primary Module pages''|'''x'''|-|flip|
{{#dpl:
{{#dpl:
|debug=1
|debug=1
|category=All DPL3
|category=All DPL3
|count=5
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL¦namespace=}²,
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL3¦namespace=}²,
}}
}}
}}
}}
Line 106: Line 104:
|debug=1
|debug=1
|category=All DPL3
|category=All DPL3
|count=5
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL¦namespace=}²,
|format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL3¦namespace=}²,
}}
}}
}}
}}



Contents of Test matrix2:
'''Contents of Test matrix2:'''<br>
<pre>
<pre>
{{#dpl:
{{#dpl:
Line 118: Line 118:
|linksfrom={{{page}}}
|linksfrom={{{page}}}
|shownamespace=no
|shownamespace=no
|count=5
|format=, %PAGE% ~~ %TITLE%\n,
|format=, %PAGE% ~~ %TITLE%\n,
}}
}}
</pre>
</pre>

{{#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=}²,
}}
}}

Latest revision as of 09:24, 19 April 2022

Test Matrix

Below is an example of a test matrix.

Generating a matrix from an indented list

Input is:

one
 apple
 apricot
two ~~ Two
 banana
three
four
 grape
 mango ~~ MANGO
two ~~ Two
   mango ~~ MANGO

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 one of the Primary Module pages''|'''x'''|-|flip|
  {{#dpl:
    |debug=1
    |category=All DPL3
    |count=5
    |format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=All DPL3¦namespace=}²,
  }}
}}

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

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

}}


Contents of Test matrix2:

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