[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] dsa.XX.rdf & dsa-long.XX.rdf



        Hi!

 Again, please find attached the patch.  This patch now doesn't change
anything for the dsa.XX.rdf file but adds support for the dsalong
format.

 I am not really sure if the dsalong format should have everything in
it, or just the first paragraph.  I would rather go with the later, the
rest should be looked up with the URL anyway.  To do that we must ensure
that the DSAs will always have the <p></p> tags around the first
paragraph, otherwise it will be hard to do the correct regexp for it.
But it should have it anyway, so I am happy with that restriction.

 Still, I am waiting for answers to some of the questions I raised in
the other PATCH mail I sent last week.  Especially about if I should
enable multiline <define-tag> for the other matches, too.  Might help in
some way, but beware, the file might get parsed at other ends still that
haven't been changed yet (yes, I'm willing to change those, too).

 I haven't seen any problem with it.  Ah yes, and the dsa-long.rdf.in is
just the same as dsa.rdf.in but with format set to rdflong instead of
rdf.

 So long,
Alfie
-- 
  * Rename template.ru to template.ru
 -- Tollef Fog Heen, changelog.Debian for bsdmainutils (5.20020211-7)
Index: english/template/debian/recent_list.wml
===================================================================
RCS file: /cvs/webwml/webwml/english/template/debian/recent_list.wml,v
retrieving revision 1.102
diff -u -b -r1.102 recent_list.wml
--- english/template/debian/recent_list.wml	1 Nov 2002 13:16:30 -0000	1.102
+++ english/template/debian/recent_list.wml	25 Nov 2002 13:40:32 -0000
@@ -41,7 +41,7 @@
 # If $number is zero then all the news items are shown.
 #
 # The format parameter specifies the type of output: numbered, definition
-# and bulleted list, a table, or a RDF file.
+# and bulleted list, a table, or a RDF file (rdf or rdflong).
 #
 # The match parameter is a regexp used to determine if the file is special,
 # i.e. that it should be parsed.
@@ -138,33 +138,45 @@
   open FILE, "$year/$file" or open FILE, "$year/$trans_title" or open FILE, "$eng_dir/$year/$file" or warn "couldn't open $eng_dir/$year/$file: $!\n";
   $base = $1 if ($file =~ /($match).wml/);
   my $event = '';
