Commits

shl...@cec68495-dca5-4e2b-845c-11fdaaa4f967  committed 18434f7

r5945@telaviv1: shlomi | 2008-07-22 16:11:00 +0300
Added the RSS feed generation.

  • Participants
  • Parent commits dd8460c

Comments (0)

Files changed (2)

 FORTUNES_XHTMLS = $(patsubst $(T2_FORTUNES_DIR)/%.xml,$(FORTUNES_XHTMLS_DIR)/%.xhtml,$(FORTUNES_XMLS_SRC))
 FORTUNES_TEXTS = $(patsubst %.xml,%,$(FORTUNES_XMLS_SRC))
 FORTUNES_ATOM_FEED = $(T2_FORTUNES_DIR)/fortunes-shlomif-all.atom
+FORTUNES_RSS_FEED = $(T2_FORTUNES_DIR)/fortunes-shlomif-all.rss
 
-fortunes-compile-xmls: $(FORTUNES_XHTMLS) $(FORTUNES_TEXTS) $(FORTUNES_ATOM_FEED) 
+fortunes-compile-xmls: $(FORTUNES_XHTMLS) $(FORTUNES_TEXTS) $(FORTUNES_ATOM_FEED) $(FORTUNES_RSS_FEED) 
 
 # The touch is to make sure we compile the .html.wml again.
 
 	bash $(T2_FORTUNES_DIR)/run-validator.bash $< && \
 	perl $(T2_FORTUNES_DIR)/convert-to-plaintext.pl $< $@
 
-$(FORTUNES_ATOM_FEED): $(T2_FORTUNES_DIR)/generate-web-feeds.pl $(FORTUNES_XMLS_SRC)
-	perl $< $@ $(T2_FORTUNES_DIR)
+$(FORTUNES_ATOM_FEED) $(FORTUNES_RSS_FEED): $(T2_FORTUNES_DIR)/generate-web-feeds.pl $(FORTUNES_XMLS_SRC)
+	perl $< --atom $(FORTUNES_ATOM_FEED) --rss $(FORTUNES_RSS_FEED) --dir $(T2_FORTUNES_DIR)
 
 $(DOCBOOK_INSTALLED_INDIVIDUAL_XHTMLS_CSS):: %: $(DOCMAKE_STYLE_CSS)
 	cp -f $< $@

File t2/humour/fortunes/generate-web-feeds.pl

 use Cwd;
 use File::Spec;
 use String::ShellQuote;
+use Getopt::Long;
 
 ### Definitions:
 
 
 ##########################################################################
 
-my $atom_arg = shift(@ARGV);
-my $dir_arg = shift(@ARGV);
+my $atom_arg;
+my $rss_arg;
+my $dir_arg;
+
+GetOptions(
+    "atom=s" => \$atom_arg,
+    "dir=s" => \$dir_arg,
+    "rss=s" => \$rss_arg,
+);
 
 my $abs_dir = File::Spec->rel2abs($dir_arg);
 my $abs_atom = File::Spec->rel2abs($atom_arg);
+my $abs_rss = File::Spec->rel2abs($rss_arg);
 
 open my $arcs_list_fh, "<", "$dir_arg/fortunes-list.mak";
 my @lines = <$arcs_list_fh>;
     (map { ("--xml-file" , "$_.xml") } (@fortunes)),
     "--yaml-data" => "$abs_dir/fortunes-shlomif-ids-data.yaml",
     "--atom-output" => $abs_atom,
+    "--rss-output" => $abs_rss,
     "--master-url" => "http://www.shlomifish.org/humour/fortunes/",
     "--title" => "Shlomi Fish's Fortune Feeds",
     "--tagline" => "Shlomi Fish's Fortune Feeds",