summaryrefslogtreecommitdiffstats
path: root/header.rb
blob: 89d61aafed9eab7d1967e716141237e8fd11847f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# encoding: utf-8
def header_tpe()
	cgi = CGI.new
	html = ""
	if ENV['HTTP_ACCEPT'] and ENV['HTTP_ACCEPT']["application/xhtml+xml"]
		html = html + <<HTML_TPE
Vary: Accept
Content-type: application/xhtml+xml

<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet href="#{$RepBase}/styles/style.css"?>
HTML_TPE
		if ENV["HTTP_USER_AGENT"] and ENV["HTTP_USER_AGENT"]["MSIE"]
			html = html + "<?xml-stylesheet href=\"#{$RepBase}/styles/msie.css\"?>"
		end
		ENV["HTTP_USER_AGENT"] =~ /Firefox\/(\d+)/
		if $1.to_i < 4
			html = html + "<?xml-stylesheet href=\"#{$RepBase}/styles/nohtml5.css\"?>"
		end
		html = html + <<HTML_TPE
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
        <head>
HTML_TPE

	else
		html = html + <<HTML_TPE
Vary: Accept
Content-type: application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="#{$RepBase}/styles/xhtml.xsl"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
	<head>
		<link rel="stylesheet" href="#{$RepBase}/styles/style.css" />
HTML_TPE
		if ENV["HTTP_USER_AGENT"] =~ /MSIE [0-7]/
			html = html + <<HTML_TPE
		<link rel="stylesheet" href="#{$RepBase}/styles/nohtml5.css" />
		<link rel="stylesheet" href="#{$RepBase}/styles/msie6.css" />
		<script>document.createElement("header");
			document.createElement("nav");
			document.createElement("article");
			document.createElement("section");
			document.createElement("footer");</script>
HTML_TPE
		end

	end

	html = html + <<HTML_TPE
		<link rel="shortcut icon" type="image/x-icon" href="#{$RepBase}favicon.ico" />
		<title>#{$Titre}$titre$</title>
		<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
		<meta http-equiv="Content-Language" content="fr" />
	</head>
	<body>
		<header>
<!--			<a href="#{$RepBase}/connexion.cgi">Connexion</a>-->
			<h1>#{$Titre}</h1>
		</header>
HTML_TPE

	return html, cgi
end