Difference between revisions of "Issue:Labeling Sections from Templates"
(→The intended use) |
|||
(One intermediate revision by the same user not shown) | |||
Line 58: | Line 58: | ||
Indeed DPL relies on the fact that the section tag is physically present within the raw wiki text. Maybe DPL could learn to understand someting like <nowiki>{{begin section|Foo}}</nowiki> but I can´t see an advantage in this. | Indeed DPL relies on the fact that the section tag is physically present within the raw wiki text. Maybe DPL could learn to understand someting like <nowiki>{{begin section|Foo}}</nowiki> but I can´t see an advantage in this. | ||
:[[User:Gero|Gero]] 21:35, 25 March 2008 (CET) | :[[User:Gero|Gero]] 21:35, 25 March 2008 (CET) | ||
+ | |||
+ | ==The intended use== | ||
+ | |||
+ | Here is the advantage (or at least why I am interested): | ||
+ | |||
+ | I am trying to use DPL to be the framework behind a nice RSS feed infrastructure, much like what [[Issue:RSS from DPL?|Dmb was talking about]]. For example, let's say I have an article called '''Blog Entry'''; in that article I could do something like: | ||
+ | |||
+ | <pre> | ||
+ | Some text... | ||
+ | |||
+ | {{BeginFeed | ||
+ | |date=2008/03/25 | ||
+ | |author=[[User:Gero|Gero]]}} | ||
+ | |||
+ | This text will appear as a new entry in the RSS feed. | ||
+ | |||
+ | {{EndFeed}} | ||
+ | </pre> | ||
+ | |||
+ | where the '''BeginFeed''' and '''EndFeed''' templates would add ''section'' tags as described above. | ||
+ | |||
+ | Then, I could have a separate article, called something like '''BlogFeed''' to aggregate all of the feed items using DPL: | ||
+ | |||
+ | <pre> | ||
+ | <dpl> | ||
+ | uses=Template:BeginFeed | ||
+ | include=feedcontent,{BeginFeed}:date,{BeginFeed}:author | ||
+ | ordermethod=firstedit | ||
+ | order=descending | ||
+ | format=,[[%PAGE%|%TITLE%]],, | ||
+ | </dpl> | ||
+ | </pre> | ||
+ | |||
+ | (this of course is not a functioning example; I still have to add some code to re-order the entries based upon the user-defined date given to the '''BeginFeed''' template) | ||
+ | |||
+ | --[[User:Evan Sultanik|Evan Sultanik]] 21:49, 25 March 2008 (CET) |
Latest revision as of 21:51, 25 March 2008
Description: | Section labeling doesn't seem to work from within templates. |
Extension / Version: | DPL / 1.6.8 |
Type / Status: | Bug / open |
Contents
Problem
My problem is related to labeling sections for future labeled section transclusion. Let's say I have the following page:
<section begin=foo /> Some text. <section end=foo />
Instead of having the raw section tags, though, I want to have two templates:
Template:BeginFoo
<section begin=foo />
Template:EndFoo
<section end=foo />
such that I can do the following:
{{BeginFoo}} Some text. {{EndFoo}}
The problem is, this doesn't seem to work! Looking at the DPL code, I'm guessing this is because the section tag is rendered to an empty string, so when the BeginFoo template is transcluded, the section tag is rendered and not actually present in the calling page.
Workaround
The only workaround I can think of is to call
{{subst:BeginFoo}} Some text. {{subst:EndFoo}}
but that is less than desirable.
--Evan Sultanik 21:16, 25 March 2008 (CET)
Reply
Indeed DPL relies on the fact that the section tag is physically present within the raw wiki text. Maybe DPL could learn to understand someting like {{begin section|Foo}} but I can´t see an advantage in this.
- Gero 21:35, 25 March 2008 (CET)
The intended use
Here is the advantage (or at least why I am interested):
I am trying to use DPL to be the framework behind a nice RSS feed infrastructure, much like what Dmb was talking about. For example, let's say I have an article called Blog Entry; in that article I could do something like:
Some text... {{BeginFeed |date=2008/03/25 |author=[[User:Gero|Gero]]}} This text will appear as a new entry in the RSS feed. {{EndFeed}}
where the BeginFeed and EndFeed templates would add section tags as described above.
Then, I could have a separate article, called something like BlogFeed to aggregate all of the feed items using DPL:
<dpl> uses=Template:BeginFeed include=feedcontent,{BeginFeed}:date,{BeginFeed}:author ordermethod=firstedit order=descending format=,[[%PAGE%|%TITLE%]],, </dpl>
(this of course is not a functioning example; I still have to add some code to re-order the entries based upon the user-defined date given to the BeginFeed template)
--Evan Sultanik 21:49, 25 March 2008 (CET)