DPL talk:Manual - DPL parameters: Controlling output volume

From FollowTheScore
Revision as of 22:23, 18 December 2010 by Theaitetos (talk | contribs) (Transclusion from redirect pages)
Jump to: navigation, search

Special Tags

Hi, the manual says: "a text portion which is marked by special tags named "foo"", but there is not explanation how to put a marker tag foo in all the articles which appear in DPL listing. Janek Kozicki


10 lines above the manual refers to LabeledSectionTransclusion. Read that. Gero 08:32, 10 October 2007 (CEST)

Include and Template Parameters

What if a page includes a particular template or page more than once. Is there a way to specify the parameters of the nth call to said template? —Sledged (talk) 06:13, 10 October 2007 (CEST)


This sounds rather exotic. You can apply a regexp to the call parameters for filtering - and I guess that the n-th template invocation can be recognized by some difference in the parameters from the (n-1)th invocation ... Isn´t that enough?

Gero 08:32, 10 October 2007 (CEST)
I'm not sure I understand how that'd work. Can you give an example? —Sledged (talk) 00:28, 24 October 2007 (CEST)
If you call a template 10 or twenty times from an article: Why would you want to extract exactly the 10th invocation? I would assume that you are more interested in certain parameter constellations instead of the position of the template call ... Unless you give a convincing example I can´t see why we should count template invocations ..
To pick a template call based on the argument values it uses the includematch statement can be used. Gero 23:57, 25 October 2007 (CEST)
I wasn't actually saying that it should count template invocations. I was merely asking (in not so many words) "Does it count template invocations?" Going by your response, I'm guessing no.
In most situations I probably wouldn't want the nth invocation of a template, unless I wanted to randomly select one of invocations for sampling or such. However, I could see wanting to get the first n invocations or the last i invocations.
Also, without a means to select a specific template invocation, which one is selected if multiple ones exist? The first? The last? All? Randomized? Undefined? —Sledged (talk) 22:05, 8 November 2007 (CET)
I have been looking for that functionality. We have pages with the same template used more that once. For example, to add a section of text in a particular format, we have
{{Project detail
type=description
content=...
}}
{{Project detail
type=purpose
content=...
}}
I would like to include only calls to the {{Project detail}} template where the type=description. --Stc user 18:06, 13 May 2008 (CEST)
I tried includematch and includematchparsed with no luck. Should I add this as a new feature request? --Stc user 18:20, 13 May 2008 (CEST)
to Stc user: You are talking about a standard fuctionality of DPL, which is already available. There are examples i this wiki that show how to do it; read the manual... --Gero

include Parameter and Labeled Section Transclusion

Aside from it being integrated with DPL2, how much functionality has been added to DPL2's version of Labeled Section Transclusion? Is it possible to achieve everything that the include parameter does by nesting a {{#lst:}} call in the {{#dpl:}} call?