+
+  my $content;
+  {
+    local $/;
+    $content = <FILE>;
+    seek FILE, 0, SEEK_SET;
+  }
+
   if ($WML_SRC_DIRNAME =~ /events/) { # shouldn't waste time if it's not events
     $is_events = 1;
 <protect pass=2>
-    foreach (<FILE>) {
-      if (/^#use wml::debian::past_event$/) {
+    if ($content =~ /^#use wml::debian::past_event$/m) {
         $event = "past";
-      } elsif (/^#use wml::debian::event$/) {
+    } elsif ($content =~ /^#use wml::debian::event$/m) {
         $event = "current";
       }
-    }
 </protect>
-    seek FILE, 0, SEEK_SET;
   }
-#  warn (stat FILE)[7]; warn "\n";
+
   $title = ''; $date = ''; $rdate = ''; $desc = ''; $status = ''; $where = '';
+  $moreinfo = '';
 <protect pass=2>
-  foreach $line (<FILE>) {
-       if ($line =~ /^<define-tag pagetitle>\s*(.*)\s*<\/define-tag>$/) { $title = qq/$1/; }   # all
-    elsif ($line =~ /^<define-tag release_date>(.*)<\/define-tag>$/) { $date = qq/$1/; } # News
-    elsif ($line =~ /^<define-tag where>(.*)<\/define-tag>$/) { $where = qq/$1/; }       # events
-    elsif ($line =~ /^<define-tag date>(.*)<\/define-tag>$/) { $date = qq/$1/; }         # events
-    elsif ($line =~ /^<define-tag description>(.*)<\/define-tag>$/) { $desc = qq/$1/; }  # security
-    elsif ($line =~ /^<define-tag status>(.*)<\/define-tag>$/) { $status = qq/$1/; }     # vote
+  if ($content =~ /^<define-tag pagetitle>\s*(.*?)\s*<\/define-tag>$/ms) {
+    $title = qq/$1/; }      # all
+  if ($content =~ /^<define-tag release_date>(.*?)<\/define-tag>$/ms) {
+    $date = qq/$1/; }       # News
+  if ($content =~ /^<define-tag where>(.*?)<\/define-tag>$/ms) {
+    $where = qq/$1/; }      # events
+  if ($content =~ /^<define-tag date>(.*?)<\/define-tag>$/ms) {
+    $date = qq/$1/; }       # events
+  if ($content =~ /^<define-tag description>(.*?)<\/define-tag>$/ms) {
+    $desc = qq/$1/; }       # security
+  if ($content =~ /^<define-tag moreinfo>(.*?)<\/define-tag>$/ms) {
+    $moreinfo = qq/$1/; }   # dsa-long.XX.rdf
+  if ($content =~ /^<define-tag status>(.*?)<\/define-tag>$/ms) {
+    $status = qq/$1/; }     # vote
 </protect>
     if ($title && $date && $where) { # for events/
       $str1 = "$elemhead<tt>[$date]</tt>$elemdate <strong><a href=\"$year/$base\">$title</a></strong>, $elemfoot$where<br />$elemrealfoot\n";
-      last;
     }
     elsif ($desc) { # for security/
       open DATAFILE, "$eng_dir/$year/$base.data" or warn "couldn't open $eng_dir/$year/$base.data: $!\n";
@@ -178,25 +190,33 @@
 #      warn "title: $title rdate: $rdate\n";
       $rdate = newsdate($rdate);
       $title =~ s/(DSA-\d{3})-\d{1}/$1/; # strip off the revision in the DSA number
-      if ($format =~ rdf) {
+    if ($format eq 'rdf') {
         $str1 = "
 <item rdf:about=\"http://www.debian.org/security/$year/$base\";>
   <title>$title</title>
   <link>http://www.debian.org/security/$year/$base</link>
   <description>
-$desc
+    $desc
+  </description>
+</item>
+";
+    } elsif ($format eq 'rdflong') {
+      $str1 = "
+<item rdf:about=\"http://www.debian.org/security/$year/$base\";>
+  <title>$title - $desc</title>
+  <link>http://www.debian.org/security/$year/$base</link>
+  <description>
+    $moreinfo
   </description>
 </item>
 ";
       } else {
         $str1 = "$elemhead<tt>[$rdate]</tt> <strong><a href=\"$year/$base\">$title</a></strong> $elemfoot$desc<br />$elemrealfoot\n";
       }
-      last;
     }
     elsif ($title && $date && !$is_events) { # for News/ and not events/
       $date = newsdate($date);
       $str1 = "$elemhead<tt>[$date]</tt> <strong><a href=\"$year/$base\">$title</a></strong><br />$elemrealfoot\n";
-      last;
     }
     elsif ($title && $status) { # for vote/
       $str1 = "$elemhead<a href=\"$year/$base\">$title</a> &mdash; ";
@@ -207,10 +227,7 @@
       elsif ( $status eq "W" ) { $str1 .= "<withdrawn/>"; }
       else { $str1 .= "$status"; }
       $str1 .= "<br />$elemrealfoot\n";
-      last;
     }
-  } # for each line in file
-  close FILE;
 
   if ($event ne "") { # this file was for an event
        if ( $event eq "past" ) { $over .= $str1; }
Index: english/security/Makefile
===================================================================
RCS file: /cvs/webwml/webwml/english/security/Makefile,v
retrieving revision 1.38
diff -u -b -r1.38 Makefile
--- english/security/Makefile	9 Nov 2002 13:15:32 -0000	1.38
+++ english/security/Makefile	25 Nov 2002 13:40:32 -0000
@@ -23,10 +23,14 @@
 
 ifndef SUBLANG
 DSARDF := dsa.$(LANGUAGE).rdf
+DSALONGRDF := dsa-long.$(LANGUAGE).rdf
 DESTDSARDF := $(HTMLDIR)/$(DSARDF)
+DESTDSALONGRDF := $(HTMLDIR)/$(DSALONGRDF)
 else
 DSARDF := $(sort $(foreach i,$(SUBLANG),$(subst dsa,dsa.$(LANGUAGE)-$(i),dsa.rdf)))
+DSALONGRDF := $(sort $(foreach i,$(SUBLANG),$(subst dsa-long,dsa-long.$(LANGUAGE)-$(i),dsa-long.rdf)))
 DESTDSARDF := $(patsubst %.rdf,$(HTMLDIR)/%.rdf,$(DSARDF))
+DESTDSALONGRDF := $(patsubst %.rdf,$(HTMLDIR)/%.rdf,$(DSALONGRDF))
 endif
 
 $(DSARDF): $(ENGLISHDIR)/security/dsa.rdf.in \
@@ -53,14 +57,43 @@
             $(ENGLISHDIR)/security/dsa.rdf.in
 endif
 
-all:: $(DSARDF)
+$(DSALONGRDF): $(ENGLISHDIR)/security/dsa-long.rdf.in \
+  $(wildcard $(CUR_YEAR)/dsa-*.wml) \
+  $(wildcard $(ENGLISHDIR)/security/$(CUR_YEAR)/dsa-*.wml) \
+  $(wildcard $(ENGLISHDIR)/security/$(CUR_YEAR)/dsa-*.data) \
+  $(TEMPLDIR)/recent_list.wml $(TEMPLDIR)/security_tags.wml $(GETTEXTDEP)
+ifeq "$(LANGUAGE)" "zh"
+	$(shell echo $(WML) | perl -pe 's,:.zh-(..)\.html,:dsa-long.zh-$$1.rdf,g') \
+          $(shell egrep '^-D (CUR_|CHAR)' ../.wmlrc) \
+            $(ENGLISHDIR)/security/dsa-long.rdf.in
+	@echo -n " * Converting: [zh_CN.GB2312], "
+	@$(B5TOGB) < dsa-long.zh-cn.rdf.tmp > dsa-long.zh-cn.rdf
+	@rm -f dsa-long.zh-cn.rdf.tmp
+	@$(TOCN) dsa-long.zh-cn.rdf
+	@echo -n "[zh_HK.Big5], "
+	@mv -f dsa-long.zh-hk.rdf.tmp dsa-long.zh-hk.rdf
+	@$(TOHK) dsa-long.zh-hk.rdf
+	@echo "[zh_TW.Big5]."
+	@mv -f dsa-long.zh-tw.rdf.tmp dsa-long.zh-tw.rdf
+	@$(TOTW) dsa-long.zh-tw.rdf
+else
+	$(WML) $(shell egrep '^-D (CUR_|CHAR)' ../.wmlrc) \
+            $(ENGLISHDIR)/security/dsa-long.rdf.in
+endif
 
-install:: $(DESTDSARDF)
+all:: $(DSARDF) $(DSALONGRDF)
+
+install:: $(DESTDSARDF) $(DESTDSALONGRDF)
 
 $(DESTDSARDF): $(HTMLDIR)/%: %
 	install -m 664 -p $< $(HTMLDIR)
 ifeq "$(LANGUAGE)" "en"
 	ln -sf dsa.en.rdf $(HTMLDIR)/dsa.rdf
+endif
+$(DESTDSALONGRDF): $(HTMLDIR)/%: %
+	install -m 664 -p $< $(HTMLDIR)
+ifeq "$(LANGUAGE)" "en"
+	ln -sf dsa-long.en.rdf $(HTMLDIR)/dsa-long.rdf
 endif
 
 ifeq "$(LANGUAGE)" "en"

Attachment: pgpVnRTwh_Vaj.pgp
Description: PGP signature


Reply to: