(All English pages linking to a given page)
 
(42 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
<languages />
 +
 
: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]] and [http://semeb.com/dpldemo/index.php?title=Extension_DPL this page of examples]
 
: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]
 
:Example UI on [http://semeb.com/dpldemo/index.php?title=Template:Catlist this Template:Catlist page]
 +
:Search on [[User:Claus chr/Search|this page]]
  
-----------------
+
All the examples on this page have been commented out to prevent the page from being very slow to load. If you want to see the outcome of a search example, just edit the page and remove the comment tags around the desired example. You don't need to save the page, a preview will give you the search results; that way you can experiment with the examples and easily restore the page to its original state when you are done.
__NOTOC__
 
  
 
== Searching for pages containing a certain text string ==
 
== Searching for pages containing a certain text string ==
  
 +
=== Text without wiki markup ===
 +
 +
Enter <code><nowiki>{{Search|</nowiki>''text''<nowiki>}}</nowiki></code> anywhere to get the search results in the form of links. Here ''text'' can be plain text or a perl like regexp. Be careful to escape regexp meta characters. If the searched text contain wiki markup this template may nor give the desired results; see the next section.
 +
 +
The Search template searches only the main namespace, and only original English pages.
 +
 +
Example: To find all English pages containing the word 'application' - possibly capitalized enter this:
 +
{{Input|1=<nowiki>{{Search|[Aa]pplication}}</nowiki>}}
 +
<!--
 +
{{Search|[Aa]pplication}}
 +
-->
 +
 +
{{Info|1=The results should just be a link to each page containing the searched text. For some reason, however, some pages include the content at the beginning of the page, typically an info box, an image or tabular material. This can be avoided by ensuring that the pages searched start by <code><nowiki><languages /></nowiki></code>. If the page doesn't have translate tags this directive have no effect, but it prevents the unwanted inclusion of content from the page in the search result.}}
 +
 +
=== Translated text ===
 +
 +
Enter <code><nowiki>{{SearchLang|</nowiki>''text''<nowiki>|</nowiki>''lang''<nowiki>}}</nowiki></code> anywhere to get the search results in the form of links. Here ''text'' can be plain text or a perl like regexp and ''lang'' is a language code. Be careful to escape regexp meta characters. If the searched text contain wiki markup this template may nor give the desired results; see the next section.
 +
 +
Example: To find all Danish pages containing the word 'program' - possibly capitalized enter this:
 +
{{Input|1=<nowiki>{{SearchLang|[Pp]rogram|da}}</nowiki>}}
 +
<!--
 +
{{SearchLang|[Pp]rogram|da}}
 +
-->
 +
 +
=== Pages linking to a given page ===
 +
 +
Use <code><nowiki>{{LinksTo|</nowiki>''full page name''<nowiki>}}</nowiki></code>. The ''<tt>full page name</tt>'' must be the entire wiki link up to (but not including) one of the characters '|', ']' or '#' and excluding ''<tt>Special:myLanguage</tt>''. Note, that space characters in names are sometimes entered as '_', so in searches you should enter <code>[ _]</code> for spaces.
 +
 +
Example: To find all pages linking to [[Getting Help]] enter
 +
 +
{{Input|1=<nowiki>{{LinksTo|Getting[ _]Help}}</nowiki>}}
 +
<!--
 +
{{LinksTo|Getting[ _]Help}}
 +
-->
 +
 +
=== Text containing wiki markup ===
 +
 +
In case the Search  template does not work for you use code like this to accomplish your desired result:
 +
 +
{{Input|1=<nowiki>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^[A-J]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with A-J\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^K[A-Z]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with KA-KZ\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^K[a-ce-z]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz but not Kd\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^Kd
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with Kd\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^[L-Z]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with L-Z\n
 +
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^[A-J]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with A-J\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^K[A-Z]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with KA-KZ\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^K[a-ce-z]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz but not Kd\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^Kd
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with Kd\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^[L-Z]
 +
  include = *
 +
  includematch = @\{\{Remember\|@
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with L-Z\n
 +
</DPL>
 +
-->
 +
Normally, you'd want to copy all of this into your page and modify the <code>includematch</code> lines to the pattern you want to search for. Note the two <code>@</code>-characters; they mark the beginning and end of the actual search pattern. You can use any character instead of <code>@</code> as long as it does not appear in the actual pattern.
 +
 +
{{Note|1=Some characters such as <code>¤</code> do not work as pattern delimiters; perhaps only ASCII characters can be used?}}
 +
 +
{{Remember|2=Be aware!|1=The page count reported by each query is not the number of matching pages found, but the total number of pages searched in that group. That number should always be less than 500! If it is not then some of the pages will not have been searched.}}
 +
 +
If you want to search other namespaces than Main, just change that line. If you want to search the Main namespace and one or more other namespaces use <code>namespace = | Other</code>. The enpty string before the '|' means Main &mdash; ''never write <code>Main</code>''; that no longer works. <code>Other</code> can be one or more other namespaces separated by '|' characters.
 +
 +
The <code>nottitleregexp</code> lines filters out all translated pages including lingering old style translations and should not be touched. The <code>titlematch</code> lines are needed to split up the search into manageable chunks. There is a maximum of pages that can be handled by the <code>includematch</code> search; if too many pages pass through the title filters the first ones up to the maximum number will be searched; the rest will be silently ignored! Currently, the maximum seems to be somewhat more than 500. The <code>include</code> and <code>includemaxlength</code> should never be modified.
 +
 +
<!--
 
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.
 
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.
  
Line 13: Line 169:
 
<DPL>
 
<DPL>
 
   titlematch = %/da
 
   titlematch = %/da
   namespace = Translations
+
   namespace =  
 
   include = *
 
   include = *
 
   includematch = /[Aa]pplikation/
 
   includematch = /[Aa]pplikation/
Line 21: Line 177:
 
</DPL>
 
</DPL>
 
</nowiki>}}
 
</nowiki>}}
 
+
-->
 
<!--
 
<!--
 
<DPL>
 
<DPL>
 
   titlematch = %/da
 
   titlematch = %/da
   namespace = Translations
+
   namespace =  
 
   include = *
 
   include = *
   includematch = /.*[Aa]pplikation/
+
   includematch = /[Aa]pplikation/
 
   includemaxlength = 0
 
   includemaxlength = 0
 
   resultsheader = Danish translation units containing the string "applikation"
 
   resultsheader = Danish translation units containing the string "applikation"
Line 34: Line 190:
 
-->
 
-->
  
== All English pages linking to a given page ==
+
<!-- Won't work - see below
 +
== Searching for pages that hasn't been marked for translation ==
 +
 
 +
{{Input|1=<nowiki>
 +
<DPL>
 +
  nottitlematch = %/__|%/zh-%|%pt-%|%(%)
 +
  namespace = Main
 +
  include = *
 +
  includenotmatch = /<languages/
 +
  includemaxlength = 0
 +
  resultsheader = Pages that have not been marked up for translation
 +
  format = ,\n* [[%PAGE%|%TITLE%]]\n,,
 +
</DPL>
 +
</nowiki>}}
 +
-->
 +
 
 +
== Finding all pages not yet marked for translation ==
  
 
{{Input|1=<nowiki>
 
{{Input|1=<nowiki>
 
<DPL>
 
<DPL>
   namespace=Main |User
+
   namespace =  
   nottitleregexp = .*(/..(-..)?|_[(].*[)])$
+
   nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^[A-J]
 
   include = *
 
   include = *
   includematch = #\[\[[Ss]pecial\:[mM]y[lL]anguage/Getting[_ ]Help|\[\[Getting[_ ]Help#
+
   includenotmatch = #<languages[ ]?/>#
 
   includemaxlength = 0
 
   includemaxlength = 0
  resultsheader = The pages in the translation system linking to Getting Help are:\n
 
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with A-J\n
 
</DPL>
 
</DPL>
 +
...
 
</nowiki>}}
 
</nowiki>}}
  
 +
<!--
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^[A-J]
 +
  include = *
 +
  includenotmatch = #<languages[ ]?/>#
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with A-J\n
 +
</DPL>
 
<DPL>
 
<DPL>
   namespace=Main|User
+
   namespace =  
   nottitleregexp = .*(/..(-..)?|_[(].*[)])$
+
   nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^K[A-Z]
 
   include = *
 
   include = *
   includematch = #\[\[([Ss]pecial\:[mM]y[lL]anguage/)?Getting[_ ]Help#
+
   includenotmatch = #<languages[ ]?/>#
 
   includemaxlength = 0
 
   includemaxlength = 0
  resultsheader = The pages in the translation system linking to Getting Help are:\n
 
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with KA-KZ\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^K[a-ce-z]
 +
  include = *
 +
  includenotmatch = #<languages[ ]?/>#
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz but not Kd\n
 +
</DPL>
 +
<DPL>
 +
  namespace =
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^Kd
 +
  include = *
 +
  includenotmatch = #<languages[ ]?/>#
 +
  includemaxlength = 0
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz but not Kd\n
 
</DPL>
 
</DPL>
 
Somehow this is broken. Without the namespace clause we get
 
 
 
<DPL>
 
<DPL>
   nottitleregexp = .*(/..(-..)?|_[(].*[)])$
+
  namespace =
 +
   nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titleregexp = ^[L-Z]
 
   include = *
 
   include = *
   includematch = #\[\[([Ss]pecial\:[mM]y[lL]anguage/)?Getting[_ ]Help#
+
   includenotmatch = #<languages[ ]?/>#
 
   includemaxlength = 0
 
   includemaxlength = 0
  resultsheader = The pages in the translation system linking to Getting Help are:\n
 
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with L-Z\n
 
</DPL>
 
</DPL>
 +
-->
  
which excludes some pages in the main namespace(!) and includes on in the User namespace!? Explicitely specifying namespace main gives this.
+
== Find all templates using a given template ==
  
 +
{{Input|1=<nowiki>
 
<DPL>
 
<DPL>
   namespace = Main
+
   namespace = Template
  nottitleregexp = .*(/..(-..)?|_[(].*[)])$
 
 
   include = *
 
   include = *
   includematch = #\[\[([Ss]pecial\:[mM]y[lL]anguage/)?Getting[_ ]Help#
+
   includematch = /{{Icon/
 
   includemaxlength = 0
 
   includemaxlength = 0
  resultsheader = The pages in the translation system linking to Getting Help are:\n
 
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% templates using the Icon template\n
 
</DPL>
 
</DPL>
 +
</nowiki>}}
  
That seems reasonable, but weren't main supposed to be used by default? Finally, specifying namespace User gives us all three user pages:
+
<!--
 
 
 
<DPL>
 
<DPL>
   namespace=User
+
   namespace = Template
  nottitleregexp = .*(/..(-..)?|_[(].*[)])$
 
 
   include = *
 
   include = *
   includematch = #\[\[([Ss]pecial\:[mM]y[lL]anguage/)?Getting[_ ]Help#
+
   includematch = /{{Icon/
 
   includemaxlength = 0
 
   includemaxlength = 0
  resultsheader = The pages in the translation system linking to Getting Help are:\n
 
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% templates using the Icon template\n
 
</DPL>
 
</DPL>
 +
-->
  
=== All English pages linking to a given page (template version) ===
+
== Find discussion threads contributed by a user ==
  
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>
+
Perhaps more talk namespaces needs to be searched.
  
{{LinksTo|1=Getting[_ ]Help}}
+
{{Input|1=<nowiki>
 +
<DPL>
 +
  namespace = Talk | Thread
 +
  createdby = AmirHP
 +
</DPL>
 +
</nowiki>}}
  
So, to recap, the problem is this: We would like to find all pages that links to a given page (the target). The <code>What links here</code> wiki page does not work well with links adapted to the translation extension, i.e. links of the form <nowiki>[[Special:myLanguage/</nowiki>'''''target page'''''<nowiki>]]</nowiki>, which means that almost none of our links would be found.
+
<!---
 +
<DPL>
 +
  namespace = Talk | Thread
 +
  createdby = AmirHP
 +
</DPL>
 +
-->
  
Instead we have to use DPL to find those pages, but even here we have to be careful. The obvious search using the <code>linksto</code> clause doesn't work either, probably for the same reason that <code>What Links Here</code> failed. The solution is to search the content of every page for the occurrence of a link to the target page. The problem here is, that DPL has to write the entire content of a page into the page where the search occurs, then search the text, then filter out the text again (that's the <code>includemaxlength=0</code> part) and leave only links to the pages that contain a link to the target page.
+
== All English manual pages ==
  
For some reason, these kinds of query cause some confusion to DPL. Specifying no namespace should result in the main namespace beeing searched, but as we saw above, not every matching page in main was found, and oddly one User: page was found. Specifying both namespaces in one search seems to work better, but still misses a User: page. The solution seems to be one search for each namespace: that seems to find everything with one exception: The start page [[Welcome to KDE UserBase]] seems to be outside of namespaces, and is never found. Let's hope it is one of a kind.
+
{{Input|1=<nowiki>
 
+
<DPL>
This method of searching has been implemented as a template <nowiki>{{LinksTo|</nowiki>'''''target page'''''<nowiki>}}</nowiki> (which can easily be modified to include more namespaces in the search).
+
  titlematch = %/Manual%
Just to be clear: We are searching for the actual occurence of a link in the texts of pages. The search finds both Special:myLanguage links and old-style links. It tries to take every known variation into account (Special:, or special:, and mylanguage, Mylanguage, myLanguage, or MyLanguage). One variation we have to deal with by hand is, that spaces can be written either as a normal space chracter or as an underscore. Therefore we should either make to searches if the target name contains a space, or we could write <code>[_ ]</code> wherever a space occurs in the name, as in <code><nowiki>{{LinksTo|Getting[_ ]Help}}</nowiki></code>. Also note, that case is significant: <code><nowiki>{{LinksTo|getting[_ ]help}}</nowiki></code> yields
+
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 
+
  namespace = | User | Draft
{{LinksTo|getting[_ ]help}}
+
  resultsheader = Manual Pages:
----
+
  format = ,\n* [[%PAGE%|%TITLE%]]\n,,
We just get two error messages (one for each search), since DPL gives an error message whenever a text search finds no match on any page.
+
</DPL>
 
 
=== The template ===
 
 
 
The code of the first half of the template is here:
 
{{Input|<nowiki>
 
{{#dpl:
 
| namespace = Main
 
| nottitleregexp = .*(/..(-..)?{{!}}_[(].*[)])$
 
| include = *
 
| includematch = @\[\[([Ss]pecial\:[mM]y[lL]anguage/)?{{{1}}}(\]{{!}}\{{!}}{{!}}#)@
 
| includemaxlength = 0
 
| format = ,\n* [[%PAGE%|%TITLE%]],,
 
}}
 
 
</nowiki>}}
 
</nowiki>}}
  
The second half is the same, except that <code><nowiki>| namespace = Main</nowiki></code> is replaced by <code><nowiki>| namespace = User</nowiki></code>.
+
<!--
 +
<DPL>
 +
  titlematch = %/Manual%
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  namespace = | User | Draft
 +
  resultsheader = Manual Pages:
 +
  format = ,\n* [[%PAGE%|%TITLE%]]\n,,
 +
</DPL>
 +
-->
  
I couldn't make normal DPL tags work in the template, but fortunately the <code><nowiki>{{#dpl</nowiki></code> parser function does work. To add more namespaces just add a copy of the first half of the template to then end, and in the copy replace <code><nowiki>| namespace = Main</nowiki></code> by <code><nowiki>| namespace = Whatever</nowiki></code>. From the DPL documentation you might think that to search the Main namespace, you could leave out the <code>namespace</code> caluse altogether: That is not a good idea &mdash; in this context, it gets DPL confused so that it misses pages!
+
== All English pages linking to a given page ==
  
The <code>nottitleregexp</code> clause filters out any page whoes path ends in <tt>/xx</tt>, <tt>/xx-xx</tt>, or <tt>_(x..)</tt>, ie. it filters out all translated pages, both old and new. Since the pipe character has special meaning in a template, it has to be entered as <nowiki>{{!}}</nowiki>.
+
{{Input|1=<nowiki>{{LinksTo|Plasma/Panels}}</nowiki>}}
  
The <code>includematch</code> clause is a perl regexpr, that matches text of the form <tt><nowiki>[[Special:myLanguage/</nowiki>''page path''</tt> followed by either a '<nowiki>]</nowiki>', a '<nowiki>|</nowiki>', or a '#' character. We take into account that the S, the M, and the L of <tt>Special:MyLanguage</tt> are sometimes capitalized, and sometimes not.
+
<!--
 
+
{{LinksTo|Plasma/Panels}}
The <code>includemaxlength = 0</code> is to prevent DPL from entering (parts of) the content of the matched pages into the page containing the query.
+
-->
 
 
=== Testing the template ===
 
 
 
<code><nowiki>{{LinksTo|User:Claus[_ ]chr}}</nowiki></code>{{LinksTo|User:Claus[_ ]chr}}
 
 
 
Problem nr. 1. We also find links to subpages of the target (doh!), but that should be simple to fix. (The error message just means that there were no linking pages in the Main namespace.)
 
 
 
<code><nowiki>{{LinksTo|Amarok}}</nowiki></code>{{LinksTo|Amarok}}
 
 
 
Yes! There must be thousands of pages linking to some subpage of Amarok. They are obviously not found. Now can I find this link to [[Talk:Translation Workflow]]?
 
 
 
<code><nowiki>{{TestLinksTo|Talk:Translation[_ ]Workflow}}</nowiki></code>{{TestLinksTo|Talk:Translation[_ ]Workflow}}
 
 
 
This page is not found, but it is found if the same query is performed in another page! I guess, I should have expected that, given the way these queries are performed. Otherwise the page would have to include itself, which could lead to problems.
 
 
 
<code><nowiki>{{LinksTo|Amarok/Manual}}</nowiki></code>{{LinksTo|Amarok/Manual}}
 
 
 
So we can find subpages &mdash; good thing too!
 
  
 
==Kopete Subpages in 3 columns==
 
==Kopete Subpages in 3 columns==
Line 162: Line 355:
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  titlematch = Kopete/%
 +
  notnamespace = Translations
 +
  columns = 3
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
</DPL>
 +
-->
  
 
==Akonadi Subpages in Danish==
 
==Akonadi Subpages in Danish==
Line 170: Line 372:
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  titlematch = Akonadi%/da
 +
  notnamespace = Translations
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
</DPL>
 +
-->
  
 
==Archived pages==
 
==Archived pages==
Line 180: Line 390:
 
   resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
 
   resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
 
</DPL></nowiki>}}
 
</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==
 
==NoIndexed pages==
Line 187: Line 407:
 
   columns = 2
 
   columns = 2
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
   resultsheader = There are %TOTALPAGES% pages in the Archive namespace. These are:\n
+
   resultsheader = There are %TOTALPAGES% pages in the Noindexed_pages category. These are:\n
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  titlematch = %
 +
  category = Noindexed_pages
 +
  columns = 2
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages in the Noindexed_pages category. These are:\n
 +
</DPL>
 +
-->
  
 
==Ignoring Deleted Pages==
 
==Ignoring Deleted Pages==
Line 198: Line 428:
  
 
{{Input|1=<nowiki><DPL>
 
{{Input|1=<nowiki><DPL>
   titlematch = %_(%)
+
   titleregexp = .*(([ _][(][a-z][a-z](...)?[)]))$
 
   notcategory = Template
 
   notcategory = Template
 
   notnamespace = Thread
 
   notnamespace = Thread
Line 206: Line 436:
 
   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
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  titleregexp = .*(([ _][(][a-z][a-z](...)?[)]))$
 +
  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>
 +
-->
  
 
==Pages with old i18n bar==
 
==Pages with old i18n bar==
Line 211: Line 453:
 
{{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 218: Line 460:
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
  
 +
<!--
 +
<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==
 
==Pages with old i18n bar but w/o old-way-translated ones==
  
 
{{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
Line 228: Line 480:
 
   resultsheader = There are %TOTALPAGES% relevant 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>
 +
  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==
 
==Pages not updated since 1st July 2010==
  
 
{{Input|1=<nowiki><DPL>
 
{{Input|1=<nowiki><DPL>
   namespace = Main
+
   namespace =  
 
   lastrevisionbefore = 201007010000
 
   lastrevisionbefore = 201007010000
 
   columns = 2
 
   columns = 2
Line 239: Line 502:
 
   resultsheader = There are %TOTALPAGES% pages without recent updates\n
 
   resultsheader = There are %TOTALPAGES% pages without recent updates\n
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  namespace =
 +
  lastrevisionbefore = 201007010000
 +
  columns = 2
 +
  ordermethod=lastedit
 +
  format = ,\n* (%DATE%) [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages without recent updates\n
 +
</DPL>
 +
-->
  
 
== Listing Non-Translation Pages ==
 
== Listing Non-Translation Pages ==
 
{{Input|1=<nowiki><DPL>
 
{{Input|1=<nowiki><DPL>
   nottitlematch = %/__|%/zh-%|%(%)
+
   nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 
   titlematch = Amarok%
 
   titlematch = Amarok%
   namespace = Main
+
   namespace =  
 
   columns = 1
 
   columns = 1
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   resultsheader = There are %TOTALPAGES% Amarok pages, not counting translations\n
 
   resultsheader = There are %TOTALPAGES% Amarok pages, not counting translations\n
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  titlematch = Amarok%
 +
  namespace =
 +
  columns = 1
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% Amarok pages, not counting translations\n
 +
</DPL>
 +
-->
  
 
== List all pages in a specific namespace ==
 
== List all pages in a specific namespace ==
  
 
{{Input|1=<nowiki><DPL>
 
{{Input|1=<nowiki><DPL>
   nottitlematch = %/__|%/zh-%|%pt-%|%(%)
+
   nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 
   namespace = MediaWiki
 
   namespace = MediaWiki
 
   columns = 3
 
   columns = 3
Line 259: Line 544:
 
   resultsheader = These %TOTALPAGES% pages are in the Mediawiki namespace\n
 
   resultsheader = These %TOTALPAGES% pages are in the Mediawiki namespace\n
 
</DPL></nowiki>}}
 
</DPL></nowiki>}}
 +
 +
<!--
 +
<DPL>
 +
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
 +
  namespace = MediaWiki
 +
  columns = 3
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = These %TOTALPAGES% pages are in the Mediawiki namespace\n
 +
</DPL>
 +
-->
  
 
==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 = %/en
+
   titleregexp = ^[A-J].*/en
 
   notnamespace = Translations
 
   notnamespace = Translations
 
   columns = 3
 
   columns = 3
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   resultsheader = There are %TOTALPAGES% pages (partly) translated to English. These are:\n
 
   resultsheader = There are %TOTALPAGES% pages (partly) translated to English. These are:\n
</DPL></nowiki>}}
+
</DPL>
 +
...
 +
</nowiki>}}
  
 +
<!--
 
<DPL>
 
<DPL>
   titlematch = %/en
+
   titleregexp = ^[A-J].*/en
 
   notnamespace = Translations
 
   notnamespace = Translations
 
   columns = 3
 
   columns = 3
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
 
   format = ,\n* [[%PAGE%|%TITLE%]],,
   resultsheader = There are %TOTALPAGES% pages (partly) translated to English. These are:\n
+
   resultsheader = There are %TOTALPAGES% pages beginning with A-J (partly) translated to English. These are:\n
 +
</DPL>
 +
<DPL>
 +
  titleregexp = ^K[A-Z].*/en
 +
  notnamespace = Translations
 +
  columns = 3
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with KA-KZ (partly) translated to English. These are:\n
 +
</DPL>
 +
<DPL>
 +
  titleregexp = ^K[a-z].*/en
 +
  notnamespace = Translations
 +
  columns = 3
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz (partly) translated to English. These are:\n
 +
</DPL>
 +
<DPL>
 +
  titleregexp = ^[L-Z].*/en
 +
  notnamespace = Translations
 +
  columns = 3
 +
  format = ,\n* [[%PAGE%|%TITLE%]],,
 +
  resultsheader = There are %TOTALPAGES% pages beginning with L-Z (partly) translated to English. These are:\n
 
</DPL>
 
</DPL>
 +
-->

Latest revision as of 07:55, 3 November 2018


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

All the examples on this page have been commented out to prevent the page from being very slow to load. If you want to see the outcome of a search example, just edit the page and remove the comment tags around the desired example. You don't need to save the page, a preview will give you the search results; that way you can experiment with the examples and easily restore the page to its original state when you are done.

Searching for pages containing a certain text string

Text without wiki markup

Enter {{Search|text}} anywhere to get the search results in the form of links. Here text can be plain text or a perl like regexp. Be careful to escape regexp meta characters. If the searched text contain wiki markup this template may nor give the desired results; see the next section.

The Search template searches only the main namespace, and only original English pages.

Example: To find all English pages containing the word 'application' - possibly capitalized enter this:

{{Search|[Aa]pplication}}
Dialog-information.png
Information
The results should just be a link to each page containing the searched text. For some reason, however, some pages include the content at the beginning of the page, typically an info box, an image or tabular material. This can be avoided by ensuring that the pages searched start by <languages />. If the page doesn't have translate tags this directive have no effect, but it prevents the unwanted inclusion of content from the page in the search result.


Translated text

Enter {{SearchLang|text|lang}} anywhere to get the search results in the form of links. Here text can be plain text or a perl like regexp and lang is a language code. Be careful to escape regexp meta characters. If the searched text contain wiki markup this template may nor give the desired results; see the next section.

Example: To find all Danish pages containing the word 'program' - possibly capitalized enter this:

{{SearchLang|[Pp]rogram|da}}

Pages linking to a given page

Use {{LinksTo|full page name}}. The full page name must be the entire wiki link up to (but not including) one of the characters '|', ']' or '#' and excluding Special:myLanguage. Note, that space characters in names are sometimes entered as '_', so in searches you should enter [ _] for spaces.

Example: To find all pages linking to Getting Help enter

{{LinksTo|Getting[ _]Help}}

Text containing wiki markup

In case the Search template does not work for you use code like this to accomplish your desired result:

<DPL>
  namespace = 
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  titleregexp = ^[A-J]
  include = *
  includematch = @\{\{Remember\|@
  includemaxlength = 0
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages beginning with A-J\n
</DPL>
<DPL>
  namespace = 
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  titleregexp = ^K[A-Z]
  include = *
  includematch = @\{\{Remember\|@
  includemaxlength = 0
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages beginning with KA-KZ\n
</DPL>
<DPL>
  namespace = 
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  titleregexp = ^K[a-ce-z]
  include = *
  includematch = @\{\{Remember\|@
  includemaxlength = 0
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages beginning with Ka-Kz but not Kd\n
</DPL>
<DPL>
  namespace = 
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  titleregexp = ^Kd
  include = *
  includematch = @\{\{Remember\|@
  includemaxlength = 0
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages beginning with Kd\n
</DPL>
<DPL>
  namespace = 
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  titleregexp = ^[L-Z]
  include = *
  includematch = @\{\{Remember\|@
  includemaxlength = 0
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages beginning with L-Z\n
</DPL>

Normally, you'd want to copy all of this into your page and modify the includematch lines to the pattern you want to search for. Note the two @-characters; they mark the beginning and end of the actual search pattern. You can use any character instead of @ as long as it does not appear in the actual pattern.

Note-box-icon.png
Note
Some characters such as ¤ do not work as pattern delimiters; perhaps only ASCII characters can be used?


Flag-red.png
Be aware!
The page count reported by each query is not the number of matching pages found, but the total number of pages searched in that group. That number should always be less than 500! If it is not then some of the pages will not have been searched.


If you want to search other namespaces than Main, just change that line. If you want to search the Main namespace and one or more other namespaces use namespace = | Other. The enpty string before the '|' means Main — never write Main; that no longer works. Other can be one or more other namespaces separated by '|' characters.

The nottitleregexp lines filters out all translated pages including lingering old style translations and should not be touched. The titlematch lines are needed to split up the search into manageable chunks. There is a maximum of pages that can be handled by the includematch search; if too many pages pass through the title filters the first ones up to the maximum number will be searched; the rest will be silently ignored! Currently, the maximum seems to be somewhat more than 500. The include and includemaxlength should never be modified.


Finding all pages not yet marked for translation

<DPL>
  namespace = 
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  titleregexp = ^[A-J]
  include = *
  includenotmatch = #<languages[ ]?/>#
  includemaxlength = 0
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages beginning with A-J\n
</DPL>
...


Find all templates using a given template

<DPL>
  namespace = Template
  include = *
  includematch = /{{Icon/
  includemaxlength = 0
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% templates using the Icon template\n
</DPL>


Find discussion threads contributed by a user

Perhaps more talk namespaces needs to be searched.

<DPL>
  namespace = Talk | Thread
  createdby = AmirHP
</DPL>


All English manual pages

<DPL>
  titlematch = %/Manual%
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  namespace = | User | Draft
  resultsheader = Manual Pages:
  format = ,\n* [[%PAGE%|%TITLE%]]\n,,
</DPL>


All English pages linking to a given page

{{LinksTo|Plasma/Panels}}


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>


NoIndexed pages

<DPL>
  titlematch = %
  category = Noindexed_pages
  columns = 2
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages in the Noindexed_pages category. 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

<DPL>
  titleregexp = .*(([ _][(][a-z][a-z](...)?[)]))$
  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>


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>


Listing Non-Translation Pages

<DPL>
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  titlematch = Amarok%
  namespace = 
  columns = 1
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% Amarok pages, not counting translations\n
</DPL>


List all pages in a specific namespace

<DPL>
  nottitleregexp = .*((/[a-z][a-z](.|-..)?)|([ _][(][a-z][a-z](...)?[)]))$
  namespace = MediaWiki
  columns = 3
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = These %TOTALPAGES% pages are in the Mediawiki namespace\n
</DPL>


To count translated pages in a specific language:

<DPL>
  titleregexp = ^[A-J].*/en
  notnamespace = Translations
  columns = 3
  format = ,\n* [[%PAGE%|%TITLE%]],,
  resultsheader = There are %TOTALPAGES% pages (partly) translated to English. These are:\n
</DPL>
...



This page was last edited on 3 November 2018, at 07:55. Content is available under Creative Commons License SA 4.0 unless otherwise noted.