From c52031b38a98b0646a196a30749af988b8442e05 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 23 Feb 2017 16:33:08 +0400 Subject: [PATCH 1/2] maj de la description --- lib/templates/www | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/lib/templates/www b/lib/templates/www index 755e66c..0b7797a 100755 --- a/lib/templates/www +++ b/lib/templates/www @@ -19,7 +19,43 @@ 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 + -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 + -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 + -n, --nobp, --no-blueprint, --nobs, --no-bootstrap + Désactiver le support de blueprint et bootstrap. Le fichier HTML est + généré. + -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 dans la section <head>. La valeur + par défaut est celle de l'option --title." } NAME=www @@ -283,7 +319,6 @@ template= edit=1 overwrite= encoding= -#executable= baseurl=/ doctype=html4 blueprint=auto @@ -312,9 +347,6 @@ parse_opts "${PRETTYOPTS[@]}" \ -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/" From 532d21d2a47c09b91cbcf2c500678e3fe91ad12b Mon Sep 17 00:00:00 2001 From: Jephte Clain <Jephte.Clain@univ-reunion.fr> Date: Thu, 23 Feb 2017 20:40:04 +0400 Subject: [PATCH 2/2] =?UTF-8?q?support=20de=20la=20g=C3=A9n=C3=A9ration=20?= =?UTF-8?q?de=20pages=20html=20avec=20bootstrap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/templates/www | 175 +++++++++++++++++++++++++++++++--------------- 1 file changed, 117 insertions(+), 58 deletions(-) diff --git a/lib/templates/www b/lib/templates/www index 0b7797a..b99c203 100755 --- a/lib/templates/www +++ b/lib/templates/www @@ -32,17 +32,16 @@ OPTIONS 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 - -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 -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 - -n, --nobp, --no-blueprint, --nobs, --no-bootstrap - Désactiver le support de blueprint et bootstrap. Le fichier HTML est - généré. + -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 @@ -110,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"' + +' + end=' +' + case "$doctype" in html4) doctype='' @@ -146,27 +231,6 @@ function __generate_html() { html='' ;; esac - head=' - - - -' - [ -n "$blueprint" ] && blueprint=' - - -<'"${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='' - start=''"$head_title"' - -' - startbp='
' - endbp='
' - end=' -' } function __before_write_html() { doctype="$doctype