Issue:Include section always shows all articles in category

From FollowTheScore
Jump to: navigation, search
Description: The output of the include statement isn't restricted to articles which actually contain the required section (chapter).
Extension / Version: DPL   /   1.8.9
Type / Status: Change Request   /   open


I want to create an overview page for a recurring topic by pulling all relevant content from the minutes of meetings like so:

  category = meeting
  include  = #topic

That does the trick but also lists all the meetings where the topic wasn't on the agenda. Trying to restrict the output by using a filter also doesn't work.

Expected behavior

Using "1" as a limit will only show the link (if the corresponding chapter in the article is not empty), "0" will not show anything, not even the link.
DPL:Manual - DPL parameters: Controlling output volume#include

I've already reported this issue in the forum: DPL: Restrict output when using "include" for sections

--nakohdo 18:11, 16 February 2011 (CET)


The manual may be not very precise, but it lists the "include" statement under the group "output volume control". This implies that it does NOT and MUST NOT affect the selection process. Specifying a limit restricts the output of other CONTENT but does not suppress mentioning the article's name.

If you only want to see articles where the "topic" chapter is present you must add a suitable includematch condition. You are totally free to design the regexp of "includematch" according to your needs. It will be matched against the whole wiki text of he article.

Gero 19:50, 16 February 2011 (CET)

Thanks for the prompt reply and the clarification! The problem with "includematch" is that it only matches against the content of the section BUT NOT the section's heading, e.g. there might be a section with the heading "Vacation planning" which I would like to be included, but the string "vacation planning" doesn't occur within the text of the section so "includematch" won't include it. I now use a workaround which filters out the empty links using jQuery. --nakohdo 20:14, 16 February 2011 (CET)
If your article contains the desired heading as an "empty chapter" you could use a regexp which matches against non-space characters, i.e. something like [^\s\n] Gero 08:38, 18 February 2011 (CET)
Thanks for the tip. I will try that. EDIT: Cool, that does the trick, many thanks! Only a quantifier seems to be needed: [includematch = /^\s*\n/] --nakohdo 18:24, 18 February 2011 (CET)
IMHO both use cases are valid so I changed this from a bug report to a "Change Request". What about an "inclusive include" and an "exclusive include"? --nakohdo 11:53, 18 February 2011 (CET)


The following DPL code re-creates the default DPL output but links directly to the section (see also --nakohdo 17:33, 11 July 2011 (CEST)

 | category   = meeting
 | include   = #{{PAGENAME}}
 | includematch = /^\s*\n/
 | format = <ul>,<li>[[%PAGE%#{{PAGENAME}} | %PAGE% ]],</li>,</ul>