User:Annew/DPL: Difference between revisions

    From KDE UserBase Wiki
    No edit summary
     
    (36 intermediate revisions by 3 users not shown)
    Line 1: Line 1:
    :Reference: [http://semeb.com/dpldemo/index.php?title=DPL:Manual DPL Manual]
    :Reference: [http://semeb.com/dpldemo/index.php?title=DPL:Manual DPL Manual]
    :See also [[User:Pipesmoker/Dynamic_Page_Lists|Pipesmoker's notes]]
    :See also [[User:Pipesmoker/Dynamic_Page_Lists|Pipesmoker's notes]] and [http://semeb.com/dpldemo/index.php?title=Extension_DPL this page of examples]
    :Example UI on [http://semeb.com/dpldemo/index.php?title=Template:Catlist this Template:Catlist page]
     
    == Finding pages marked "ToDo" ==
     
    {{Input|1=<nowiki>
    <DPL>
      titlematch = %Kdenlive/Manual/%
      namespace =
      include = *
      includematch = /ToDo/
      resultsheader = KDEnlive pages containing the string "ToDo"
      format = ,\n* [[%PAGE%|%TITLE%]]\n,,
    </DPL>
    </nowiki>}}
     
    <DPL>
      titlematch = %Kdenlive/Manual/%
      namespace =
      include=*
      includematch=/ToDo/
      resultsheader = KDEnlive pages containing the string "ToDo"
      format = ,\n* [[%PAGE%|%TITLE%]]\n,,
    </DPL>
     
    == Searching for pages containing a certain text string ==
     
    Matching content in pages: You need to include the contents of pages in this page (<code>include = *</code> does that) and then do a perl-like regexp on their contents to filter interesting pages (<code>includematch = ...</code>). If you are searching in translated pages (fx all Danish pages) it is often advantageous to have <code>namespace = Translations</code> set; otherwise you will get both all full pages and all translation units containing matching text &mdash; that could be a very long output.
     
    {{Input|1=<nowiki>
    <DPL>
      titlematch = %/da
      namespace = Translations
      include = *
      includematch = /albummet/
      resultsheader = Danish translation units containing the string "albummet"
      format = ,\n* [[%PAGE%|%TITLE%]]\n,,
    </DPL>
    </nowiki>}}
     
    <!--
    <DPL>
      titlematch = %/da
      namespace = Translations
      include = *
      includematch = /albummet/
      resultsheader = Danish translation units containing the string "albummet"
      format = ,\n* [[%PAGE%|%TITLE%]]\n,,
    </DPL>
    -->
     
    == All English pages linking to a given page ==
     
    {{Input|1=<nowiki>
    <DPL>
      linksto = Getting_Help
      nottitleregexp = .*(/..(-..)?|_[(].*[)])$
      resultsheader = There are %TOTALPAGES% pages linking to Getting Help. These are:\n
      format = ,\n* [[%PAGE%|%TITLE%]],,
    </DPL>
    </nowiki>}}
     
    Somehow this is broken! Should also list Welcome to KDE, but doesn't! Same problem with Special:WhatLinksHere.
     
    <!--
    -->
    <DPL>
      linksto = Getting_Help
      nottitleregexp = .*(/..(-..)?|_[(].*[)])$
      resultsheader = There are %TOTALPAGES% pages linking to Getting Help. These are:\n
      format = ,\n* [[%PAGE%|%TITLE%]],,
    </DPL>
     
    == All English pages linking to a given page (template version) ==
     
    The lesson here seems to be that, at least when include is involved, we can't rely on DPL handling more than one namespace at a time. This calls for a template: <nowiki>{{LinksTo|Getting[_ ]Help}} gives</nowiki>
     
    {{LinksTo|1=Getting[_ ]Help}}
     


    ==To count translated pages in a specific language:==
    ==To count translated pages in a specific language:==
    {{Input|1=<nowiki><DPL>
    {{Input|1=<nowiki><DPL>
       titlematch = %/bg
       titlematch = %/fi
       notnamespace = Translations
       notnamespace = Translations
       columns = 3
       columns = 2
       format = ,\n* [[%PAGE%|%TITLE%]],,
       format = ,\n* [[%PAGE%|%TITLE%]],,
       resultsheader = There are %TOTALPAGES% pages (partly) translated to Bulgarian. These are:\n
       resultsheader = There are %TOTALPAGES% pages (partly) translated to Finnish. These are:\n
    </DPL></nowiki>}}
    </DPL></nowiki>}}


    <DPL>
    <DPL>
       titlematch = %/bg
       titlematch = %/fi
       notnamespace = Translations
       notnamespace = Translations
       columns = 3
       columns = 2
       format = ,\n* [[%PAGE%|%TITLE%]],,
       format = ,\n* [[%PAGE%|%TITLE%]],,
       resultsheader = There are %TOTALPAGES% pages (partly) translated to Bulgarian. These are:\n
       resultsheader = There are %TOTALPAGES% pages (partly) translated to Finnish. These are:\n
    </DPL>
    </DPL>


    -----------------
    -----------------
    ==Kopete Subpages in 3 columns==
    ==Kopete Subpages in 3 columns==


    Line 48: Line 128:
    </DPL>
    </DPL>
    ---------------
    ---------------
    ==Archived pages==
    {{Input|1=<nowiki><DPL>
      titlematch = %
      namespace = Archive
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
    </DPL></nowiki>}}
    <DPL>
      titlematch = %
      namespace = Archive
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
    </DPL>
    ---------------
    ==NoIndexed pages==
    {{Input|1=<nowiki><DPL>
      titlematch = %
      category = Noindexed_pages
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
    </DPL></nowiki>}}
    <DPL>
      titlematch = %
      category = Noindexed_pages
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages in the Category:Noindexed_pages. These are:\n
    </DPL>
    ---------------
    ==Ignoring Deleted Pages==
    "As for DPL. If you hit a page with ?action=purge attached to the URL (i.e.
    http://en.wikinews.org/wiki/Template:Latest_news?action=purge ), it will
    dump all the removed pages."
    ==Remaining old-style translations==
    ==Remaining old-style translations==


    {{Input|1=<nowiki><DPL>
    {{Input|1=<nowiki><DPL>
       titlematch = %_(%)
       titlematch = %_(%)
       notnamespace = Translations
      notcategory = Template
       columns = 3
      notnamespace = Thread
       notnamespace = Summary
       columns = 2
       format = ,\n* [[%PAGE%|%TITLE%]],,
       format = ,\n* [[%PAGE%|%TITLE%]],,
       resultsheader = There are %TOTALPAGES% pages (partly) remaining in old-style translations. These are:\n
       resultsheader = There are %TOTALPAGES% pages (partly) remaining in old-style translations. These are:\n
    Line 60: Line 184:
    <DPL>
    <DPL>
       titlematch = %_(%)
       titlematch = %_(%)
       notnamespace = Translations
      notcategory = Template
       columns = 3
      notnamespace = Thread
       notnamespace = Summary
       columns = 2
       format = ,\n* [[%PAGE%|%TITLE%]],,
       format = ,\n* [[%PAGE%|%TITLE%]],,
       resultsheader = There are %TOTALPAGES% pages (partly) remaining in old-style translations. These are:\n
       resultsheader = There are %TOTALPAGES% pages (partly) remaining in old-style translations. These are:\n
    Line 70: Line 196:
    {{Input|1=<nowiki><DPL>
    {{Input|1=<nowiki><DPL>
       titlematch = %
       titlematch = %
       namespace = Main
       namespace =  
       uses = Template:I18n/Language Navigation Bar
       uses = Template:I18n/Language Navigation Bar
       columns = 3
       columns = 3
    Line 79: Line 205:
    <DPL>
    <DPL>
       titlematch = %
       titlematch = %
       namespace = Main
       namespace =  
       uses = Template:I18n/Language Navigation Bar
       uses = Template:I18n/Language Navigation Bar
       columns = 3
       columns = 3
    Line 90: Line 216:
    {{Input|1=<nowiki><DPL>
    {{Input|1=<nowiki><DPL>
       nottitlematch = %_(%)
       nottitlematch = %_(%)
       namespace = Main
       namespace =  
       uses = Template:I18n/Language Navigation Bar
       uses = Template:I18n/Language Navigation Bar
       columns = 3
       columns = 3
       format = ,\n* [[%PAGE%|%TITLE%]],,
       format = ,\n* [[%PAGE%|%TITLE%]],,
       resultsheader = There are %TOTALPAGES% pages that still display the old i18n language bar\n
       resultsheader = There are %TOTALPAGES% relevant pages that still display the old i18n language bar\n
    </DPL></nowiki>}}
    </DPL></nowiki>}}


    <DPL>
    <DPL>
       nottitlematch = %_(%)
       nottitlematch = %_(%)
       namespace = Main
       namespace =  
       uses = Template:I18n/Language Navigation Bar
       uses = Template:I18n/Language Navigation Bar
       columns = 3
       columns = 3
       format = ,\n* [[%PAGE%|%TITLE%]],,
       format = ,\n* [[%PAGE%|%TITLE%]],,
       resultsheader = There are %TOTALPAGES% pages that still display the old i18n language bar\n
       resultsheader = There are %TOTALPAGES% relevant pages that still display the old i18n language bar\n
    </DPL>
    </DPL>


    Line 109: Line 235:


    {{Input|1=<nowiki><DPL>
    {{Input|1=<nowiki><DPL>
       namespace = Main
       namespace =  
       lastrevisionbefore = 201007010000
       lastrevisionbefore = 201007010000
       columns = 2
       columns = 2
    Line 118: Line 244:


    <DPL>
    <DPL>
       namespace = Main
       namespace =  
       lastrevisionbefore = 201007010000
       lastrevisionbefore = 201007010000
       columns = 2
       columns = 2
    Line 124: Line 250:
       format = ,\n* (%DATE%) [[%PAGE%|%TITLE%]],,
       format = ,\n* (%DATE%) [[%PAGE%|%TITLE%]],,
       resultsheader = There are %TOTALPAGES% pages without recent updates\n
       resultsheader = There are %TOTALPAGES% pages without recent updates\n
    </DPL>
    == Listing Non-Translation Pages ==
    {{Input|1=<nowiki><DPL>
      nottitlematch = %/__|%/zh-%|%(%)
      titlematch = Amarok%
      namespace =
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% Amarok pages, not counting translations\n
    </DPL></nowiki>}}
    <DPL>
      nottitlematch = %/__|%/zh-%|%pt-%|%(%)
      titlematch = Amarok%
      namespace =
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% Amarok pages, not counting translations\n
    </DPL>
    == List all pages in a specific namespace ==
    {{Input|1=<nowiki><DPL>
      nottitlematch = %/__|%/zh-%|%pt-%|%(%)
      namespace = MediaWiki
      columns = 3
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = These %TOTALPAGES% pages are in the Mediawiki namespace\n
    </DPL></nowiki>}}
    <DPL>
      nottitlematch = %/__|%/zh-%|%pt-%|%(%)
      namespace = MediaWiki
      columns = 3
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = These %TOTALPAGES% pages are in the Mediawiki namespace\n
    </DPL>
    </DPL>

    Latest revision as of 03:18, 5 January 2013

    Reference: DPL Manual
    See also Pipesmoker's notes and this page of examples
    Example UI on this Template:Catlist page

    Finding pages marked "ToDo"

    <DPL>
      titlematch = %Kdenlive/Manual/%
      namespace = 
      include = *
      includematch = /ToDo/
      resultsheader = KDEnlive pages containing the string "ToDo"
      format = ,\n* [[%PAGE%|%TITLE%]]\n,,
    </DPL>
    



    Searching for pages containing a certain text string

    Matching content in pages: You need to include the contents of pages in this page (include = * does that) and then do a perl-like regexp on their contents to filter interesting pages (includematch = ...). If you are searching in translated pages (fx all Danish pages) it is often advantageous to have namespace = Translations set; otherwise you will get both all full pages and all translation units containing matching text — that could be a very long output.

    <DPL>
      titlematch = %/da
      namespace = Translations
      include = *
      includematch = /albummet/
      resultsheader = Danish translation units containing the string "albummet"
      format = ,\n* [[%PAGE%|%TITLE%]]\n,,
    </DPL>
    


    All English pages linking to a given page

    <DPL>
      linksto = Getting_Help
      nottitleregexp = .*(/..(-..)?|_[(].*[)])$
      resultsheader = There are %TOTALPAGES% pages linking to Getting Help. These are:\n
      format = ,\n* [[%PAGE%|%TITLE%]],,
    </DPL>
    

    Somehow this is broken! Should also list Welcome to KDE, but doesn't! Same problem with Special:WhatLinksHere.

    There are 16 pages linking to Getting Help. These are:

    All English pages linking to a given page (template version)

    The lesson here seems to be that, at least when include is involved, we can't rely on DPL handling more than one namespace at a time. This calls for a template: {{LinksTo|Getting[_ ]Help}} gives



    To count translated pages in a specific language:

    <DPL>
      titlematch = %/fi
      notnamespace = Translations
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages (partly) translated to Finnish. These are:\n
    </DPL>

    There are 25 pages (partly) translated to Finnish. These are:


    Kopete Subpages in 3 columns

    <DPL>
      titlematch = Kopete/%
      notnamespace = Translations
      columns = 3
      format = ,\n* [[%PAGE%|%TITLE%]],,
    </DPL>

    Akonadi Subpages in Danish

    <DPL>
      titlematch = Akonadi%/da
      notnamespace = Translations
      format = ,\n* [[%PAGE%|%TITLE%]],,
    </DPL>

    Archived pages

    <DPL>
      titlematch = %
      namespace = Archive
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
    </DPL>

    There are 749 pages in the Archive namespace. These are:


    NoIndexed pages

    <DPL>
      titlematch = %
      category = Noindexed_pages
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
    </DPL>

    There are 10 pages in the Category:Noindexed_pages. These are:


    Ignoring Deleted Pages

    "As for DPL. If you hit a page with ?action=purge attached to the URL (i.e. http://en.wikinews.org/wiki/Template:Latest_news?action=purge ), it will dump all the removed pages."

    Remaining old-style translations

    <DPL>
      titlematch = %_(%)
      notcategory = Template
      notnamespace = Thread
      notnamespace = Summary
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages (partly) remaining in old-style translations. These are:\n
    </DPL>

    There are 1067 pages (partly) remaining in old-style translations. These are:

    Pages with old i18n bar

    <DPL>
      titlematch = %
      namespace = 
      uses = Template:I18n/Language Navigation Bar
      columns = 3
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages that still display the old i18n language bar\n
    </DPL>


    Pages with old i18n bar but w/o old-way-translated ones

    <DPL>
      nottitlematch = %_(%)
      namespace = 
      uses = Template:I18n/Language Navigation Bar
      columns = 3
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% relevant pages that still display the old i18n language bar\n
    </DPL>


    Pages not updated since 1st July 2010

    <DPL>
      namespace = 
      lastrevisionbefore = 201007010000
      columns = 2
      ordermethod=lastedit
      format = ,\n* (%DATE%) [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% pages without recent updates\n
    </DPL>

    There are 17 pages without recent updates

    Listing Non-Translation Pages

    <DPL>
      nottitlematch = %/__|%/zh-%|%(%)
      titlematch = Amarok%
      namespace = 
      columns = 2
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = There are %TOTALPAGES% Amarok pages, not counting translations\n
    </DPL>

    There are 67 Amarok pages, not counting translations

    List all pages in a specific namespace

    <DPL>
      nottitlematch = %/__|%/zh-%|%pt-%|%(%)
      namespace = MediaWiki
      columns = 3
      format = ,\n* [[%PAGE%|%TITLE%]],,
      resultsheader = These %TOTALPAGES% pages are in the Mediawiki namespace\n
    </DPL>

    These 62 pages are in the Mediawiki namespace