Intégration de la branche update-templates
This commit is contained in:
commit
ad88c99fc5
|
@ -19,7 +19,42 @@ OPTIONS
|
|||
-f, --overwrite
|
||||
Ecraser le fichier s'il existe déjà
|
||||
-E, --encoding ENCODING
|
||||
Spécifier l'encoding à utiliser pour la génération du fichier"
|
||||
Spécifier l'encoding à utiliser pour la génération du fichier
|
||||
--doctype DOCTYPE
|
||||
-4, --html4
|
||||
-5, --html5
|
||||
Spécifier le type de document. Les options -4 et -5 sont équivalentes à
|
||||
--doctype html4 et --doctype html5, respectivement.
|
||||
-U, --baseurl BASEURL
|
||||
Spécifier le chemin à partir de la racine qui contient les resources
|
||||
blueprint et bootstrap
|
||||
-B, --bpurl, --bsurl BPURL
|
||||
Spécifier le chemin sous BASURL à partir duquel charger blueprint ou
|
||||
bootstrap. La valeur par défaut est 'blueprint' pour l'option --bp,
|
||||
'bootstrap' pour l'option --bs
|
||||
-s, --bs, --bootstrap
|
||||
Activer le support de bootstrap. L'option --bs est automatiquement
|
||||
activée si l'option --bsurl n'est pas utilisée et le répertoire
|
||||
[BASEURL/]bootstrap/ existe
|
||||
-b, --bp, --blueprint
|
||||
Activer le support de blueprint. L'option --bp est automatiquement
|
||||
activée si l'option --bpurl n'est pas utilisée et le répertoire
|
||||
[BASEURL/]blueprint/ existe
|
||||
-n, --nobs, --no-bootstrap, --nobp, --no-blueprint
|
||||
Désactiver le support de bootstrap et blueprint
|
||||
-j, --jquery
|
||||
-k, --no-jquery
|
||||
Activer (resp. désactiver) le chargement de jQuery à partir de BASEURL
|
||||
pour les pages nues et avec blueprint. Avec bootstrap, le chargement de
|
||||
jQuery est toujours effectué et cette option est ignorée.
|
||||
--hl, --titlehl TITLEHL
|
||||
Spécifier le tag à utiliser pour le titre. Vaut par défaut 'h1' pour les
|
||||
templates HTML et PHP, 'h2' pour les templates overview et package
|
||||
-T, --title TITLE
|
||||
Spécifier le titre du document.
|
||||
--head-title HTITLE
|
||||
Spécifier le titre pour le tag <title> dans la section <head>. La valeur
|
||||
par défaut est celle de l'option --title."
|
||||
}
|
||||
|
||||
NAME=www
|
||||
|
@ -74,28 +109,114 @@ function __generate_html() {
|
|||
|
||||
local dir="$(dirname "$file")"
|
||||
local nobpsuppl nobplocal nobpmobile
|
||||
if [ "$blueprint" == auto ]; then
|
||||
if [ -d "$dir/blueprint" ]; then
|
||||
blueprint=1
|
||||
[ -f "$dir/bpsuppl.css" ] || nobpsuppl=1
|
||||
[ -f "$dir/bplocal.css" ] || nobplocal=1
|
||||
[ -f "$dir/bpmobile.css" ] || nobpmobile=1
|
||||
if [ "$csslib" == auto ]; then
|
||||
if [ -n "$bpurl" ]; then
|
||||
if [ "$bpurl" == bootstrap -o -z "${bpurl##*/bootstrap}" ]; then
|
||||
csslib=bootstrap
|
||||
elif [ "$bpurl" == blueprint -o -z "${bpurl##*/blueprint}" ]; then
|
||||
csslib=blueprint
|
||||
else
|
||||
csslib=
|
||||
fi
|
||||
elif [ -d "$dir/${baseurl#/}bootstrap" ]; then
|
||||
csslib=bootstrap
|
||||
elif [ -d "$dir/${baseurl#/}blueprint" ]; then
|
||||
csslib=blueprint
|
||||
else
|
||||
blueprint=
|
||||
csslib=
|
||||
fi
|
||||
fi
|
||||
if [ "$csslib" == bootstrap ]; then
|
||||
[ -n "$bpurl" ] || bpurl=bootstrap
|
||||
elif [ "$csslib" == blueprint ]; then
|
||||
[ -n "$bpurl" ] || bpurl=blueprint
|
||||
[ -f "$dir/${baseurl#/}bpsuppl.css" ] || nobpsuppl=1
|
||||
[ -f "$dir/${baseurl#/}bplocal.css" ] || nobplocal=1
|
||||
[ -f "$dir/${baseurl#/}bpmobile.css" ] || nobpmobile=1
|
||||
fi
|
||||
|
||||
bpurl="$baseurl$bpurl"
|
||||
[ "${bpurl:$((-1)):1}" == / ] || bpurl="$bpurl/"
|
||||
|
||||
local jquerymin
|
||||
if [ "$jquery" == auto ]; then
|
||||
if [ -f "$dir/jquery.min.js" ]; then
|
||||
if [ "$csslib" == bootstrap ]; then
|
||||
jquery=
|
||||
elif [ -f "$dir/${baseurl#/}jquery.min.js" ]; then
|
||||
jquery=1
|
||||
jquerymin=1
|
||||
elif [ -d "$dir/jquery.js" ]; then
|
||||
elif [ -f "$dir/${baseurl#/}jquery.js" ]; then
|
||||
jquery=1
|
||||
else
|
||||
jquery=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$doctype" == auto ]; then
|
||||
if [ "$csslib" == bootstrap ]; then
|
||||
doctype=html5
|
||||
else
|
||||
doctype=html4
|
||||
fi
|
||||
fi
|
||||
head='<head>'
|
||||
if [ "$doctype" == html5 ]; then
|
||||
head="$head
|
||||
"'<meta charset="'"$encoding"'">'
|
||||
else
|
||||
head="$head
|
||||
"'<meta http-equiv="Content-Type" content="text/html; charset='"$encoding"'" />'
|
||||
fi
|
||||
|
||||
if [ "$csslib" == bootstrap ]; then
|
||||
head="$head
|
||||
"'<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="shortcut" href="'"$bpurl"'favicon.ico" />
|
||||
<link rel="icon apple-touch-icon" href="'"$bpurl"'icon.png" />'
|
||||
csslib='<link href="'"$bpurl"'bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
<script src="'"$bpurl"'jquery.min.js" type="text/javascript"></script>
|
||||
<script src="'"$bpurl"'bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="'"$bpurl"'html5shiv/html5shiv.js"></script>
|
||||
<script src="'"$bpurl"'respond/respond.min.js"></script>
|
||||
<![endif]-->'
|
||||
startcl='<div class="container">'
|
||||
endcl='</div>'
|
||||
elif [ "$csslib" == blueprint ]; then
|
||||
head="$head
|
||||
"'<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="shortcut" href="'"$baseurl"'favicon.ico" />
|
||||
<link rel="icon apple-touch-icon" href="'"$baseurl"'icon.png" />'
|
||||
csslib='<link rel="stylesheet" href="'"$bpurl"'screen.css" type="text/css" media="screen, projection" />
|
||||
<link rel="stylesheet" href="'"$bpurl"'print.css" type="text/css" media="print" />
|
||||
<!--[if lt IE 8]>
|
||||
<link rel="stylesheet" href="'"$bpurl"'ie.css" type="text/css" media="screen, projection" />
|
||||
<![endif]-->
|
||||
<'"${nobpsuppl:+!--}"'link rel="stylesheet" href="'"$baseurl"'bpsuppl.css" type="text/css" media="screen, projection" /'"${nobpsuppl:+--}"'>
|
||||
<'"${nobplocal:+!--}"'link rel="stylesheet" href="'"$baseurl"'bplocal.css" type="text/css" media="screen, projection" /'"${nobplocal:+--}"'>
|
||||
<'"${nobpmobile:+!--}"'link rel="stylesheet" href="'"$baseurl"'bpmobile.css" type="text/css" media="handheld, only screen and (max-device-width: 480px)" /'"${nobpmobile:+--}"'>'
|
||||
startcl='<div class="container">'
|
||||
endcl='</div>'
|
||||
else
|
||||
# pas de csslib ou csslib non supporté
|
||||
head="$head
|
||||
"'<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="shortcut" href="'"$baseurl"'favicon.ico" />
|
||||
<link rel="icon apple-touch-icon" href="'"$baseurl"'icon.png" />'
|
||||
csslib=
|
||||
startcl=
|
||||
endcl=
|
||||
fi
|
||||
if [ -n "$jquery" ]; then
|
||||
jquery='<script src="'"${baseurl}jquery${jquerymin:+.min}.js"'"></script>'
|
||||
fi
|
||||
start='<title>'"$head_title"'</title>
|
||||
</head>
|
||||
<body>'
|
||||
end='</body>
|
||||
</html>'
|
||||
|
||||
case "$doctype" in
|
||||
html4)
|
||||
doctype='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
|
||||
|
@ -110,27 +231,6 @@ function __generate_html() {
|
|||
html='<html>'
|
||||
;;
|
||||
esac
|
||||
head='<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset='"$encoding"'" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="shortcut" href="'"$baseurl"'favicon.ico" />
|
||||
<link rel="icon apple-touch-icon" href="'"$baseurl"'icon.png" />'
|
||||
[ -n "$blueprint" ] && blueprint='<link rel="stylesheet" href="'"$bpurl"'screen.css" type="text/css" media="screen, projection" />
|
||||
<link rel="stylesheet" href="'"$bpurl"'print.css" type="text/css" media="print" />
|
||||
<!--[if lt IE 8]>
|
||||
<link rel="stylesheet" href="'"$bpurl"'ie.css" type="text/css" media="screen, projection" />
|
||||
<![endif]-->
|
||||
<'"${nobpsuppl:+!--}"'link rel="stylesheet" href="bpsuppl.css" type="text/css" media="screen, projection" /'"${nobpsuppl:+--}"'>
|
||||
<'"${nobplocal:+!--}"'link rel="stylesheet" href="bplocal.css" type="text/css" media="screen, projection" /'"${nobplocal:+--}"'>
|
||||
<'"${nobpmobile:+!--}"'link rel="stylesheet" href="bpmobile.css" type="text/css" media="handheld, only screen and (max-device-width: 480px)" /'"${nobpmobile:+--}"'>'
|
||||
[ -n "$jquery" ] && jquery='<script src="'"${baseurl}jquery${jquerymin:+.min}.js"'"></script>'
|
||||
start='<title>'"$head_title"'</title>
|
||||
</head>
|
||||
<body>'
|
||||
startbp='<div class="container">'
|
||||
endbp='</div>'
|
||||
end='</body>
|
||||
</html>'
|
||||
}
|
||||
function __before_write_html() {
|
||||
doctype="$doctype<!-- -*- coding: $encoding ${mode:+mode: $mode }-*- vim:sw=4:sts=4:et:ai:si:sta:fenc=$encoding
|
||||
|
@ -142,12 +242,12 @@ function __write_html() {
|
|||
estep "$(ppath "$file")"
|
||||
echo >"$file" "$doctype$html
|
||||
$head
|
||||
${blueprint:+$blueprint
|
||||
${csslib:+$csslib
|
||||
}${jquery:+$jquery
|
||||
}$start
|
||||
${blueprint:+$startbp
|
||||
${csslib:+$startcl
|
||||
}${title:+<$titlehl>$title</$titlehl>
|
||||
}${blueprint:+$endbp
|
||||
}${csslib:+$endcl
|
||||
}$end"
|
||||
}
|
||||
|
||||
|
@ -160,9 +260,9 @@ function generate_html() {
|
|||
__update_title
|
||||
|
||||
local doctype="$doctype"
|
||||
local blueprint="$blueprint"
|
||||
local csslib="$csslib"
|
||||
local jquery="$jquery"
|
||||
local html head start startbp endbp end
|
||||
local html head start startcl endcl end
|
||||
__generate_html
|
||||
__before_write_html
|
||||
__write_html
|
||||
|
@ -184,9 +284,7 @@ function generate_javadoc_package() {
|
|||
title="Package: $title"
|
||||
|
||||
local doctype="$doctype"
|
||||
local blueprint=
|
||||
local jquery=
|
||||
local html head start startbp endbp end
|
||||
local csslib bootstrap jquery html head start startcl endcl end
|
||||
__generate_html
|
||||
__before_write_html
|
||||
__write_html
|
||||
|
@ -208,9 +306,7 @@ function generate_javadoc_overview() {
|
|||
title="Projet: $title"
|
||||
|
||||
local doctype="$doctype"
|
||||
local blueprint=
|
||||
local jquery=
|
||||
local html head start startbp endbp end
|
||||
local csslib bootstrap jquery html head start startcl endcl end
|
||||
__generate_html
|
||||
__before_write_html
|
||||
__write_html
|
||||
|
@ -228,9 +324,9 @@ function generate_php() {
|
|||
__update_title
|
||||
|
||||
local doctype="$doctype"
|
||||
local blueprint="$blueprint"
|
||||
local csslib="$csslib"
|
||||
local jquery="$jquery"
|
||||
local html head start startbp endbp end
|
||||
local html head start startcl endcl end
|
||||
__generate_html
|
||||
doctype="<?php # -*- coding: $encoding ${mode:+mode: $mode }-*- vim:sw=2:sts=2:et:ai:si:sta:fenc=$encoding
|
||||
?>${doctype:+$doctype
|
||||
|
@ -283,12 +379,11 @@ template=
|
|||
edit=1
|
||||
overwrite=
|
||||
encoding=
|
||||
#executable=
|
||||
doctype=auto
|
||||
baseurl=/
|
||||
doctype=html4
|
||||
blueprint=auto
|
||||
jquery=auto
|
||||
bpurl=
|
||||
csslib=auto
|
||||
jquery=auto
|
||||
titlehl=
|
||||
title=
|
||||
head_title=
|
||||
|
@ -303,23 +398,19 @@ parse_opts "${PRETTYOPTS[@]}" \
|
|||
-4,--html4 doctype=html4 \
|
||||
-5,--html5 doctype=html5 \
|
||||
-U:,--baseurl: baseurl= \
|
||||
-b,--blueprint,--bp blueprint=1 \
|
||||
-n,--no-blueprint,--noblueprint,--nobp blueprint= \
|
||||
-B:,--bpurl:,--bsurl: bpurl= \
|
||||
-s,--bootstrap,--bs csslib=bootstrap \
|
||||
-b,--blueprint,--bp csslib=blueprint \
|
||||
-n,--no-bootstrap,--nobootstrap,--nobs,--no-blueprint,--noblueprint,--nobp csslib= \
|
||||
-j,--jquery jquery=1 \
|
||||
-k,--no-jquery,--nojquery jquery= \
|
||||
-B:,--bpurl: bpurl= \
|
||||
--titlehl:,--hl: titlehl= \
|
||||
-T:,--title: title= \
|
||||
--head-title: head_title= \
|
||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||
# à rajouter ci-dessus si les fichiers peuvent être exécutables:
|
||||
#-x,--executable executable=1 \
|
||||
#-n,--no-executable executable= \
|
||||
|
||||
[ -n "$encoding" ] || encoding=utf-8
|
||||
[ -z "$baseurl" -o "${baseurl:$((-1)):1}" == / ] || baseurl="$baseurl/"
|
||||
[ -n "$bpurl" ] || bpurl="${baseurl}blueprint/"
|
||||
[ "${bpurl:$((-1)):1}" == / ] || bpurl="$bpurl/"
|
||||
|
||||
files2edit=()
|
||||
r=0
|
||||
|
|
Loading…
Reference in New Issue