|format=,,\n¦²{#lst:%PAGE%¦%0[100]}²\n¦align=right¦%COUNT%\n,

Also, does either version of Labeled Section Transclusion interact with the <includeonly> and <noinclude> tags? —Sledged (talk) 20:17, 27 November 2007 (CET)

Never mind, found the answer for myself: "No." —Sledged (talk) 20:30, 27 November 2007 (CET)

Version of Labeled Section Transclusion

From what version of Labeled Section Transclusion did DPL2's version branch? —Sledged (talk) 20:53, 27 November 2007 (CET)

This was roughly one year ago. And as far as I am aware of, Labeled Section Transclusion (LST) wasn´t changed very much after that time. But the version within DPL underwent quite some changes. While still being downward compatible (I hope) it can handle a lot more than just pull in text that is enclosed between special markers. The last feature which was (half-heartedly I would say) adopted by LST was the ability to transclude sections (paragraphs) based on their heading. Steve Sanbeg felt that headlines might not be stable enough to serve as a reference point for contents transclusion ... --Gero 21:26, 27 November 2007 (CET)

include: Retrieving the nth Section

I'm looking at the method DPL2Include::extractHeadingFromText and there's a comment that says "check if we are going to fetch the n-th section." Is this the functionality of section ranges, or is it something else. If it's something else, I don't see any documentation of this functionality. —Sledged (talk) 22:18, 30 November 2007 (CET)

Nevermind. "Section" in the comments context refers to what's called "chapter" in the manual. TODO: Make terms in comments and manual uniform. —Sledged (talk) 22:24, 30 November 2007 (CET)
sadly, yes. Terminolgy is not consistent. I´m afraid sometimes you can also find 'paragraph', too. Gero 00:30, 1 December 2007 (CET)

$to Argument in DPL2Include::extractHeadingFromText

Did you have a specific syntax in mind for invoking this parameter? In the code, every call to this method sets the $to parameter to an empty string. —Sledged (talk) 18:48, 24 December 2007 (CET)

No, I took it from the original source of LabeledSectionTransclusion and didn`t need it but could not make up my mind to delete it. Gero 23:37, 25 December 2007 (CET)

Exclude images and other wikicode

Is there way to exclude Images and other wikicode wenn using the tag: include=*

No, you get the full wiki code. If you were able to write a single regular expression which "cleans" the code in the way you want, I might be able to add an option which runs an arbitrary regexp against the result of include=* before returning and expanding it. I suggest that you try patching the code with a hardcoded regex and then let us know ... Gero 22:02, 20 June 2008 (CEST)

Ofcourse deleting the images with preg_replace depends on the language. Maybe you can use variables like this in the LocalSettings?

$patterns[0] = '/\[\[Afbeelding:.*\]\]/';

$patterns[1] = '/\[\[Image:.*\]\]/';

$patterns[2] = '/<.*/.*>/'; //Delete all wikicode from extensions like youtube and maps

etc.

Restrict include to a number of paragraphs

Like the previous user, I noticed that include=# often not returns something usefull. I would suggest to add something like include=#%0[100:n] that should include only the first 100 chars of the first n-paragraphs. n=1 is the intended use, because the space between paragraphs does not look good in tables, when the row height should be small. Also an additional regex would be usefull. --Logiker 13:36, 5 September 2009 (UTC)

Reply

I noticed the problem mentioned above when I set up a proof of Concept for dpl in the German Wikipedia. I added the possibility to filter content by a regexp. This may not in all cases be enough but it is a useful first step. The release containing this feature is not yet published. But you may see how it works under http://sesam.dyndns.info:60300/dewiki. I use a regular expression which is horrible but quite nice - as it recognizes nested templates and single (balanced) brackets and curly braces, see http://sesam.dyndns.info:60300/dewiki/index.php/Info:Vorlage/Skip_Template

Does anyone think we should be able to use more than regexp? I think this would be the wrong way.

The symbol #%0 refers to the first piece of text that does not have a preceding headline. Usually this should be kind iof a summary of the article. Would you like to see the beginning of separate paragraphs of this text? Or are you talking about showing the beginning of the first n chapters? This can be done with the current syntax althoug it will probably not be very efficient: use include=%0[100],%1[100],%2[100],%3[100].

But then you may want to see the name of the chapter, you want to ignore all or some templates, exclude certain XML-tags etc, throw away comments, ...

Is there something like a general "strip" tool which I could call or embed? I think it would make more sense to delegate the job of "finding the essential text" of an article to a specialized component.

Gero 18:09, 6 September 2009 (UTC)

Comment to my concern

I spoke about paragraphs of one chapter, not about various chapters. What I want to do, is to show the beginning of a chapter until a certain number of character or the end of the first paragraph. ~~----

Heading/chapter and marker inclusion

I can't seem to get either of these to work for a page I'm trying to build.

Offending Page: http://castleoubliette.com/wiki/index.php?title=Item_Repository Template for page: http://castleoubliette.com/wiki/index.php?title=Template:Item_Repository The template for pages to be included: http://castleoubliette.com/wiki/index.php?title=Template:Resources

The problem seems to be that DPL can't find headings created by the resources template in resource pages. I tried to use the LST method to mark them and include them that way, but that doesn't seem to function either.

What I want to do is use a template to build a resource, have the template calculate a value using ParserFunctions and include that value in a table of articles of the same kind.

Is there another way to do this, besides having people manually calculate and enter the values in the template?

http://castleoubliette.com/wiki/index.php?title=Special:Version --Arcandio 01:52, 15 August 2008 (CEST)

Reply

Due to some limitations in the mediawiki template expansion concept it is not possible to generate headings with a template a find these templates with a scanning tool like DPL.

You can solve your problem by using a surrogate template (say "Template:Resource.overview"} which you must tell DPL to use instead of your original "Template:Resource". This template can make the same calculation as the original template and it can display the result within the DPL result. You might even put the formula into a sub-template which is used by the original template and by the surrogate template.

I tried to show you the concept, see http://castleoubliette.com/wiki/index.php?title=Item_Repository_2.

There is still a problem with the formatting but I am sure you will get that correct yourself. Have fun! Gero 15:39, 15 August 2008 (CEST)

Included pages with Categories

Im using DPL/include to make some kind of news page. The page shows the first 200 letters from articles recently changed. These articles have several categorie tags. Is there a way to prevent the inclusion from adding these categorie tags to my news page and thus add the categories to my news page? Tobe 14:23, 30 August 2008 (CEST)

YES, read the manual: reset, eliminate Gero 06:15, 31 August 2008 (UTC)


noresultsheader set to empty string

Per the page, Setting noresultsheader to the empty string ("noresultsheader=") will suppress the warning message from DPL" which is normally issued if no articles were found., this should work, but it isn't working for me. I continue to get the No Results! DPL error. Something on my end or bug? glitch25 21:58, 9 September 2008 (UTC)

This may be a problem in the current version. Try setting "noresultsheader=\n" or use the &nbsp;. These characters shouldn´t do any harm and at least that works as you can see here:

Extension:DynamicPageList (DPL), version 3.2.1: Warning: No results.

and now the same with noresultsheader=\n   (can you see the empty output? ;-))

Gero 22:31, 9 September 2008 (UTC)
That works for me for now. Thank you!
glitch25 23:01, 9 September 2008 (UTC)

Transcluding sections with () parenthesis

First: great extension! One comment though: I've struggled with the "format" parameter before finding the "table" parameter. This section should be more prominent in the manual.

Now my question: I'm trying to transclude a section whose name is CPU speed (GHz).

  • If I type #CPU speed (GHz) in the "include" parameter the Publish/Preview leads to a blank page, losing my modifications. * I tried escaping the parenthesis like this: #CPU speed \(GHz\). The Publishing works but the section is not transcluded. Of course I've read http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion without finding any mention of character restriction in the section titles.
Thanks for your comment. I added a note to the format section in the manual which mentions the table command.
Indeed there seems to be a problem with parenthesis handling - I will try to find the reason. As a workaround you can use something like
include=##CPU speed.*
Using a regexp match you can avoid to mention the parenthesis within the include command. --Gero 10:23, 22 January 2010 (UTC)

Include and Template Parameters (II)

Just a side note on something I discovered recently. If you have a template parameter with symbols in it like the open and closing parenthesis characters (like perhaps "(s)" is at the end of it), then you will need to escape the symbols with a backslash character since DPL is using regular expression matching to find and include the template parameter. Perhaps something about that could be added to the documentation.--Volts 04:54, 1 March 2010 (UTC)


Include #Chapter Name and exclude page link

Using dpl include function to pull a section of a page:

<dpl>
namespace=Help
include=#Article-Table
</dpl>

However, the retrieved content includes a link the page as well. I don't want this link to appear:

Is there a way to exclude this link? Formatting?

Use the surrogate mechanism and you get control over formatting. See the manual DPL:Manual_-_DPL_parameters:_Controlling_output_volume#include_parser_function_calls Gero 05:20, 22 August 2010 (UTC)

Transclusion from redirect pages

Hi, is it possible to include contents of a redirect page? I've build a template for language-based redirects in our wiki, but whenever I use the include statement it only ever includes stuff from the destination of the redirect and never stuff from the redirect itself. For example, I have the page Berliner Mauer that redirects to Berlin Wall; now I've put the template {{Translation|Language=German|Redirect=Berlin Wall|Note=Historic symbol of oppression in communism|Source=Wikipedia.de}} on the redirect page, so that I can create a table that shows all German expressions, and includes the page that it links to, a little note and noteworthy sources. Until then I wish everyone a merry x-mas! --Theaitetos 14:56, 17 December 2010 (UTC)

I think MediaWiki ignores all content of a page taht starts with #redirect.
Please demonstrate exactly in this wiki what you have been doing in your wiki - then we can try to find out if there is a way. Btw: did you see the "redirects=only" option in the DPL manual? -- Gero 08:54, 18 December 2010 (UTC)
Berlin Wall, Berliner Mauer, Templates in Redirection
Hi, thanks for the fast reply! I created the Template:Translation, and the desired Translation list. So my guess is that the list, which is the important part for us, shows no entries, because the include statement tries to include data from the page that the redirect page leads to, and that one doesn't contain the template:translation. When I use the wildcard * in the include statement, it transcludes the entire redirected page, but not the redirect page itself. So that's where I need your help. :-) --Theaitetos 20:23, 18 December 2010 (UTC)