NAME

WebFetch::Input::SiteNews - download and save SiteNews headlines from a local file

VERSION

version 0.15.6

SYNOPSIS

In perl scripts:

use WebFetch::Input::SiteNews;

From the command line:

perl -w -MWebFetch::Input::SiteNews -e "&fetch_main" -- --dir directory --source news-file --short short-form-output-file --long long-form-output-file

DESCRIPTION

This module gets the current headlines from a site-local file.

The --source parameter specifies a file name which contains news to be posted. See "FILE FORMAT" below for details on contents to put in the file. --source may be specified more than once, allowing a single news output to come from more than one input. For example, one file could be manually maintained in CVS or RCS and another could be entered from a web form.

After this runs, the file site_news.html will be created or replaced. If there already was a site_news.html file, it will be moved to Osite_news.html.

FILE FORMAT

The WebFetch::Input::SiteNews data format is used to set up news for the local web site and allow other sites to import it via WebFetch. The file is plain text containing comments and the news items.

There are three forms of outputs generated from these news files.

The "short news" output is a small number (5 by default) of HTML text and links used for display in a small news window. This list takes into account expiration dates and priorities to pick which news entries are displayed and in what order.

The "long news" output lists all the news entries chronologically. It does not take expiration or priority into account. It is intended for a comprehensive site news list.

The export modes make news items available in formats other web sites can retrieve to post news about your site. They are chronological listings that omit expired items. They do not take priorities into account.

global parameters

Lines coming before the first news item can set global parameters.

categories

A line before the first news item beginning with "categories:" contains a whitespace-delimited list of news category names in order from highest to lowest priority. These priority names are used by the news item attributes and then for sorting "short news" list items.

data lines

Non-blank non-indented non-comment lines are data lines. Each data line contains a name=value pair. Each group of consecutive data lines is followed by an arbitrary number of indented lines which contain HTML text for the news entry.

The recognized attributes are as follows:

category

used for prioritization, values are set by the categories global parameter (required)

posted

date posted, format is a numerical date YYYYMMDD (required)

expires

expiration date, format is a numerical date YYYYMMDD (optional)

title

shorter title for use in news exports to other sites, otherwise the whole news text will be used (optional)

text lines

Intended lines are HTML text for the news item.

comments

Comments are lines beginning with "#". They are ignored so they can be used for human-readable information.

Note that the "short news" list has some modifications to priorities based on the age of the news item, so that the short list will favor newer items when they're the same priority. There is a sorting "priority bonus" for items less than a day old, which increases their priority by two priority levels. Day-old news items get a bonus of one priority level. All news items also "decay" in priority slightly every day, dropping a whole priority level every 40 days.

SEE ALSO

WebFetch https://github.com/ikluft/WebFetch

BUGS AND LIMITATIONS

Please report bugs via GitHub at https://github.com/ikluft/WebFetch/issues

Patches and enhancements may be submitted via a pull request at https://github.com/ikluft/WebFetch/pulls

AUTHOR

Ian Kluft <https://github.com/ikluft>

COPYRIGHT AND LICENSE

This software is Copyright (c) 1998-2022 by Ian Kluft.

This is free software, licensed under:

The GNU General Public License, Version 3, June 2007