diff options
Diffstat (limited to 'header.rb')
-rwxr-xr-x | header.rb | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/header.rb b/header.rb new file mode 100755 index 0000000..89d61aa --- /dev/null +++ b/header.rb @@ -0,0 +1,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 |