Commits

Anonymous committed f3d81da

r5134@telaviv1: shlomi | 2008-05-14 12:17:43 +0300
Fortunes: got the fortunes XMLs to compile using the main makefile.

Comments (0)

Files changed (14)

 all: make-dirs docbook_targets latemp_targets fortunes-target sitemap_targets copy_fortunes site-source-install
 
 include lib/make/gmsl/gmsl
+include lib/make/fortunes/fortunes-list.mak
 	
 include include.mak
 include rules.mak
 
 site-source-install: $(SITE_SOURCE_INSTALL_TARGET)
 
-fortunes-target: $(FORTUNES_TARGET)
+fortunes-target: $(FORTUNES_TARGET) fortunes-compile-xmls
 
 # t2 macros
 
 
 $(DOCBOOK_INSTALLED_CSS_DIRS) : lib/sgml/docbook-css/docbook-css-0.4/
 	rsync -r -v $< $@
+
+FORTUNES_XHTMLS_DIR = lib/fortunes/xhtmls
+
+FORTUNES_XMLS_BASE = $(addsuffix .xml,$(FORTUNES_FILES_BASE))
+FORTUNES_XMLS_SRC = $(patsubst %,$(T2_FORTUNES_DIR)/%,$(FORTUNES_XMLS_BASE))
+FORTUNES_XHTMLS = $(patsubst $(T2_FORTUNES_DIR)/%.xml,$(FORTUNES_XHTMLS_DIR)/%.xhtml,$(FORTUNES_XMLS_SRC))
+
+fortunes-compile-xmls: $(FORTUNES_XHTMLS)
+
+$(FORTUNES_XHTMLS): $(FORTUNES_XHTMLS_DIR)/%.xhtml : $(T2_FORTUNES_DIR)/%.xml
+	bash $(T2_FORTUNES_DIR)/run-validator.bash $<
+	perl $(T2_FORTUNES_DIR)/convert-to-xhtml.pl $< $@
+	# This is to make sure we compile the .html.wml again.
+	touch $(patsubst %.xml,%.html.wml,$<)

lib/make/fortunes/fortunes-list.mak

+FORTUNES_FILES_BASE = \
+	friends \
+	joel-on-software \
+	nyh-sigs \
+	osp_rules \
+	paul-graham \
+	shlomif \
+	shlomif-fav \
+	subversion \
+	tinic

t2/humour/fortunes/Makefile

 
 PACKAGE_BASE = $(DIST_DIR).tar.gz
 
-FILES = \
-	friends \
-	joel-on-software \
-	nyh-sigs \
-	osp_rules \
-	paul-graham \
-	shlomif \
-	shlomif-fav \
-	subversion \
-	tinic
 
 DATS = $(addsuffix .dat,$(FILES))
 

t2/humour/fortunes/convert-to-xhtml.pl

 use strict;
 use warnings;
 
-my $xml_fn = shift(@ARGV);
+### Definitions:
 
 my $fortune_xml_base_dir = "$ENV{HOME}/progs/perl/cpan/XML/Grammar/Fortune/trunk/XML-Grammar-Fortune/module";
 
 my $good_perl_path = "$ENV{HOME}/apps/perl/perl-5.8.8-debug/bin/perl";
 
+##########################################################################
+
+my $xml_fn = shift(@ARGV);
+my $out_fn = shift(@ARGV);
+
 my $html_fn = $xml_fn;
 
-$html_fn =~ s{.xml\z}{.html};
-my $filename = $html_fn;
 
-$filename =~ s{\.html\z}{.xml};
+my $abs_xml_fn = File::Spec->rel2abs($xml_fn);
 
-my $abs_filename = File::Spec->rel2abs($filename);
-
-my $xhtml_out = $abs_filename;
-
-$xhtml_out =~ s{\.xml\z}{.xhtml};
+my $abs_out_fn = File::Spec->rel2abs($out_fn);
 
 my $xml_data_gen_cmd = "cd " . shell_quote($fortune_xml_base_dir) . 
-    q# ; perl -Mblib -MXML::Grammar::Fortune -e 'XML::Grammar::Fortune->new({mode => "convert_to_html", input => shift(@ARGV), output => shift(@ARGV)})->run()' # .  shell_quote($abs_filename, $xhtml_out);
+    q# ; perl -Mblib -MXML::Grammar::Fortune -e 'XML::Grammar::Fortune->new({mode => "convert_to_html", input => shift(@ARGV), output => shift(@ARGV)})->run()' # .  shell_quote($abs_xml_fn, $abs_out_fn);
 
 # print STDERR $xml_data_gen_cmd; exit(0);
 system($xml_data_gen_cmd);
 
