%NEWS% variable in a news topic named Xxx
to generate a headline topic named XxxHeadlines.
%NEWS% appears,
then a new topic is created with the first line of the most recent news.
Ending punctuation is removed from the headlines for a sleeker look.
Recommended usage is to %INCLUDE% the generated topic in some panel in
a front page, and put a "More..." link in it to the source topic. The
%NEWS% variable can be set in an HTML comment to hide it in the source
topic:
<!-- %NEWS% -->
To change the default, use the syntax %NEWS{parameter="value" ...}% syntax
with the following available parameters:
| Parameter | Value |
|---|---|
| count | The number of headlines to keep. Defaults to 5. |
| pattern | Gives a (partial) regular expression pattern to use to extract the news items. This pattern must occur at the beginning of a line in order to select a news item. The headline then becomes everything following the pattern until the end of the line. Defaults to (\t| )\*\s (i.e., a first-level bullet). |
| postsep | Appends this text to each headline. Defaults to newline |
| prefix | This text will be prepended to the generated topic. Defaults to nothing. |
| presep | Prepend each headline with this text. Defaults to <tab>*<space> |
| suffix | This text will be appended to the generated topic. Defaults to nothing. |
| topic | Name of generated headlines topic. Defaults to the name of the source topic with Headlines appended to it. |
| trim | If set to "no", trailings punctuation marks ( .,:; ) are not removed from headlines. Defaults to "yes" |
%NEWS{presep="<li>" prefix="<ul>" suffix="</ul>"}%
Example: If the topic MyCompanyNews contains:
%NEWS% * NewsPlugin released - 18 Feb 2003. The great news plugin has been debugged * NewsPlugin devel started - 02 Jan 2003. I think this is really needed, I will try to keep it simpleThen on saving the topic MyCompanyNewsHeadlines will contain:
* NewsPlugin released - 18 Feb 2003 * NewsPlugin devel started - 02 Jan 2003Example: This is the same example above, except the news headlines are specified as level-2 headings:
%NEWS{pattern="---\+\+(!!)?"}%
---++ NewsPlugin released - 18 Feb 2003.
The great news plugin has been debugged
---++ NewsPlugin devel started - 02 Jan 2003.
I think this is really needed,
I will try to keep it simple
Then on saving the topic MyCompanyNewsHeadlines will contain:
* NewsPlugin released - 18 Feb 2003 * NewsPlugin devel started - 02 Jan 2003
%<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%
data/debug.txt) NewsPlugin.zip in your twiki installation directory. Content: | File: | Description: |
|---|---|
data/TWiki/NewsPlugin.txt | Plugin topic |
data/TWiki/NewsPlugin.txt,v | Plugin topic repository |
lib/TWiki/Plugins/NewsPlugin.pm | Plugin Perl module |
data/Sandbox/NewsPluginExample.txt | Example news source topic |
data/Sandbox/NewsPluginExampleHeadlines.txt | Example generated news headlines topic |
data/Sandbox/NewsPluginExampleInclusion.txt | Example =%INCLUDE% usage of a generated headlines topic |
| Plugin Author: | TWiki:Main/ColasNahaboo |
| Plugin Version: | 07 Feb 2006 (V1.5) |
| Change History: | |
| 07 Feb 2006 | 1.5 Add "pattern" parameter. |
| 20 Feb 2003 | 1.4 trim option for removing ending punctuation: . , : ; |
| 19 Feb 2003 | 1.3 small bugfix |
| 17 Feb 2003 | 1.2 Initial version |
| TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 TWiki version of 01 Feb 2003 or better, or the 01 Dec 2001 version with the TWiki:Codev/PluginHookOnSavePatch patch. |
| CPAN Dependencies: | none |
| Other Dependencies: | none |
| Perl Version: | 5.005 |
| License: | GPL (GNU General Public License) |
| Benchmarks: | GoodStyle 100%, FormattedSearch 99%, NewsPlugin 100% |
| Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/NewsPlugin |
| Feedback: | http://TWiki.org/cgi-bin/view/Plugins/NewsPluginDev |
| Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/NewsPluginAppraisal |
![]() |
/ TWiki / NewsPlugin |
|
| | ||
|
Navigate:
Changes -
Index -
Map -
Search -
Print version -
RSS Feed
Advanced: Backlinks - Children - Raw View - Email changes - History Admin: Admin - Statistics - Preferences - Notifications - Your Account Edit: Edit - Raw edit - Attach - Create New Topic - More topic actions |
TWiki.NewsPlugin Topic revision: r10 - 2006-02-07 - 20:51:04 - TWikiContributor Ideas, requests, problems regarding Colas? Send feedback Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.NewsPlugin |