diff options
| author | Paul C. Buetow (mars.fritz.box) <paul@buetow.org> | 2014-04-27 12:34:02 +0200 |
|---|---|---|
| committer | Paul C. Buetow (mars.fritz.box) <paul@buetow.org> | 2014-04-27 12:34:02 +0200 |
| commit | 7c110eed4873d7805db304f957278320e5aea0c7 (patch) | |
| tree | 2f051e98538a3a6d2388a433e2fef0d044059828 /sitemap.buetow.org | |
| parent | 5bfc5a3dc49dae9aad6a4bd7422ab11a4d56d56a (diff) | |
add sitemap.inc.pl
Diffstat (limited to 'sitemap.buetow.org')
| -rw-r--r-- | sitemap.buetow.org/content/home.xml | 41 | ||||
| -rw-r--r-- | sitemap.buetow.org/content/sitemap.inc.pl | 36 |
2 files changed, 37 insertions, 40 deletions
diff --git a/sitemap.buetow.org/content/home.xml b/sitemap.buetow.org/content/home.xml index 39e615f..283cd7e 100644 --- a/sitemap.buetow.org/content/home.xml +++ b/sitemap.buetow.org/content/home.xml @@ -15,45 +15,6 @@ </text> </information> <text> - <perl> - # Ugly but works for now - my $hostroot = $config->get_hostroot(); - - sub getf ($) { - open my $f, $_[0] or die "$!: $_[0]\n"; - my @slurp = !!LT!!$f!!GT!!; - close $f; - @slurp; - } - - sub nl () { "!!LT!!br /!!GT!!\n" } - - sub list (*) { - my $tag = shift; - my @found = sort `find $hostroot -name $tag`; - my $ret = ''; - - - for my $found (@found) { - $found =~ /.*hosts.(.*?).$tag/; - my $host = $1; - - my @content = getf $found; - - $ret .= "!!LT!!b!!GT!!!!LT!!a href=http://$host!!GT!!$host!!LT!!/a!!GT!!!!LT!!/b!!GT!!" . nl;; - if (@content) { - $ret .= join " ", @content; - $ret .= nl; - } - $ret .= nl; - } - - $ret; - } - - my $ret = list SITEMAP; - - $ret; - </perl> + <run>sitemap.inc.pl</run> </text> </content> diff --git a/sitemap.buetow.org/content/sitemap.inc.pl b/sitemap.buetow.org/content/sitemap.inc.pl new file mode 100644 index 0000000..37740e7 --- /dev/null +++ b/sitemap.buetow.org/content/sitemap.inc.pl @@ -0,0 +1,36 @@ +my $hostroot = $config->get_hostroot(); + +sub getf ($) { + open my $f, $_[0] or die "$!: $_[0]\n"; + my @slurp = <$f>; + close $f; + @slurp; +} + +sub nl () { "<br />\n" } + +sub list (*) { + my $tag = shift; + my @found = sort `find $hostroot -name $tag`; + my $ret = ''; + + + for my $found (@found) { + $found =~ /.*hosts.(.*?).$tag/; + my $host = $1; + + my @content = getf $found; + + $ret .= "<b><a href=http://$host>$host</a></b>" . nl;; + + if (@content) { + $ret .= join " ", @content; + $ret .= nl; + } + $ret .= nl; + } + + $ret; +} + +list SITEMAP; |
