squeeze

A static site generator that can put the toothpaste back in the tube.
git clone https://git.mulligrubs.me/squeeze
Log | Files | Refs | README | LICENSE

rss.pl (2038B)


      1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      2 % File: rss.pl
      3 % Description: DCG definition of an RSS file.
      4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      5 
      6 rss(BuildDate, Articles) -->
      7 	rss_open,
      8 	newline, tab, tab,
      9 	channel_meta(BuildDate),
     10 	items(Articles),
     11 	newline, tab,
     12 	rss_close.
     13 
     14 rss_open -->
     15 	"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>",
     16 	newline,
     17 	"<rss version=\"2.0\">",
     18 	newline, tab,
     19 	"<channel>".
     20 
     21 channel_meta(BuildDate) -->
     22 	"<title>",
     23 	site_title,
     24 	"</title>",
     25 	newline, tab, tab,
     26 	"<description>",
     27 	site_subtitle,
     28 	"</description>",
     29 	newline, tab, tab,
     30 	"<link>",
     31 	site_url,
     32 	"</link>",
     33 	newline, tab, tab,
     34 	language,
     35 	newline, tab, tab,
     36 	copyright,
     37 	newline, tab, tab,
     38 	webmaster,
     39 	newline, tab, tab,
     40 	last_build_date(BuildDate).
     41 
     42 item_title(Title) -->
     43 	"<title>",
     44 	Title,
     45 	"</title>".
     46 
     47 item_description(Description) -->
     48 	"<description>",
     49 	Description,
     50 	"</description>".
     51 
     52 item_link(Path) -->
     53 	"<link>",
     54 	site_url,
     55 	Path,
     56 	"</link>".
     57 
     58 item_guid(Path) -->
     59 	"<guid>",
     60 	site_url,
     61 	Path,
     62 	"</guid>".
     63 
     64 language -->
     65 	"<language>",
     66 	"en-US",
     67 	"</language>".
     68 
     69 copyright -->
     70 	"<copyright>",
     71 	"Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.",
     72 	"</copyright>".
     73 
     74 webmaster -->
     75 	"<webMaster>",
     76 	user_email,
     77 	"</webMaster>".
     78 
     79 last_build_date(BuildDate) -->
     80 	"<lastBuildDate>",
     81 	anything(BuildDate),
     82 	"</lastBuildDate>".
     83 
     84 items([]) --> [].
     85 
     86 items([First|Rest]) --> item(First), items(Rest).
     87 
     88 item(article(Date, Title, Path, Description)) -->
     89 	newline, tab, tab,
     90 	item_open,
     91 	newline, tab, tab, tab,
     92 	item_title(Title),
     93 	newline, tab, tab, tab,
     94 	item_link(Path),
     95 	newline, tab, tab, tab,
     96 	item_guid(Path),
     97 	newline, tab, tab, tab,
     98 	item_description(Description),
     99 	newline, tab, tab, tab,
    100 	author,
    101 	newline, tab, tab, tab,
    102 	item_pubdate(Date),
    103 	newline, tab, tab,
    104 	item_close.
    105 
    106 item_open --> "<item>".
    107 
    108 author -->
    109 	"<author>",
    110 	user_name,
    111 	"</author>".
    112 
    113 item_pubdate(Date) -->
    114 	"<pubDate>",
    115 	anything(Date),
    116 	"</pubDate>".
    117 
    118 item_close --> "</item>".
    119 
    120 rss_close -->
    121 	"</channel>",
    122 	newline,
    123 	"</rss>".