support de la génération de pages html avec bootstrap
This commit is contained in:
		
							parent
							
								
									c52031b38a
								
							
						
					
					
						commit
						532d21d2a4
					
				| @ -32,17 +32,16 @@ OPTIONS | |||||||
|         Spécifier le chemin sous BASURL à partir duquel charger blueprint ou |         Spécifier le chemin sous BASURL à partir duquel charger blueprint ou | ||||||
|         bootstrap. La valeur par défaut est 'blueprint' pour l'option --bp, |         bootstrap. La valeur par défaut est 'blueprint' pour l'option --bp, | ||||||
|         'bootstrap' pour l'option --bs |         '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 |     -s, --bs, --bootstrap | ||||||
|         Activer le support de bootstrap. L'option --bs est automatiquement |         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 |         activée si l'option --bsurl n'est pas utilisée et le répertoire | ||||||
|         [BASEURL/]bootstrap/ existe |         [BASEURL/]bootstrap/ existe | ||||||
|     -n, --nobp, --no-blueprint, --nobs, --no-bootstrap |     -b, --bp, --blueprint | ||||||
|         Désactiver le support de blueprint et bootstrap. Le fichier HTML est |         Activer le support de blueprint. L'option --bp est automatiquement | ||||||
|         généré. |         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 |     -j, --jquery | ||||||
|     -k, --no-jquery |     -k, --no-jquery | ||||||
|         Activer (resp. désactiver) le chargement de jQuery à partir de BASEURL |         Activer (resp. désactiver) le chargement de jQuery à partir de BASEURL | ||||||
| @ -110,28 +109,114 @@ function __generate_html() { | |||||||
| 
 | 
 | ||||||
|     local dir="$(dirname "$file")" |     local dir="$(dirname "$file")" | ||||||
|     local nobpsuppl nobplocal nobpmobile |     local nobpsuppl nobplocal nobpmobile | ||||||
|     if [ "$blueprint" == auto ]; then |     if [ "$csslib" == auto ]; then | ||||||
|         if [ -d "$dir/blueprint" ]; then |         if [ -n "$bpurl" ]; then | ||||||
|             blueprint=1 |             if [ "$bpurl" == bootstrap -o -z "${bpurl##*/bootstrap}" ]; then | ||||||
|             [ -f "$dir/bpsuppl.css" ] || nobpsuppl=1 |                 csslib=bootstrap | ||||||
|             [ -f "$dir/bplocal.css" ] || nobplocal=1 |             elif [ "$bpurl" == blueprint -o -z "${bpurl##*/blueprint}" ]; then | ||||||
|             [ -f "$dir/bpmobile.css" ] || nobpmobile=1 |                 csslib=blueprint | ||||||
|  |             else | ||||||
|  |                 csslib= | ||||||
|  |             fi | ||||||
|  |         elif [ -d "$dir/${baseurl#/}bootstrap" ]; then | ||||||
|  |             csslib=bootstrap | ||||||
|  |         elif [ -d "$dir/${baseurl#/}blueprint" ]; then | ||||||
|  |             csslib=blueprint | ||||||
|         else |         else | ||||||
|             blueprint= |             csslib= | ||||||
|         fi |         fi | ||||||
|     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 |     local jquerymin | ||||||
|     if [ "$jquery" == auto ]; then |     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 |             jquery=1 | ||||||
|             jquerymin=1 |             jquerymin=1 | ||||||
|         elif [ -d "$dir/jquery.js" ]; then |         elif [ -f "$dir/${baseurl#/}jquery.js" ]; then | ||||||
|             jquery=1 |             jquery=1 | ||||||
|         else |         else | ||||||
|             jquery= |             jquery= | ||||||
|         fi |         fi | ||||||
|     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 |     case "$doctype" in | ||||||
|     html4) |     html4) | ||||||
|         doctype='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' |         doctype='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' | ||||||
| @ -146,27 +231,6 @@ function __generate_html() { | |||||||
|         html='<html>' |         html='<html>' | ||||||
|         ;; |         ;; | ||||||
|     esac |     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() { | function __before_write_html() { | ||||||
|     doctype="$doctype<!-- -*- coding: $encoding ${mode:+mode: $mode }-*- vim:sw=4:sts=4:et:ai:si:sta:fenc=$encoding |     doctype="$doctype<!-- -*- coding: $encoding ${mode:+mode: $mode }-*- vim:sw=4:sts=4:et:ai:si:sta:fenc=$encoding | ||||||
| @ -178,12 +242,12 @@ function __write_html() { | |||||||
|     estep "$(ppath "$file")" |     estep "$(ppath "$file")" | ||||||
|     echo >"$file" "$doctype$html |     echo >"$file" "$doctype$html | ||||||
| $head | $head | ||||||
| ${blueprint:+$blueprint | ${csslib:+$csslib | ||||||
| }${jquery:+$jquery | }${jquery:+$jquery | ||||||
| }$start | }$start | ||||||
| ${blueprint:+$startbp | ${csslib:+$startcl | ||||||
| }${title:+<$titlehl>$title</$titlehl> | }${title:+<$titlehl>$title</$titlehl> | ||||||
| }${blueprint:+$endbp | }${csslib:+$endcl | ||||||
| }$end" | }$end" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -196,9 +260,9 @@ function generate_html() { | |||||||
|     __update_title |     __update_title | ||||||
| 
 | 
 | ||||||
|     local doctype="$doctype" |     local doctype="$doctype" | ||||||
|     local blueprint="$blueprint" |     local csslib="$csslib" | ||||||
|     local jquery="$jquery" |     local jquery="$jquery" | ||||||
|     local html head start startbp endbp end |     local html head start startcl endcl end | ||||||
|     __generate_html |     __generate_html | ||||||
|     __before_write_html |     __before_write_html | ||||||
|     __write_html |     __write_html | ||||||
| @ -220,9 +284,7 @@ function generate_javadoc_package() { | |||||||
|     title="Package: $title" |     title="Package: $title" | ||||||
| 
 | 
 | ||||||
|     local doctype="$doctype" |     local doctype="$doctype" | ||||||
|     local blueprint= |     local csslib bootstrap jquery html head start startcl endcl end | ||||||
|     local jquery= |  | ||||||
|     local html head start startbp endbp end |  | ||||||
|     __generate_html |     __generate_html | ||||||
|     __before_write_html |     __before_write_html | ||||||
|     __write_html |     __write_html | ||||||
| @ -244,9 +306,7 @@ function generate_javadoc_overview() { | |||||||
|     title="Projet: $title" |     title="Projet: $title" | ||||||
| 
 | 
 | ||||||
|     local doctype="$doctype" |     local doctype="$doctype" | ||||||
|     local blueprint= |     local csslib bootstrap jquery html head start startcl endcl end | ||||||
|     local jquery= |  | ||||||
|     local html head start startbp endbp end |  | ||||||
|     __generate_html |     __generate_html | ||||||
|     __before_write_html |     __before_write_html | ||||||
|     __write_html |     __write_html | ||||||
| @ -264,9 +324,9 @@ function generate_php() { | |||||||
|     __update_title |     __update_title | ||||||
| 
 | 
 | ||||||
|     local doctype="$doctype" |     local doctype="$doctype" | ||||||
|     local blueprint="$blueprint" |     local csslib="$csslib" | ||||||
|     local jquery="$jquery" |     local jquery="$jquery" | ||||||
|     local html head start startbp endbp end |     local html head start startcl endcl end | ||||||
|     __generate_html |     __generate_html | ||||||
|     doctype="<?php # -*- coding: $encoding ${mode:+mode: $mode }-*- vim:sw=2:sts=2:et:ai:si:sta:fenc=$encoding |     doctype="<?php # -*- coding: $encoding ${mode:+mode: $mode }-*- vim:sw=2:sts=2:et:ai:si:sta:fenc=$encoding | ||||||
| ?>${doctype:+$doctype | ?>${doctype:+$doctype | ||||||
| @ -319,11 +379,11 @@ template= | |||||||
| edit=1 | edit=1 | ||||||
| overwrite= | overwrite= | ||||||
| encoding= | encoding= | ||||||
|  | doctype=auto | ||||||
| baseurl=/ | baseurl=/ | ||||||
| doctype=html4 |  | ||||||
| blueprint=auto |  | ||||||
| jquery=auto |  | ||||||
| bpurl= | bpurl= | ||||||
|  | csslib=auto | ||||||
|  | jquery=auto | ||||||
| titlehl= | titlehl= | ||||||
| title= | title= | ||||||
| head_title= | head_title= | ||||||
| @ -338,11 +398,12 @@ parse_opts "${PRETTYOPTS[@]}" \ | |||||||
|     -4,--html4 doctype=html4 \ |     -4,--html4 doctype=html4 \ | ||||||
|     -5,--html5 doctype=html5 \ |     -5,--html5 doctype=html5 \ | ||||||
|     -U:,--baseurl: baseurl= \ |     -U:,--baseurl: baseurl= \ | ||||||
|     -b,--blueprint,--bp blueprint=1 \ |     -B:,--bpurl:,--bsurl: bpurl= \ | ||||||
|     -n,--no-blueprint,--noblueprint,--nobp blueprint= \ |     -s,--bootstrap,--bs csslib=bootstrap \ | ||||||
|  |     -b,--blueprint,--bp csslib=blueprint \ | ||||||
|  |     -n,--no-bootstrap,--nobootstrap,--nobs,--no-blueprint,--noblueprint,--nobp csslib= \ | ||||||
|     -j,--jquery jquery=1 \ |     -j,--jquery jquery=1 \ | ||||||
|     -k,--no-jquery,--nojquery jquery= \ |     -k,--no-jquery,--nojquery jquery= \ | ||||||
|     -B:,--bpurl: bpurl= \ |  | ||||||
|     --titlehl:,--hl: titlehl= \ |     --titlehl:,--hl: titlehl= \ | ||||||
|     -T:,--title: title= \ |     -T:,--title: title= \ | ||||||
|     --head-title: head_title= \ |     --head-title: head_title= \ | ||||||
| @ -350,8 +411,6 @@ parse_opts "${PRETTYOPTS[@]}" \ | |||||||
| 
 | 
 | ||||||
| [ -n "$encoding" ] || encoding=utf-8 | [ -n "$encoding" ] || encoding=utf-8 | ||||||
| [ -z "$baseurl" -o "${baseurl:$((-1)):1}" == / ] || baseurl="$baseurl/" | [ -z "$baseurl" -o "${baseurl:$((-1)):1}" == / ] || baseurl="$baseurl/" | ||||||
| [ -n "$bpurl" ] || bpurl="${baseurl}blueprint/" |  | ||||||
| [ "${bpurl:$((-1)):1}" == / ] || bpurl="$bpurl/" |  | ||||||
| 
 | 
 | ||||||
| files2edit=() | files2edit=() | ||||||
| r=0 | r=0 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user