Difference between revisions of "DPL:Manual - dplmatrix"
From FollowTheScore
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{Type | + | {{Type Manual|section=dplmatrix}} |
=== Syntax === | === Syntax === | ||
Line 13: | Line 13: | ||
You pass an indented list and you get a matrix view back. With copy/paste you can easily transfer such a matrix to Excel and do some polishing there like turning column texts to vertical, highlight interesting cells etc..) | You pass an indented list and you get a matrix view back. With copy/paste you can easily transfer such a matrix to Excel and do some polishing there like turning column texts to vertical, highlight interesting cells etc..) | ||
− | There are five parameters which MUST be given in | + | There are five parameters which MUST be given in the order listed here: |
# The name of the matrix. Appears in the upper left cell. Arbitrary wiki formatting (even images) are possible. | # The name of the matrix. Appears in the upper left cell. Arbitrary wiki formatting (even images) are possible. | ||
# The symbol for cells which symbolize a link. Default is "x". | # The symbol for cells which symbolize a link. Default is "x". | ||
Line 22: | Line 22: | ||
#* target items must be indented by at least one space | #* target items must be indented by at least one space | ||
#* after the item name you can add ~~ and a 'label'. Row and column titles of the matrix will contain hyperlinks to the items. If lables are specified they will be used instead of the item names. | #* after the item name you can add ~~ and a 'label'. Row and column titles of the matrix will contain hyperlinks to the items. If lables are specified they will be used instead of the item names. | ||
+ | #* lines which are empty or contain only spaces are silently ignored. | ||
+ | #* if a source line is not followed by one or more target lines an empty table row (or column in flip mode) will be shown. | ||
+ | #* if the same source line appears multiple times, the targets will be joined (added). | ||
The idea is that you can generate the indented list by DPL statements. See the following example: | The idea is that you can generate the indented list by DPL statements. See the following example: |
Latest revision as of 12:04, 28 January 2008
Manual | dplmatrix |
Syntax
{{#dplmatrix: name | yes | no | mode | '''indented_list''' }}
Effect
This function is a side entry into DPL.
You pass an indented list and you get a matrix view back. With copy/paste you can easily transfer such a matrix to Excel and do some polishing there like turning column texts to vertical, highlight interesting cells etc..)
There are five parameters which MUST be given in the order listed here:
- The name of the matrix. Appears in the upper left cell. Arbitrary wiki formatting (even images) are possible.
- The symbol for cells which symbolize a link. Default is "x".
- The symbol for cells which symbolize the absence of a link. Default is 'empty cell'.
- The mode ('normal' or 'flip'); default is 'normal'. When 'flip' is specified rows and columns will be exchanged.
- The indented list.
- source items must start in column 1
- target items must be indented by at least one space
- after the item name you can add ~~ and a 'label'. Row and column titles of the matrix will contain hyperlinks to the items. If lables are specified they will be used instead of the item names.
- lines which are empty or contain only spaces are silently ignored.
- if a source line is not followed by one or more target lines an empty table row (or column in flip mode) will be shown.
- if the same source line appears multiple times, the targets will be joined (added).
The idea is that you can generate the indented list by DPL statements. See the following example:
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 oho aha two ~~ Two ehem three four aha uhui ~~ UHU two ~~ Two uhui ~~ UHU }} |
{{#dplmatrix:a simple demo matrix|<big>•</big>|.|flip| one oho aha two ~~ Two ehem three four aha uhui ~~ UHU two ~~ Two uhui ~~ UHU }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
- "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 Test matrix2 to generate the indented list:
{{#dplmatrix:''links from articles to the DPL manual''|'''x'''|-|flip| {{#dpl: |debug=1 |category=DPL Manual |format=,%PAGE% ~~ %TITLE%\n²{:Test matrix2¦page=%PAGE%¦category=DPL Manual¦namespace=}², }} }}