Issue:Including Sections

From FollowTheScore
Jump to: navigation, search
Description: Trying to include sections that have a link in their headline
Extension / Version: DPL   /   1.4.2
Type / Status: Bug   /   resolved in 1.4.3

Problem

I'm trying to include particular sections with 'include' and the section headers are links. So I use {{#dpl:titlematch=%Bug Reports%Include%|include=#[[Link]]}} and I get an error.

Reply

The problem is that the parser converts the double brackets into a hyperlink before the text is used as a search criterion within DPL. I will look if there is a way around this. Gero 23:26, 27 September 2007 (CEST)

Reply(2)

Please download the latest version (1.4.3) and use the following trick:

{{#dpl:titlematch=%Bug Reports%Include%|include=##.\[Link\].}} 

This will produce the expected result. The double '##' means that the text shall be used as a regular expression. Within the regexp you must escape the '['. But you must NOT try something like \[\[Link\]\] although this looks quite reasonable. DPL would misunderstand that as range specification (the include statement accepts a character range to delimit the output size). By makingthe last character a dot (".") we circumvent that and the regexp still matches.

Reply to reply

I can still make the script give me an error: "Warning: preg_match() [function.preg-match]: Unknown modifier '0' in .../semeb/DynamicPageList/DynamicPageList2Include.php on line 285". I'm actually trying to get something more complicated to work. On a page, I have a variety of template calls to a certain template like {{foo|arg1|blah}} {{foo|arg2|whatever}} .... Template foo looks like:

==[[{{{1}}}]]==
{{{2}}}

Now I want to summarize all the sections that call template foo with arg1 (and not with arg2). So I can select pages based on those that use template foo and link to arg1, i.e. {{#dpl:uses=Template:Foo|linksto=arg1}}, but now I also want to include the text that's within that section so I try to include that section as described above and it doesn't work. In fact, it doesn't seem like DPL sees the heading at all when it's generated from the template. If there's a better way to do this, let me know.

Reply to reply (2)

I you use a regex you will always be able to provoke syntax errors. If your regex contains a mistake that´s no surprise. Btw: I would consider this an expert feature.

Mediawiki has general problems with dynamically generated chapters. If you try section-editing on a document that uses templates to generate sections you will be surprised what happens.

DPL uses the plain source of an article when it analyses its text. That is why you never will "see" chapter headlines generated by templates. I ran into the same problem and decided to have the heading within the main article and use templates (only) to produce the chapter´s contents. That works fine. Summarizing sections then means to use DPL include and includematch. You should use includematch to select the template invocations with "arg1", that is much more efficient and the includematch statement is exactly meant to be used for that purpose.

Gero 12:16, 29 September 2007 (CEST)