-open my $text_fh, "<", $xhtml_out;
+open my $text_fh, "<", $abs_out_fn;
 binmode ($text_fh, ":utf8");
 my $contents;
 {
 $contents =~ s{\A(.*?)<body>}{}ms;
 $contents =~ s{</body>(.*?)\z}{}ms;
 
-open my $xhtml_raw_out, ">", $html_fn."-xhtml-for-input";
+open my $xhtml_raw_out, ">", "${abs_out_fn}-for-input";
 binmode ($xhtml_raw_out, ":utf8");
 print {$xhtml_raw_out} $contents;
 close($xhtml_raw_out);

t2/humour/fortunes/friends.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/friends.xhtml-for-input"
 </div>
 

t2/humour/fortunes/joel-on-software.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/joel-on-software.xhtml-for-input"
 </div>
 

t2/humour/fortunes/nyh-sigs.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/nyh-sigs.xhtml-for-input"
 </div>
 

t2/humour/fortunes/nyh-sigs.xml

         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--an-apple-a">
+    <fortune id="nyh-sig--an-apple-a-2">
       <meta>
         <title>An apple a day keeps the doctor away. An</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--experience-is-what">
+    <fortune id="nyh-sig--experience-is-what-causes">
       <meta>
         <title>Experience is what causes a person to</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--experience-is-what">
+    <fortune id="nyh-sig--experience-is-what-recognize">
       <meta>
         <title>Experience is what lets you recognize a</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--i-have-a">
+    <fortune id="nyh-sig--i-have-a-great-sig">
       <meta>
         <title>I have a great signature, but it won&#39;t</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--i-have-a">
+    <fortune id="nyh-sig--i-have-a-watch-cat">
       <meta>
         <title>I have a watch cat! If someone breaks in,</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--i-used-to">
+    <fortune id="nyh-sig--i-used-to-be-lumberjack">
       <meta>
         <title>I used to be a lumberjack, but I just</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--i-used-to">
+    <fortune id="nyh-sig--i-used-to-work-in-pickle">
       <meta>
         <title>I used to work in a pickle factory, until</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--i-want-to">
+    <fortune id="nyh-sig--i-want-to-be-human-being">
       <meta>
         <title>I want to be a human being, not a human</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--i-want-to">
+    <fortune id="nyh-sig--i-want-to-live-forever">
       <meta>
         <title>I want to live forever or die in the</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--the-trouble-with">
+    <fortune id="nyh-sig--the-trouble-with-being-punctual">
       <meta>
         <title>The trouble with being punctual is that</title>
       </meta>
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--the-trouble-with">
+    <fortune id="nyh-sig--the-trouble-with-politcal-jokes">
       <meta>
         <title>The trouble with political jokes is they</title>
       </meta>
       <raw>
         <body>
           <text><![CDATA[Unix is user friendly - it's just picky
-about it's friends.
-
-	-- One of Nadav Har'El's Email Signatures.
-]]></text>
-        </body>
-        <info/>
-      </raw>
-    </fortune>
-    <fortune id="nyh-sig--unix-is-user">
-      <meta>
-        <title>Unix is user friendly - it&#39;s just picky</title>
-      </meta>
-      <raw>
-        <body>
-          <text><![CDATA[Unix is user friendly - it's just picky
 about its friends.
 
 	-- One of Nadav Har'El's Email Signatures.
         <info/>
       </raw>
     </fortune>
-    <fortune id="nyh-sig--unlike-microsoft-a">
-      <meta>
-        <title>Unlike Microsoft, a restaurant would not</title>
-      </meta>
-      <raw>
-        <body>
-          <text><![CDATA[Unlike Microsoft, a restaurant would not
-charge me for food I find a bug in!
-
-	-- One of Nadav Har'El's Email Signatures.
-]]></text>
-        </body>
-        <info/>
-      </raw>
-    </fortune>
-    <fortune id="nyh-sig--unlike-microsoft-a">
-      <meta>
-        <title>Unlike Microsoft, a restaurant would not</title>
-      </meta>
-      <raw>
-        <body>
-          <text><![CDATA[Unlike Microsoft, a restaurant would not
-charge me for food with a bug!
-
-	-- One of Nadav Har'El's Email Signatures.
-]]></text>
-        </body>
-        <info/>
-      </raw>
-    </fortune>
     <fortune id="nyh-sig--war-doesnt-determine">
       <meta>
         <title>War doesn&#39;t determine who&#39;s right but</title>

t2/humour/fortunes/osp_rules.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/osp_rules.xhtml-for-input"
 </div>
 

t2/humour/fortunes/paul-graham.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/paul-graham.xhtml-for-input"
 </div>
 
 

t2/humour/fortunes/shlomif-fav.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/shlomif-fav.xhtml-for-input"
 </div>
 
 

t2/humour/fortunes/shlomif.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/shlomif.xhtml-for-input"
 </div>
 

t2/humour/fortunes/subversion.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/subversion.xhtml-for-input"
 </div>
 
 

t2/humour/fortunes/tinic.html.wml

 
 <h2 id="fortunes-list">The Fortunes Themselves</h2>
 <div class="fortunes_list">
-#include "$(LATEMP_FILENAME)-xhtml-for-input"
+#include "fortunes/xhtmls/tinic.xhtml-for-input"
 </div>