From 7c110eed4873d7805db304f957278320e5aea0c7 Mon Sep 17 00:00:00 2001 From: "Paul C. Buetow (mars.fritz.box)" Date: Sun, 27 Apr 2014 12:34:02 +0200 Subject: add sitemap.inc.pl --- sitemap.buetow.org/content/home.xml | 41 +------------------------------ sitemap.buetow.org/content/sitemap.inc.pl | 36 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 40 deletions(-) create mode 100644 sitemap.buetow.org/content/sitemap.inc.pl (limited to 'sitemap.buetow.org') 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 @@ - - # 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; - + sitemap.inc.pl 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 () { "
\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 .= "$host" . nl;; + + if (@content) { + $ret .= join " ", @content; + $ret .= nl; + } + $ret .= nl; + } + + $ret; +} + +list SITEMAP; -- cgit v1.2.3