Finally! News archiving (and publishing) system

Anderson Lizardo andersonlizardo at yahoo.com.br
Mon Sep 1 06:47:48 PDT 2003


Hi,

I'm very proud to announce the final "news archiving [and publishing] 
system" implementation, which fulfills the functions explained at 
http://test.linuxfromscratch.org/website.html#todo.

The system "installation" is simple:
1) Apply the website-20030831-remove_news.patch patch to the current 
CVS. It removes the news entries from news-top.html files and the 
generalnews.txt file.
2) Unpack install_archive.tar.gz into the CVS. It will create the 
following files:

archive-bottom.html
archive-top.html
blfs/news-2003.txt
create_news.sh
hints/news-2003.txt
lfs/archive-top.html
lfs/archive-bottom.html
lfs/news-2003.txt
manage_news.pl
news-2003.txt
news-template.txt

"manage_news.pl" is the actual archiving script. "create_news.sh" is a 
bash script which demonstrates the usage of manage_news.pl (it only 
creates the general and LFS archives, and the lfs/news.html file). The 
news-2003.txt files are the news databases, in MIME format (read below 
why I have decided to use MIME). news-template.txt is a template of the 
MIME news database. archive-*.html are sample templates for the archive 
pages.

Why MIME?

While writing the script which implements the format described in 
http://archives.linuxfromscratch.org/mail-archives/website/2003-August/000529.html,

I noted that it (the format) was very similar to a MIME message. So 
I've decided to use the excellent and rock-solid MIME-Tools Perl 
module, and dropped the idea of writing a complete (and untested) 
parsing system.

The basic differences between the old format and the MIME one are:
- The parts (in our case, news items) are separated from each other by a 
content boundary. I used "NEWS_ITEM_BOUNDARY" as boundary. You can 
change this boundary, but you have to garantee the uniqueness of it 
inside the database (in other words, "--NEWS_ITEM_BOUNDARY" should not 
occur in the begin of a line in the news contents).
- There is no "content:" field. The news content is the body of each 
MIME part.
- It has a "global header", where you should set the "section:" field to 
the right value: general, lfs, blfs, hints, alfs, patches. This field 
determines which directory under news/ the news should be archived and 
the URL to resolve relative links.

The restrictions of the MIME format are:
- The minimal structure of the database should be:

[no space]Content-Type: multipart/mixed;
    boundary="NEWS_ITEM_BOUNDARY"
[no space]MIME-Version: 1.0
[no space]Section: section_name
[empty line]
[no space]--NEWS_ITEM_BOUNDARY
[no space]Title: News Title
[no space]Author: Author Name
[no space]Date: YYYY/MM/DD
[no space]Id: news_item_id
[empty line]
        <p>The news item content goes here.</p>
[empty line]
[no space]--NEWS_ITEM_BOUNDARY
[no space]Title: Other News
[no space]Author: Other Author
[no space]Date: YYYY/MM/DD
[no space]Id: other_news_item_id
[empty line]
        <p>The news item content goes here.</p>
[empty line]
[no space]--NEWS_ITEM_BOUNDARY--

- The lines labeled [empty line] are (of course) empty lines, and _must_ 
exist.
- The lines labeled [no space] cannot have blank spaces at the beginning 
of the line.
- each part boundary starts with "--", and the last one ends with "--".
- For other restrictions (not important to us), read the MIME RFCs.

And remember, the most recent news are on top, right below the "global 
header".

Any suggestions or doubts, just say/ask ;-)
-- 
Anderson Lizardo




_______________________________________________________________________
Desafio AntiZona: participe do jogo de perguntas e respostas que vai
dar um Renault Clio, computadores, câmeras digitais, videogames e muito
mais! www.cade.com.br/antizona
-------------- next part --------------
A non-text attachment was scrubbed...
Name: install_archive.tar.gz
Type: application/x-tar
Size: 19139 bytes
Desc: install_archive.tar.gz
URL: <http://lists.linuxfromscratch.org/pipermail/website/attachments/20030901/11ac14a4/attachment.tar>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: website-20030831-remove_news.patch.gz
Type: application/x-gzip
Size: 13484 bytes
Desc: website-20030831-remove_news.patch.gz
URL: <http://lists.linuxfromscratch.org/pipermail/website/attachments/20030901/11ac14a4/attachment.bin>


More information about the website mailing list