[gnomeweb-wml] anjuta web: team page formatter script.



commit 87a12221b11c1ed127eb76f6c52680c9ed0cd4d2
Author: Naba Kumar <naba gnome org>
Date:   Fri Feb 19 01:23:19 2010 +0200

    anjuta web: team page formatter script.

 projects.gnome.org/anjuta/create-team-page.pl |   67 +++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/projects.gnome.org/anjuta/create-team-page.pl b/projects.gnome.org/anjuta/create-team-page.pl
new file mode 100644
index 0000000..f3a7dde
--- /dev/null
+++ b/projects.gnome.org/anjuta/create-team-page.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -w
+
+## A script to format AUTHORS file for webpage
+
+my $authors_file = "authors.txt";
+my $page_file = "team.page";
+
+$page_file =~ s/\.txt$/.html/;
+
+print "Text file: $authors_file\n";
+print "Output page file: $page_file\n";
+
+my $team = `cat team.xml`;
+my ($team_top, $team_bottom) = split (/<!--contributors-->/, $team);
+
+open (AUTHORS_FILE, $authors_file) or
+    die "Cannot open $authors_file for reading";
+open (PAGE_FILE, ">$page_file") or
+    die "Cannot open $page_file for writing";
+
+print PAGE_FILE "$team_top\n";
+
+my $beginning = 0;
+while (my $line = <AUTHORS_FILE>)
+{
+    $line =~ s/</&lt;/gs;
+    $line =~ s/>/&gt;/gs;
+    $line =~ s/@/|&#064;|/gs;
+
+    next if (!$beginning && $line !~ m/Past Developers/);
+    $beginning = 1;
+
+    if ($line =~ m/Note:/)
+    {
+	# the end.
+	print PAGE_FILE "<p>\n";
+	print PAGE_FILE $line;
+	while (my $line = <AUTHORS_FILE>)
+	{
+	    next if ($line =~ m/^\-\-/gs);
+	    if ($line =~ m/^\s*$/gs)
+	    {
+		print PAGE_FILE "</p>\n";
+		print PAGE_FILE "$team_bottom\n";
+		exit;
+	    }
+	    print PAGE_FILE $line;
+	}
+    }
+    if ($line =~ m/^\w/gs)
+    {
+	$line =~ s/^\s+//;
+	$line =~ s/\s+$//;
+	print PAGE_FILE "<h2>$line</h2>\n";
+    }
+    elsif ($line =~ m/^\-/gs) {
+	print PAGE_FILE "<ul class=\"author-list\">\n";
+    }
+    elsif ($line =~ m/^\s+[^\s]/gs) {
+	$line =~ s/^\s+//;
+	$line =~ s/\s+$//;
+	print PAGE_FILE "\t<li class=\"author-list-item\">$line</li>\n";
+    }
+    elsif ($line =~ m/^\s*$/gs) {
+	print PAGE_FILE "</ul>\n";
+    }
+}



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