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...)
(No difference)

Revision as of 16:55, 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 Somalia contsains in its last chapter several items:

  1. some regular text
  2. several category links
  3. several interwiki language links.

If you include the whole chapter via

  {{#dpl:
   |titlematch=Somalia
   |include=#%-1
   |table=,,last chapter
  }}

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:

Content page last chapter
Somalia

Template:Countries of East Africa Template:Countries of Africa Template:Arabian Sea Template:Red Sea Template:Indian Ocean Template:Member states of the African Union Template:Arab League Template:OIC Template:Cushitic-speakingaf:Somalië am:ሶማሊያ ar:الصومال an:Somalia frp:Somalie ast:Somalia bn:সোমালিয়া zh-min-nan:Somalia bs:Somalija bg:Сомалия ca:Somàlia cs:Somálsko cy:Somalia da:Somalia de:Somalia et:Somaalia el:Σομαλία es:Somalia eo:Somalio eu:Somalia fa:سومالی fr:Somalie gd:Somalia gl:Somalia - Soomaaliya ko:소말리아 hi:सोमालिया hr:Somalija io:Somalia ilo:Somalia id:Somalia is:Sómalía it:Somalia he:סומליה ka:სომალი kw:Somali sw:Somalia ku:Somaliya la:Somalia lv:Somālija lt:Somalis lij:Somalia hu:Szomália mk:Сомалија ms:Somalia nl:Somalië ja:ソマリア no:Somalia nn:Somalia oc:Somalia ug:سومالى pam:Somalia nds:Somalia pl:Somalia pt:Somália ro:Somalia rm:Somalia ru:Сомали sa:सोमालिया sq:Somalia simple:Somalia sk:Somálsko sl:Somalija so:Soomaaliya sr:Сомалија sh:Somalija fi:Somalia sv:Somalia tl:Somalia th:ประเทศโซมาเลีย vi:Somalia tg:Сумолӣ tr:Somali uk:Сомалі vo:Somalän zh:索马里


So you should consider to add a statement like

  |tablerow=²{#replace:%%¦/\[\[Category:.*\]\]\s*/¦¦}² 

or like

  ...

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
Somalia {{#replace:

Template:Countries of East Africa Template:Countries of Africa Template:Arabian Sea Template:Red Sea Template:Indian Ocean Template:Member states of the African Union Template:Arab League Template:OIC Template:Cushitic-speakingaf:Somalië am:ሶማሊያ ar:الصومال an:Somalia frp:Somalie ast:Somalia bn:সোমালিয়া zh-min-nan:Somalia bs:Somalija bg:Сомалия ca:Somàlia cs:Somálsko cy:Somalia da:Somalia de:Somalia et:Somaalia el:Σομαλία es:Somalia eo:Somalio eu:Somalia fa:سومالی fr:Somalie gd:Somalia gl:Somalia - Soomaaliya ko:소말리아 hi:सोमालिया hr:Somalija io:Somalia ilo:Somalia id:Somalia is:Sómalía it:Somalia he:סומליה ka:სომალი kw:Somali sw:Somalia ku:Somaliya la:Somalia lv:Somālija lt:Somalis lij:Somalia hu:Szomália mk:Сомалија ms:Somalia nl:Somalië ja:ソマリア no:Somalia nn:Somalia oc:Somalia ug:سومالى pam:Somalia nds:Somalia pl:Somalia pt:Somália ro:Somalia rm:Somalia ru:Сомали sa:सोमालिया sq:Somalia simple:Somalia sk:Somálsko sl:Somalija so:Soomaaliya sr:Сомалија sh:Somalija fi:Somalia sv:Somalia tl:Somalia th:ประเทศโซมาเลีย vi:Somalia tg:Сумолӣ tr:Somali uk:Сомалі vo:Somalän zh:索马里|/\[\[Category:.*\]\]\s*/||}}