Commit 555d9974 authored by Thuban's avatar Thuban
Browse files

update to 0.9

parent bebc1ffa
......@@ -10,16 +10,19 @@ if [ ! -f $PWD/swx.conf ] || [ ! -f $PWD/swx.template ]; then
echo "Cannot find swx.conf or swx.template in current directory"
exit 1
fi
if [ ! $# -eq 1 ]; then
echo "usage $0 source_directory"
exit 1
fi
. $PWD/swx.conf
. $PWD/swx.functions
# Set input dir
setdirs "${1}"
if [ $# -eq 1 ]; then
start_time=$(date +%s)
generate
end_time=$(date +%s)
echo "Site generated in $(($end_time - $start_time))s."
fi
updateordie
# generate create the website
generate
......@@ -4,18 +4,26 @@
# Remember to add a link in your html template such as :
# <link href="feed.atom" type="application/atom+xml" rel="alternate" title="Sitewide Atom feed" />
# Load config file
if [ ! -f $PWD/swx.conf ]; then
echo "Cannot find swx.conf in current directory"
exit 1
fi
. $PWD/swx.conf
if [ $# -ne 1 ]; then
echo "usage $0 <dir> > atom.xml"
exit
fi
. $PWD/swx.conf
. $PWD/swx.functions
setdirs "${1}"
updateordie
if [ -z $(uname |grep "BSD") ]; then
STAT=$(stat -f %w "${WITNESS}")
UPDATED="$(date -ud @${STAT} +%Y-%m-%dT%TZ)"
else
STAT=$(stat -f %m "${WITNESS}")
UPDATED=$(date -ur ${STAT} +%Y-%m-%dT%TZ)
fi
cat <<EOF
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
......@@ -23,7 +31,7 @@ cat <<EOF
<title>${TITLE}</title>
<subtitle>${SUBTITLE}</subtitle>
<link href="${PROTOCOL}${HOSTNAME}"/>
<updated>$(date -u +%Y-%m-%dT%TZ)</updated>
<updated>${UPDATED}</updated>
<author>
<name>${AUTHOR}</name>
<email>${EMAIL}</email>
......@@ -57,7 +65,7 @@ for i in ${RECENTS}; do
STAT=$(stat -f %w "${i}")
UPDATED="$(date -ud @${STAT} +%Y-%m-%dT%TZ)"
CREATION_DATE=$(date -ud @${STAT} +%Y-%m-%d)
# If you wan't to have reald updated time, use this :
# If you wan't to have real updated time, not creation time, use this :
#UPDATED="$(date -ud @`stat -t ${i}|cut -f13 -d\ ` +%Y-%m-%dT%TZ)"
#CREATION_DATE=$(date -ud @$(stat -f %w "${i}") +%Y-%m-%d)
else
......
......@@ -5,23 +5,16 @@
# if ":::BLOG:::" ($NEWSSTR) is found in $NEWSPAGE, it will be replaced by recent articles
# change it in swx.conf
# Load config file
if [ ! -f $PWD/swx.conf ]; then
echo "Cannot find swx.conf in current directory"
exit 1
fi
. $PWD/swx.conf
. $PWD/swx.functions
setdirs "${1}"
updateordie
if [ $# -ne 1 ]; then
echo "usage $0 <dir>"
exit
fi
. $PWD/swx.conf
. $PWD/swx.functions
setdirs "${1}"
WORKTMP=$(mktemp)
while read line; do
......@@ -49,7 +42,7 @@ while read line; do
# PUBDATE="$(date -r $(stat -f %c "$i") +%d/%m/%Y-%H:%M)"
#fi
echo "<div class=\"clear news_link\">"
echo "<div class=\"news_link\">"
echo "<a href=\"${URL}\"><span class=\"news_title\">$NEWTITLE</span></a>"
echo "</div>"
done
......
#!/bin/sh
# Generate html giving the list of pages in a website
# usage : $0 [directory of site] > website_plan.html
. $PWD/swx.conf
. $PWD/swx.functions
setdirs "${1}"
updateordie
DIR="${1}"
......@@ -29,8 +33,6 @@ 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>"
......
......@@ -2,15 +2,14 @@
# création d'un sitemap xml.
# usage : swx_sitemap /dossier/contenant/le/site > sitemap.xml
. $PWD/swx.conf
. $PWD/swx.functions
setdirs "${1}"
updateordie
DIR="$1"
LASTMOD=$(date +%Y-%m-%d)
# Load config file
if [ ! -f $PWD/swx.conf ]; then
echo "Cannot find swx.conf in current directory"
exit 1
fi
. $PWD/swx.conf
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment