mirror of https://github.com/dyne/webnomad.git
Several improvements
exif: cleanup metadata, rotate and add comment on all jpegs social networks: opengraph and new image tag for SEO (A grades everywhere!) preview: fixes, also cycling of themes backend: now using zuper extended library of zfunctions
This commit is contained in:
parent
ccb3e64036
commit
aec4db9146
|
|
@ -3,7 +3,7 @@
|
|||
.--.--.--.-----| |--.-----.-----.--------.---.-.--| |
|
||||
| | | | -__| _ | | _ | | _ | _ |
|
||||
|________|_____|_____|__|__|_____|__|__|__|___._|_____|
|
||||
A slick and static website publisher v 0.4
|
||||
A slick and static website publisher
|
||||
|
||||
http://www.dyne.org/software/webnomad
|
||||
|
||||
|
|
|
|||
3
convert
3
convert
|
|
@ -26,7 +26,8 @@ CMD=`basename $0`
|
|||
return 1
|
||||
}
|
||||
|
||||
source ${DIR}/utils
|
||||
source ${DIR}/zuper
|
||||
source ${DIR}/zuper.init
|
||||
|
||||
DEBUG=1
|
||||
|
||||
|
|
|
|||
36
init
36
init
|
|
@ -22,7 +22,9 @@ QUIET=0
|
|||
DEBUG=0
|
||||
|
||||
SYS=`dirname $0`
|
||||
source $SYS/utils
|
||||
source $SYS/zuper
|
||||
|
||||
source $SYS/zuper.init
|
||||
|
||||
act "Initializing Webnomad"
|
||||
|
||||
|
|
@ -67,20 +69,36 @@ mkdir -p tmpl
|
|||
{ test -r config.zsh } || {
|
||||
cat <<EOF > config.zsh
|
||||
TITLE="A new website made with WebNomad."
|
||||
|
||||
DESCRIPTION="WebNomad, your slick and static website publisher, powered by HTML5, Zsh and Bootstrap"
|
||||
|
||||
KEYWORDS="web, design, html"
|
||||
|
||||
# representative image, 1200 pixel width is full column banner, 400 is half
|
||||
IMAGE="https://www.dyne.org/wp-content/uploads/2013/09/carciofo-webnomad.jpg"
|
||||
|
||||
# list of types: http://ogp.me/#types
|
||||
TYPE="website"
|
||||
|
||||
# What is the root of this website url, after the domain
|
||||
# full url includes http and no trailing slash i.e. http://www.dyne.org
|
||||
# leave blank if relative, or just subdir i.e /blog
|
||||
WEB_ROOT=""
|
||||
|
||||
# A twitter handler is necessary to activate open-graph compatible
|
||||
# information that works also with twitter.
|
||||
TWITTER="@DyneOrg"
|
||||
|
||||
#
|
||||
# Anything below is safe to leave untouched
|
||||
#
|
||||
|
||||
# Comment to disable Bootstrap
|
||||
BOOTSTRAP=1
|
||||
|
||||
# What file extension to use for html files
|
||||
EXTENSION=".html"
|
||||
|
||||
# What is the root of this website url, after the domain
|
||||
# leave blank if relative, or for instance /blog/
|
||||
WEB_ROOT=""
|
||||
|
||||
# What is the url for files in case indexing is used
|
||||
# this can be different from WEB_ROOT in order to serve
|
||||
# files from a position different from the web pages
|
||||
|
|
@ -93,7 +111,13 @@ WEB_ROOT=""
|
|||
# text size in an absolute way (we use Flowtype)
|
||||
# FONT_RATIO=30
|
||||
|
||||
|
||||
# Cleanup EXIF information from jpeg images (requires jhead)
|
||||
# i.e: location, camera type, time of shot, editors used
|
||||
EXIF_CLEAN=1
|
||||
# Add a comment to EXIF in jpeg images (requires jhead)
|
||||
# EXIF_COMMENT=""
|
||||
# Automatically rotate the image according to EXIF information
|
||||
# EXIF_ROTATE=1
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
|
|||
8
preview
8
preview
|
|
@ -21,7 +21,12 @@
|
|||
# full path to webnomad's system
|
||||
R="`pwd`"
|
||||
SYS="$R/webnomad"
|
||||
source $SYS/utils
|
||||
source $SYS/zuper
|
||||
vars=(BROWSER TIME_FORMAT OUTPUT_FORMAT SYS)
|
||||
vars=(views BROWSER_WINDOW_ID)
|
||||
source $SYS/zuper.init
|
||||
|
||||
source $R/config.zsh
|
||||
|
||||
BROWSER=${1:-firefox}
|
||||
TIME_FORMAT='%F %H:%M'
|
||||
|
|
@ -31,6 +36,7 @@ $SYS/render test
|
|||
$BROWSER $R/test/index.html &
|
||||
|
||||
views="
|
||||
$R/test
|
||||
$R/views
|
||||
$R/tmpl
|
||||
$R/config.zsh
|
||||
|
|
|
|||
142
render
142
render
|
|
@ -18,50 +18,45 @@
|
|||
# this source code; if not, write to:
|
||||
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
VERSION=0.3
|
||||
|
||||
QUIET=0
|
||||
|
||||
# full path to webnomad's system
|
||||
|
||||
SYS="`pwd`/webnomad"
|
||||
source $SYS/utils
|
||||
|
||||
source $SYS/zuper
|
||||
|
||||
vars+=(SYS DIR CMD dst)
|
||||
|
||||
vars+=(TITLE DESCRIPTION KEYWORDS TYPE IMAGE EXTENSION)
|
||||
vars+=(WEB_ROOT FILES_ROOT THUMB_SIZE BOOTSTRAP destination)
|
||||
vars+=(FLOWTYPE FONT_RATIO EXIF_CLEAN EXIF_COMMENT EXIF_ROTATE)
|
||||
vars+=(total_fonts cssfound)
|
||||
|
||||
arrs+=(includecss includejs fonts)
|
||||
arrs+=(custom_fonts)
|
||||
|
||||
source $SYS/zuper.init
|
||||
|
||||
|
||||
VERSION=0.5
|
||||
|
||||
# fill path to the source website root
|
||||
DIR="`pwd`"
|
||||
|
||||
CMD="$1"
|
||||
|
||||
{ test -r config.zsh } || {
|
||||
[[ -r config.zsh ]] || {
|
||||
error "Directory not configured for WebNomad. First use /webnomad/init"
|
||||
exit 1 }
|
||||
|
||||
|
||||
####################################
|
||||
# Base configuration
|
||||
|
||||
|
||||
# web root for all urls
|
||||
WEB_ROOT=""
|
||||
|
||||
# prefix to all indexed files
|
||||
# this can be a full path on the filesystem
|
||||
FILES_ROOT=""
|
||||
|
||||
# thumbnail size
|
||||
THUMB_SIZE=256
|
||||
|
||||
# font ratio
|
||||
FONT_RATIO=30
|
||||
return 1 }
|
||||
|
||||
source config.zsh
|
||||
|
||||
# thumbnail size
|
||||
THUMB_SIZE=${THUMB_SIZE:-256}
|
||||
|
||||
####################################
|
||||
|
||||
typeset -h dst
|
||||
|
||||
typeset -alU includecss # array of css files to include
|
||||
typeset -alU includejs # array of js files to include
|
||||
typeset -alU fonts # array of available fonts
|
||||
|
||||
# string match case insensitive
|
||||
unsetopt CASE_GLOB
|
||||
|
||||
|
|
@ -88,6 +83,11 @@ act "WEB_ROOT = $WEB_ROOT"
|
|||
render_file() { sed -e "s@\${baseurl}@${baseurl}@g" $@ }
|
||||
|
||||
render_header() {
|
||||
if [[ "$IMAGE" =~ "http://" ]] ; then
|
||||
_image=$IMAGE
|
||||
else
|
||||
_image=$WEB_ROOT/$IMAGE
|
||||
fi
|
||||
cat <<EOF
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
|
@ -99,7 +99,10 @@ render_header() {
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="Generator" content="WebNomad $VERSION - http://dyne.org/software/webnomad" />
|
||||
<meta name="MSSmartTagsPreventParsing" content="True" />
|
||||
EOF
|
||||
|
||||
[[ $BOOTSTRAP = 1 ]] && {
|
||||
cat <<EOF
|
||||
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements
|
||||
http://html5shim.googlecode.com/svn/trunk/html5.js -->
|
||||
<!--[if lt IE 9]>
|
||||
|
|
@ -110,11 +113,39 @@ render_header() {
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link href="${baseurl}/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="${baseurl}/css/bootstrap-responsive.css" rel="stylesheet" />
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
cat <<EOF
|
||||
<!-- Open Graph for social networks -->
|
||||
<meta property="og:title" content="$TITLE" />
|
||||
<meta property="og:description" content="$DESCRIPTION" />
|
||||
<meta property="og:type" content="$TYPE" />
|
||||
|
||||
EOF
|
||||
[[ "$WEB_ROOT" = "" ]] || {
|
||||
cat <<EOF
|
||||
<meta property="og:url" content="$WEB_ROOT" />
|
||||
EOF
|
||||
}
|
||||
cat <<EOF
|
||||
<meta property="og:image" content="$_image" />
|
||||
EOF
|
||||
|
||||
[[ "$TWITTER" = "" ]] || {
|
||||
cat <<EOF
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="$TWITTER">
|
||||
<meta name="twitter:title" content="$TITLE">
|
||||
<meta name="twitter:description" content="$DESCRIPTION">
|
||||
<meta name="twitter:image" content="$_image">
|
||||
|
||||
EOF
|
||||
}
|
||||
# include all css files found in views/css
|
||||
cssfound=`find $DIR/views/css -name '*.css'`
|
||||
cssfound=`find $DIR/views/css -iname '*.css'`
|
||||
|
||||
for c in ${(f)cssfound}; do
|
||||
includecss+=(${c##*/})
|
||||
done
|
||||
|
|
@ -131,6 +162,7 @@ EOF
|
|||
|
||||
cat <<EOF
|
||||
<link href="${baseurl}/css/${c}" rel="stylesheet" />
|
||||
|
||||
EOF
|
||||
if [[ -r "$DIR"/views/css/$c ]]; then
|
||||
cp -a $DIR/views/css/$c "${destination}"/css/
|
||||
|
|
@ -140,12 +172,10 @@ EOF
|
|||
|
||||
done
|
||||
|
||||
# add any argument string to header
|
||||
[[ "$1" = "" ]] || { print "${@}"; print }
|
||||
|
||||
# add the user configured header
|
||||
render_file "$DIR"/tmpl/header.html
|
||||
|
||||
|
||||
}
|
||||
|
||||
render_footer() {
|
||||
|
|
@ -346,17 +376,19 @@ calc_dest() {
|
|||
|
||||
#########
|
||||
# MAIN
|
||||
func MAIN
|
||||
|
||||
{ test "$1" = "source" } && { return 0 }
|
||||
{ test "$1" = "test" } && {
|
||||
act "Local test rendering inside test/"
|
||||
source $SYS/test }
|
||||
|
||||
# copy core bootstrap files in place
|
||||
# render the base skeleton dir tree
|
||||
mkdir -p "$destination/css"
|
||||
mkdir -p "$destination/js"
|
||||
mkdir -p "$destination/img"
|
||||
|
||||
[[ $BOOTSTRAP = 1 ]] && {
|
||||
#{ test -r "$destination"/css/bootstrap.css } || {
|
||||
cp "$SYS"/css/bootstrap.css "$destination"/css/
|
||||
cp "$SYS"/img/* "$destination"/img/
|
||||
|
|
@ -365,6 +397,11 @@ mkdir -p "$destination/img"
|
|||
#}
|
||||
cp "$SYS"/js/bootstrap.min.js "$destination"/js/
|
||||
cp "$SYS"/js/html5.js "$destination"/js/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -414,22 +451,25 @@ EOF
|
|||
# don't forget the navbar
|
||||
render_file "$DIR"/tmpl/navbar.html >> $dst
|
||||
|
||||
[[ $BOOTSTRAP = 1 ]] && {
|
||||
cat <<EOF >> $dst
|
||||
<p> </p>
|
||||
<div class="container-fluid">
|
||||
<article>
|
||||
EOF
|
||||
}
|
||||
|
||||
cat $src | render_html >> $dst
|
||||
|
||||
[[ $BOOTSTRAP = 1 ]] && {
|
||||
cat <<EOF >> $dst
|
||||
</article>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# includejs=(js/bootstrap.min.js)
|
||||
render_footer >> $dst
|
||||
|
||||
act "done"
|
||||
|
|
@ -488,9 +528,36 @@ idxs+=(`find views -type f -name '*.index'`)
|
|||
# copy to destination all subdirs in views/
|
||||
act -n "publishing all $B views $r ... "
|
||||
rsync -a -W --ignore-existing "$DIR/views/" "${destination}/"
|
||||
# make sure that new css styles are updates
|
||||
{ test -r "$DIR/views/css/custom.css" } && {
|
||||
# make sure that new css styles are updated
|
||||
[[ -r "$DIR/views/css/custom.css" ]] && {
|
||||
cp -f "$DIR/views/css/custom.css" "${destination}/css/" }
|
||||
|
||||
# Here all files are copied inside the destination
|
||||
# we can run special operations on file-types and overwrite them now
|
||||
# for instance edit EXIF information on images etc.
|
||||
|
||||
# clean up jpegs if jhead is installed
|
||||
command -v jhead && {
|
||||
jpegs=`find "$destination" -iname "*.jpg"`
|
||||
[[ $EXIF_CLEAN = 1 ]] && {
|
||||
for j in ${(f)jpegs}; do
|
||||
jhead -purejpg $j
|
||||
done
|
||||
}
|
||||
|
||||
[[ "$EXIF_COMMENT" != "" ]] && {
|
||||
for j in ${(f)jpegs}; do
|
||||
jhead -cl "$EXIF_COMMENT" $j
|
||||
done
|
||||
}
|
||||
[[ $EXIF_ROTATE = 1 ]] && {
|
||||
for j in ${(f)jpegs}; do
|
||||
jhead -autorot $j
|
||||
done
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[[ $QUIET = 1 ]] || print "done"
|
||||
|
||||
# if the whole website is a "slideshow" (set in config.zsh) then we start with
|
||||
|
|
@ -506,4 +573,3 @@ rsync -a -W --ignore-existing "$DIR/views/" "${destination}/"
|
|||
|
||||
|
||||
notice "Website refreshed."
|
||||
|
||||
|
|
|
|||
11
theme
11
theme
|
|
@ -31,12 +31,19 @@ CMD="`basename $0`"
|
|||
QUIET=0
|
||||
DEBUG=0
|
||||
|
||||
source ${DIR}/utils
|
||||
source ${DIR}/zuper
|
||||
|
||||
{ test -r config.zsh } || {
|
||||
error "Directory not configured for WebNomad. First use ./webnomad/init"
|
||||
exit 1 }
|
||||
return 1 }
|
||||
|
||||
source ${DIR}/zuper.init
|
||||
|
||||
source config.zsh
|
||||
|
||||
[[ $BOOTSTRAP = 1 ]] || {
|
||||
error "Bootstrap deactivated in config.zsh, no themes available"
|
||||
return 1 }
|
||||
|
||||
####################################
|
||||
|
||||
|
|
|
|||
54
update
54
update
|
|
@ -1,54 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
#
|
||||
# WebNomad, your slick and static website publisher
|
||||
#
|
||||
# Copyright (C) 2012-2013 Denis Roio <jaromil@dyne.org>
|
||||
#
|
||||
# This source code is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This source code is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# Please refer to the GNU Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Public License along with
|
||||
# this source code; if not, write to:
|
||||
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
{ test -r init } || {
|
||||
echo "Error: update must be run from inside the webnomad directory"
|
||||
return 1 }
|
||||
|
||||
source utils
|
||||
|
||||
# eventually these will need an update
|
||||
bootstrap2="http://getbootstrap.com/2.3.2/assets/bootstrap.zip"
|
||||
blueimp_gallery="https://github.com/blueimp/Gallery.git"
|
||||
|
||||
{ test "$1" = "" } || { test "$1" = "bootstrap" } && {
|
||||
notice "Downloading and installing the latest Bootstrap2"
|
||||
act "url: $bootstrap2"
|
||||
curl "$bootstrap2" -o bootstrap.zip
|
||||
unzip -q bootstrap.zip
|
||||
rsync -r bootstrap/css .
|
||||
rsync -r bootstrap/js .
|
||||
rsync -r bootstrap/img .
|
||||
rm -rf bootstrap bootstrap.zip
|
||||
act "Bootstrap2 installed"
|
||||
}
|
||||
|
||||
{ test "$1" = "" } || { test "$1" = "blueimp" } && {
|
||||
notice "Downloading and installing BlueImp gallery"
|
||||
git clone ${blueimp_gallery} blueimp
|
||||
rsync -r blueimp/css .
|
||||
rsync -r blueimp/js .
|
||||
rsync -r blueimp/img .
|
||||
rm -rf blueimp
|
||||
act "BlueImp installed"
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
/home/jrml/devel/zuper/zuper.init
|
||||
Loading…
Reference in New Issue