Dplmatrix/test matrix: Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
m (Remove the note, the example now works)
(Using {{Dplmatrix with borders}} for TemplateStyles)
Line 49: Line 49:
|--
|--
|
|
{{#dplmatrix:a simple demo matrix||||
{{Dplmatrix with borders|{{#dplmatrix:a simple demo matrix||||
one
one
apple
apple
Line 61: Line 61:
two ~~ Two
two ~~ Two
mango ~~ MANGO
mango ~~ MANGO
}}
}}}}
|
|
{{#dplmatrix:a simple demo matrix|<big>&bull;</big>|.|flip|
{{Dplmatrix with borders|{{#dplmatrix:a simple demo matrix|<big>&bull;</big>|.|flip|
one
one
apple
apple
Line 75: Line 75:
two ~~ Two
two ~~ Two
mango ~~ MANGO
mango ~~ MANGO
}}
}}}}
|}
|}
* "from" items ("source") start in col 1
* "from" items ("source") start in col 1
Line 100: Line 100:


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





Revision as of 17:17, 18 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
}}
Page Template:Dplmatrix with borders/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "plain text").
{{#dplmatrix:a simple demo matrix||||

one

apple
apricot

two ~~ Two

banana

three four

grape
mango ~~ MANGO

two ~~ Two

  mango ~~ MANGO
}}
Page Template:Dplmatrix with borders/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "plain text").
{{#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:

Page Template:Dplmatrix with borders/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "plain text").

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