#!/usr/bin/perl
$LongerName{admin} = "Administration";
$LongerName{config} = "Configuration/Setup";
$LongerName{config} = "How does ...";
chdir("data");
foreach $f (<*.html>) {
next if ($f eq "index.html");
open(CONTENTS, "<$f") || die "Cannot open $f\n";
my($Contents) = join(' ', <CONTENTS>);
close(CONTENTS);
$Grouping = $1 if ($Contents =~ /Grouping:\s*(\S+)/i);
$Contents =~ s/\n/ /g;
$Contents =~ s/\s*\<\/h2\>.*//;
$Contents =~ s/.*\<h2\>\s*//;
$Contents =~ s/^\s*\d+\s*:\s*//;
print "Processing $f:\n\t$Contents\n";
$Questions{$f} = $Contents;
$Groups{$Grouping} .= (($Groups{$Grouping} eq "") ? "" : ",") . $f;
}
open(INDEXFILE, ">index.html") || die "Cannot open index.html\n";
print INDEXFILE "<body><html><h1>FAQs taken from Customer Support calls</h1>\n";
foreach $g (sort keys %Groups) {
if ($LongerName{$g} eq "") {
print INDEXFILE "<h3>$g</h3>\n";
} else {
print INDEXFILE "<h3>$LongerName{$g}</h3>\n";
}
print INDEXFILE "<bl>\n";
foreach $q (split(",", $Groups{$g})) {
print INDEXFILE "<li>\n";
print INDEXFILE " <a href=$q>$Questions{$q}</a>\n";
print INDEXFILE "</li>\n";
}
print INDEXFILE "</bl>\n";
}
close(INDEXFILE);
print "Done!\n";
# |
Change |
User |
Description |
Committed |
|
#1
|
69 |
Jeff Bowles |
First round of raw KB data. |
|
|