Difference between revisions of "DPL Example 015"
(New page: Sometimes you want to show content from selected articles but you don´t want to show all of the contents. You may want to suppress images, certain parts of the text or you may want to ign...) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
All this can easily be done with a #replace statement which manipulates the output of a <tt>tablerow</tt>. | All this can easily be done with a #replace statement which manipulates the output of a <tt>tablerow</tt>. | ||
− | The article on | + | The article on the [[United Republic of Tanzania]] contains in its last chapter several items: |
# some regular text | # some regular text | ||
− | # | + | # a category links |
− | # | + | # two interwiki language links |
If you include the whole chapter via | If you include the whole chapter via | ||
<pre><nowiki> | <pre><nowiki> | ||
{{#dpl: | {{#dpl: | ||
− | |titlematch= | + | |titlematch=%Tanz% |
|include=#%-1 | |include=#%-1 | ||
|table=,,last chapter | |table=,,last chapter | ||
}} | }} | ||
</nowiki></pre> | </nowiki></pre> | ||
− | You will see all of that content and the | + | You will see all of that content and the article which contains the DPL statement will become part of the categories mentioned in the article - which is in most cases not what you want: |
{{#dpl: | {{#dpl: | ||
− | |titlematch= | + | |titlematch=%Tanz% |
|include=#%-1 | |include=#%-1 | ||
|table=,,last chapter | |table=,,last chapter | ||
Line 25: | Line 25: | ||
So you should consider to add a statement like | So you should consider to add a statement like | ||
− | |tablerow=²{#replace:%%¦/\[\[Category:.*\]\]\s*/ | + | |tablerow=²{#replace:%%¦/\[\[Category:.*\]\]\s*/s¦¦}² |
or like | or like | ||
− | . | + | |tablerow=²{#replace:%%¦/\[\[C?[a-z]+:.*\]\]\s*/¦}² |
to eliminate those portions of the text which you do not want to show. | to eliminate those portions of the text which you do not want to show. | ||
Line 36: | Line 36: | ||
{{#dpl: | {{#dpl: | ||
− | |titlematch= | + | |titlematch=%Tanz% |
|include=#%-1 | |include=#%-1 | ||
|table=,,last chapter | |table=,,last chapter | ||
− | |tablerow=²{#replace:%%¦/\[\[ | + | |tablerow=²{#replace:%%¦/\[\[C?[a-z]+:.*\]\]\s*/¦}² |
}} | }} |
Latest revision as of 17:20, 10 May 2009
Sometimes you want to show content from selected articles but you don´t want to show all of the contents. You may want to suppress images, certain parts of the text or you may want to ignore the category assignments which may be contsained in the transcluded text.
All this can easily be done with a #replace statement which manipulates the output of a tablerow.
The article on the United Republic of Tanzania contains in its last chapter several items:
- some regular text
- a category links
- two interwiki language links
If you include the whole chapter via
{{#dpl: |titlematch=%Tanz% |include=#%-1 |table=,,last chapter }}
You will see all of that content and the article which contains the DPL statement will become part of the categories mentioned in the article - which is in most cases not what you want:
Content page | last chapter |
---|---|
United Republic of Tanzania |
Some Text.de:Tansania xyz:Tanzania |
So you should consider to add a statement like
|tablerow=²{#replace:%%¦/\[\[Category:.*\]\]\s*/s¦¦}²
or like
|tablerow=²{#replace:%%¦/\[\[C?[a-z]+:.*\]\]\s*/¦}²
to eliminate those portions of the text which you do not want to show.
Using the latter statement you will get the following output:
Content page | last chapter |
---|---|
United Republic of Tanzania | {{#replace:
Some Text.de:Tansania xyz:Tanzania|/\[\[C?[a-z]+:.*\]\]\s*/|}} |