/[MITgcm]/mitgcm.org/front_content/Assemble.pl
ViewVC logotype

Contents of /mitgcm.org/front_content/Assemble.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Dec 3 03:36:29 2003 UTC (20 years, 5 months ago) by edhill
Branch: MAIN
File MIME type: text/plain
 o possible new web pages

1 #! /usr/bin/env perl
2
3 # Ed Hill
4 # Tue Dec 2 20:17:27 EST 2003
5
6 # Assemble the web pages from XML files.
7
8 open(TOP,"<top_list.txt") or die "ERROR: can't open \"top_list.txt\"\n";
9 while($line = <TOP>) {
10 chomp($line);
11 length($line) > 0 and @top_list[$top_list++] = $line;
12 }
13
14 open(TEMPL,"<template.xml") or die "ERROR: can't open \"template.xml\"\n";
15 $template = join "", <TEMPL>;
16
17 mkdir html;
18
19 foreach $file (@top_list) {
20
21 $fname = "<./" . $file . ".xml";
22 open(INF,$fname) or die "ERROR: can't open \"$fname\"\n";
23 $f_all = join "", <INF>;
24
25 $_ = $f_all;
26 /<body>(.*)<\/body>/s and $body = $1;
27
28 $_ = $f_all;
29 /<meta *name="add_title" *content="(.*)"/ and $title = $1;
30
31 $_ = $f_all;
32 /<meta *name="add_name_0" *content="(.*)"/ and $name = $1;
33
34 $menu = "";
35 foreach $f (@top_list) {
36 if ($f ne $file) {
37 $tmp = "<a href=\"./" . $f . ".html\">" . $f . "</a><br />\n";
38 } else {
39 $tmp = "<b>" . $name . "</b>\n";
40 }
41 $menu = join "", $menu, $tmp;
42 }
43
44 $_ = $template;
45 s/<!--ADDTITLE-->/$title/s;
46 s/<!--ADDMENU-->/$menu/s;
47 s/<!--ADDCONTENT-->/$body/s;
48
49 $out_name = ">./html/" . $file . ".html";
50 open(OUT,$out_name) or die "ERROR: can't open \"$out_name\"\n";
51 print OUT $_;
52
53 close(OUT);
54 close(INF);
55 }
56

  ViewVC Help
Powered by ViewVC 1.1.22