Difference between revisions of "DPL Example 015"

From FollowTheScore
Jump to: navigation, search
(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...)
 
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 Somalia contsains in its last chapter several items:
+
The article on the [[United Republic of Tanzania]] contains in its last chapter several items:
 
# some regular text
 
# some regular text
# several category links
+
# a category links
# several interwiki language 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=Somalia
+
   |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 articvle which contains the DPL statement will become part of the categories mentioned in the article about [[Somalia]] - which is in most cases not what you want:
+
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=Somalia
+
  |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:%%¦/\[\[(Category¦[a-z]{1,3}):.*\]\]\s*/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=Somalia
+
  |titlematch=%Tanz%
 
  |include=#%-1
 
  |include=#%-1
 
  |table=,,last chapter
 
  |table=,,last chapter
  |tablerow=²{#replace:%%¦/\[\[Category:.*\]\]\s*/¦¦}²  
+
  |tablerow=²{#replace:%%¦/\[\[(Category¦[a-z]{1,3}):.*\]\]\s*/s¦¦}²  
 
}}
 
}}

Revision as of 18:03, 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:

  1. some regular text
  2. a category links
  3. 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:%%¦/\[\[(Category¦[a-z]{1,3}):.*\]\]\s*/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|/\[\[(Category|[a-z]{1