Coverage for khufu/scaffolding/head.py : 90%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# encoding: utf-8
2from . import *
4def head(
5 relativeUrlBase=False,
6 mainCssFilePath="main.css",
7 pageTitle="",
8 extras="",
9 faviconLocation=False,
10 assetsDirectory=False
11):
12 """ *Generate an html head element for your webpage*
14 **Key Arguments**
16 ``relativeUrlBase`` -- relative base url for js, css, image folders
17 ``pageTitle`` -- well, the page title!
18 ``mainCssFilePath`` -- css file path
19 ``extras`` -- any extra info to be included in the ``head`` element
20 ``faviconLocation`` -- path to faviconLocation if not in document root
23 **Return**
25 - ``head`` -- the head """
28 if not relativeUrlBase:
29 relativeUrlBase = ""
31 cssLink = """
32 <link rel="stylesheet" href="%(mainCssFilePath)s" type="text/css" />
33 """ % locals()
35 if faviconLocation is not False:
36 faviconLocation = """
37 <link rel="shortcut icon" href="%(faviconLocation)s" />
38 """ % locals()
39 else:
40 faviconLocation = ""
42 head = """
43 <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
44 <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
45 <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
46 <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
47 <head>
48 <meta charset="utf-8">
49 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
50 <title>%(pageTitle)s</title>
51 <meta name="description" content="">
52 <meta name="viewport" content="width=device-width, initial-scale=1.0">
53 %(cssLink)s
54 %(extras)s
55 %(faviconLocation)s
56 </head>
57 """ % locals()
59 return head