Always produce HTML5 doctype and new attributes, but not new elements
According to caniuse.com, a significant fraction of Web users are still using Internet Explorer versions that do not support HTML5 sectioning elements. However, claiming we're XHTML 1.0 Strict means we can't use features invented in the last 12 years, even if they degrade gracefully in older browsers (like the role and placeholder attributes). This means our output is no longer valid according to any particular DTD. Real browsers and other non-validator user-agents have never cared about DTD compliance anyway, so I don't think this is a real loss.master
parent
1561fbb365
commit
490a1eca7b
|
@ -274,7 +274,7 @@ sub getsetup () {
|
||||||
html5 => {
|
html5 => {
|
||||||
type => "boolean",
|
type => "boolean",
|
||||||
default => 0,
|
default => 0,
|
||||||
description => "generate HTML5?",
|
description => "use elements new in HTML5 like <section>?",
|
||||||
advanced => 0,
|
advanced => 0,
|
||||||
safe => 1,
|
safe => 1,
|
||||||
rebuild => 1,
|
rebuild => 1,
|
||||||
|
|
|
@ -53,7 +53,7 @@ sub pagetemplate (@) {
|
||||||
|
|
||||||
sub mirrorlist ($) {
|
sub mirrorlist ($) {
|
||||||
my $page=shift;
|
my $page=shift;
|
||||||
return ($config{html5} ? '<nav id="mirrorlist">' : '<div>').
|
return ($config{html5} ? '<nav' : '<div').' id="mirrorlist">'.
|
||||||
(keys %{$config{mirrorlist}} > 1 ? gettext("Mirrors") : gettext("Mirror")).
|
(keys %{$config{mirrorlist}} > 1 ? gettext("Mirrors") : gettext("Mirror")).
|
||||||
": ".
|
": ".
|
||||||
join(", ",
|
join(", ",
|
||||||
|
|
|
@ -5,7 +5,7 @@ Build-Depends: perl, debhelper (>= 9)
|
||||||
Build-Depends-Indep: dpkg-dev (>= 1.9.0), libxml-simple-perl,
|
Build-Depends-Indep: dpkg-dev (>= 1.9.0), libxml-simple-perl,
|
||||||
libtext-markdown-discount-perl,
|
libtext-markdown-discount-perl,
|
||||||
libtimedate-perl, libhtml-template-perl,
|
libtimedate-perl, libhtml-template-perl,
|
||||||
libhtml-scrubber-perl, wdg-html-validator,
|
libhtml-scrubber-perl,
|
||||||
libhtml-parser-perl, liburi-perl (>= 1.36), perlmagick, po4a (>= 0.34),
|
libhtml-parser-perl, liburi-perl (>= 1.36), perlmagick, po4a (>= 0.34),
|
||||||
libfile-chdir-perl, libyaml-libyaml-perl, python-support, librpc-xml-perl,
|
libfile-chdir-perl, libyaml-libyaml-perl, python-support, librpc-xml-perl,
|
||||||
libcgi-session-perl, ghostscript,
|
libcgi-session-perl, ghostscript,
|
||||||
|
|
30
t/html.t
30
t/html.t
|
@ -1,30 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
use warnings;
|
|
||||||
use strict;
|
|
||||||
use Test::More;
|
|
||||||
|
|
||||||
my @pages;
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
@pages=qw(index features news plugins/map security);
|
|
||||||
if (system("command -v validate >/dev/null") != 0) {
|
|
||||||
plan skip_all => "html validator not present";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plan(tests => int @pages + 2);
|
|
||||||
}
|
|
||||||
use_ok("IkiWiki");
|
|
||||||
}
|
|
||||||
|
|
||||||
# Have to build the html pages first.
|
|
||||||
# Note that just building them like this doesn't exersise all the possible
|
|
||||||
# html that can be generated, in particular it misses some of the action
|
|
||||||
# links at the top, etc.
|
|
||||||
ok(system("make >/dev/null") == 0);
|
|
||||||
|
|
||||||
foreach my $page (@pages) {
|
|
||||||
print "# Validating $page\n";
|
|
||||||
ok(system("validate html/$page.html") == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO: validate form output html
|
|
|
@ -3,6 +3,6 @@
|
||||||
<div>
|
<div>
|
||||||
<input name="sitesearch" value="<TMPL_VAR URL>" type="hidden" />
|
<input name="sitesearch" value="<TMPL_VAR URL>" type="hidden" />
|
||||||
<input name="q" value="" id="searchbox" size="16" maxlength="255" type="text"
|
<input name="q" value="" id="searchbox" size="16" maxlength="255" type="text"
|
||||||
<TMPL_IF HTML5>placeholder="search"</TMPL_IF> />
|
placeholder="search" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
<TMPL_IF HTML5><!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<TMPL_ELSE><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
</TMPL_IF>
|
|
||||||
<head>
|
<head>
|
||||||
<TMPL_IF DYNAMIC>
|
<TMPL_IF DYNAMIC>
|
||||||
<TMPL_IF FORCEBASEURL><base href="<TMPL_VAR FORCEBASEURL>" /><TMPL_ELSE>
|
<TMPL_IF FORCEBASEURL><base href="<TMPL_VAR FORCEBASEURL>" /><TMPL_ELSE>
|
||||||
|
@ -134,7 +130,7 @@
|
||||||
|
|
||||||
<div id="pagebody">
|
<div id="pagebody">
|
||||||
|
|
||||||
<TMPL_IF HTML5><section id="content" role="main"><TMPL_ELSE><div id="content"></TMPL_IF>
|
<TMPL_IF HTML5><section<TMPL_ELSE><div</TMPL_IF> id="content" role="main">
|
||||||
<TMPL_VAR CONTENT>
|
<TMPL_VAR CONTENT>
|
||||||
<TMPL_IF HTML5></section><TMPL_ELSE></div></TMPL_IF>
|
<TMPL_IF HTML5></section><TMPL_ELSE></div></TMPL_IF>
|
||||||
|
|
||||||
|
@ -146,7 +142,7 @@
|
||||||
|
|
||||||
<TMPL_UNLESS DYNAMIC>
|
<TMPL_UNLESS DYNAMIC>
|
||||||
<TMPL_IF COMMENTS>
|
<TMPL_IF COMMENTS>
|
||||||
<TMPL_IF HTML5><section id="comments" role="complementary"><TMPL_ELSE><div id="comments"></TMPL_IF>
|
<TMPL_IF HTML5><section<TMPL_ELSE><div</TMPL_IF> id="comments" role="complementary">
|
||||||
<TMPL_VAR COMMENTS>
|
<TMPL_VAR COMMENTS>
|
||||||
<TMPL_IF ADDCOMMENTURL>
|
<TMPL_IF ADDCOMMENTURL>
|
||||||
<div class="addcomment">
|
<div class="addcomment">
|
||||||
|
@ -161,7 +157,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TMPL_IF HTML5><footer id="footer" class="pagefooter" role="contentinfo"><TMPL_ELSE><div id="footer" class="pagefooter"></TMPL_IF>
|
<TMPL_IF HTML5><footer<TMPL_ELSE><div</TMPL_IF> id="footer" class="pagefooter" role="contentinfo">
|
||||||
<TMPL_UNLESS DYNAMIC>
|
<TMPL_UNLESS DYNAMIC>
|
||||||
<TMPL_IF HTML5><nav id="pageinfo"><TMPL_ELSE><div id="pageinfo"></TMPL_IF>
|
<TMPL_IF HTML5><nav id="pageinfo"><TMPL_ELSE><div id="pageinfo"></TMPL_IF>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<form method="get" action="<TMPL_VAR SEARCHACTION>" id="searchform">
|
<form method="get" action="<TMPL_VAR SEARCHACTION>" id="searchform">
|
||||||
<div>
|
<div>
|
||||||
<input type="text" id="searchbox" name="P" value="" size="16"
|
<input type="text" id="searchbox" name="P" value="" size="16"
|
||||||
<TMPL_IF HTML5>placeholder="search"</TMPL_IF> />
|
placeholder="search" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue