123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #!/bin/sh
- # Generate html giving the list of pages in a website
- # usage : $0 [directory of site] > website_plan.html
- DIR="$1"
- parse_dir() {
- LIST=$(ls $1)
- for i in $LIST; do
- if [ -d "$1/$i" ] && [ -f "$1/$i/index.html" ]; then
- echo "<li><a href=\"$(echo "$1/$i" |sed -e "s,$DIR,,g")/index.html\">$i</a></li>"
- echo "<ul>"
- parse_dir "$1/$i"
- echo "</ul>"
- else
- echo "<li><a href=\"$(echo "$1/$i" |sed -e "s,$DIR,,g")\">$i</a></li>"
- fi
- done
- }
- if [ ! -d "$1" ]; then
- echo "can't find $1"
- echo "usage $0 [directory containing website]"
- exit 1
- fi
- # Load config file
- if [ ! -f $PWD/swx.conf ]; then
- echo "Cannot find swx.conf in current directory"
- exit 1
- fi
- . $PWD/swx.conf
- echo "<!doctype html>"
- echo "<html>"
- echo "<head>"
- echo "<title>Plan du site</title>"
- echo "<link rel="icon" href="/favicon.png" type="image/png">"
- echo "<meta charset="UTF-8">"
- echo "<link rel="stylesheet" type="text/css" href="/style.css">"
- echo "</head>"
- echo "<body>"
- echo "<div id=\"main\">"
- echo "☺ Utilisez la fonction recherche de votre navigateur (ctrl-f) pour trouver votre bonheur"
- echo "<ul>"
- parse_dir "$1"
- echo "</ul>"
- echo "</div>"
- echo "</body>"
- echo "</html>"
|