Author: gredler
Date: Mon Sep 24 09:52:22 2007
New Revision: 578875
URL: http://svn.apache.org/viewvc?rev=578875&view=rev
Log:
TAPESTRY-1777: Allow HTML 4 doctypes to be used in component templates.
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_frameset_doctype.html
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_strict_doctype.html
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_transitional_doctype.html
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_frameset_doctype.html
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_strict_doctype.html
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_transitional_doctype.html
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java?rev=578875&r1=578874&r2=578875&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
Mon Sep 24 09:52:22 2007
@@ -89,20 +89,18 @@
binder.bind(RequestEncodingInitializer.class,
RequestEncodingInitializerImpl.class);
}
- public static void contributeTemplateParser(MappedConfiguration<String,
URL> configuration)
+ public static void contributeTemplateParser(MappedConfiguration<String,
URL> config)
{
Class c = InternalModule.class;
- configuration.add("-//W3C//DTD XHTML 1.0 Strict//EN",
c.getResource("xhtml1-strict.dtd"));
- configuration.add("-//W3C//DTD XHTML 1.0 Transitional//EN", c
- .getResource("xhtml1-transitional.dtd"));
- configuration.add("-//W3C//DTD XHTML 1.0 Frameset//EN", c
- .getResource("xhtml1-frameset.dtd"));
- configuration
- .add("-//W3C//ENTITIES Latin 1 for XHTML//EN",
c.getResource("xhtml-lat1.ent"));
- configuration.add("-//W3C//ENTITIES Symbols for XHTML//EN", c
- .getResource("xhtml-symbol.ent"));
- configuration.add("-//W3C//ENTITIES Special for XHTML//EN", c
- .getResource("xhtml-special.ent"));
+ config.add("-//W3C//DTD XHTML 1.0 Strict//EN",
c.getResource("xhtml1-strict.dtd"));
+ config.add("-//W3C//DTD XHTML 1.0 Transitional//EN",
c.getResource("xhtml1-transitional.dtd"));
+ config.add("-//W3C//DTD XHTML 1.0 Frameset//EN",
c.getResource("xhtml1-frameset.dtd"));
+ config.add("-//W3C//DTD HTML 4.01//EN",
c.getResource("xhtml1-strict.dtd"));
+ config.add("-//W3C//DTD HTML 4.01 Transitional//EN",
c.getResource("xhtml1-transitional.dtd"));
+ config.add("-//W3C//DTD HTML 4.01 Frameset//EN",
c.getResource("xhtml1-frameset.dtd"));
+ config.add("-//W3C//ENTITIES Latin 1 for XHTML//EN",
c.getResource("xhtml-lat1.ent"));
+ config.add("-//W3C//ENTITIES Symbols for XHTML//EN",
c.getResource("xhtml-symbol.ent"));
+ config.add("-//W3C//ENTITIES Special for XHTML//EN",
c.getResource("xhtml-special.ent"));
}
/**
@@ -127,7 +125,9 @@
// contribution based on the path.
configuration.add("tapestry.scriptaculous",
"classpath:${tapestry.scriptaculous.path}");
- configuration.add("tapestry.scriptaculous.path",
"org/apache/tapestry/scriptaculous_1_7_1_beta_3");
+ configuration.add(
+ "tapestry.scriptaculous.path",
+ "org/apache/tapestry/scriptaculous_1_7_1_beta_3");
}
private final ComponentInstantiatorSource _componentInstantiatorSource;
@@ -549,7 +549,7 @@
};
configuration.add("SetRequestEncoding", filter, "before:*");
-
+
configuration.add("Ajax", new AjaxFilter());
}
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt?rev=578875&r1=578874&r2=578875&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/guide/templates.apt Mon
Sep 24 09:52:22 2007
@@ -58,14 +58,18 @@
As mentioned above, component templates are well-formed XML documents. This
means that if you want to use any
{{{http://www.w3.org/TR/html401/sgml/entities.html}HTML entities}} (such as
& < > or ©),
- you must use an {{{http://www.w3.org/QA/2002/04/valid-dtd-list.html}HTML or
XHTML doctype}} in your template. Unfortunately,
- HTML DTDs aren't valid XML DTDs, causing problems for XML parsers. The
result is that you cannot use HTML doctypes in
- component templates -- you must use XHTML doctypes.
-
- If you do choose to use XHTML doctypes in your templates, they will be passed
- on to the client in the resultant (X)HTML. Note that if your pages are
composed of multiple components, each with a template, and
- each template contains a doctype declaration, only the first doctype
encountered by the template parser will be passed on to the
- client. The following two doctypes are the most common XHTML doctypes:
+ you must use an {{{http://www.w3.org/QA/2002/04/valid-dtd-list.html}HTML or
XHTML doctype}} in your template. If
+ you choose to use (X)HTML doctypes in your templates, they will be passed on
to the client in the resultant (X)HTML.
+ Note that if your pages are composed of multiple components, each with a
template, and each template contains a
+ doctype declaration, only the first doctype encountered by the template
parser will be passed on to the client.
+
+ It should also be noted that even though XHTML DTDs are valid XML DTDs, HTML
DTDs aren't valid XML DTDs. This means
+ that HTML doctypes cannot be used by XML parsers. Tapestry works around this
limitation internally by using XHTML DTDs
+ to parse templates that use HTML DTDs. This internal mapping is possible
because XHTML 1.0 is nothing more than "a
+ reformulation of the three HTML 4 document types as applications of XML
1.0," {{{http://www.w3.org/TR/xhtml1/#xhtml}as per the W3C}}.
+ Don't worry though -- the original HTML 4 doctype will still be emitted to
the client!
+
+ The following doctypes are the most common (X)HTML doctypes:
+----+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
@@ -73,6 +77,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+----+
Tapestry Namespace
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java?rev=578875&r1=578874&r2=578875&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/TemplateParserImplTest.java
Mon Sep 24 09:52:22 2007
@@ -605,7 +605,7 @@
assertEquals(t.getText().trim(), "<Test>");
}
- @DataProvider(name = "doctype_added_correctly_data")
+ @DataProvider(name = "doctype_token_added_correctly_data")
public Object[][] doctype_token_added_correctly_data()
{
return new Object[][]
@@ -617,11 +617,18 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" },
{ "xhtml1_frameset_doctype.html", "html", "-//W3C//DTD XHTML
1.0 Frameset//EN",
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
},
+ { "html4_strict_doctype.html", "HTML", "-//W3C//DTD HTML
4.01//EN",
+ "http://www.w3.org/TR/html4/strict.dtd" },
+ { "html4_transitional_doctype.html", "HTML",
+ "-//W3C//DTD HTML 4.01 Transitional//EN",
+ "http://www.w3.org/TR/html4/loose.dtd" },
+ { "html4_frameset_doctype.html", "HTML", "-//W3C//DTD HTML
4.01 Frameset//EN",
+ "http://www.w3.org/TR/html4/frameset.dtd" },
{ "system_doctype.xml", "foo", null,
-
"src/test/resources/org/apache/tapestry/internal/services/simple.dtd" }, };
+
"src/test/resources/org/apache/tapestry/internal/services/simple.dtd" } };
}
- @Test(dataProvider = "doctype_added_correctly_data")
+ @Test(dataProvider = "doctype_token_added_correctly_data")
public void doctype_added_correctly(String fileName, String name, String
publicId,
String systemId) throws Exception
{
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_frameset_doctype.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_frameset_doctype.html?rev=578875&view=auto
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_frameset_doctype.html
(added)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_frameset_doctype.html
Mon Sep 24 09:52:22 2007
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC
+ "-//W3C//DTD HTML 4.01 Frameset//EN"
+ "http://www.w3.org/TR/html4/frameset.dtd">
+
+<html>
+ <head>
+ <title>HTML 4 Frameset Test</title>
+ </head>
+ <body>
+ <Test>
+ </body>
+</html>
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_strict_doctype.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_strict_doctype.html?rev=578875&view=auto
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_strict_doctype.html
(added)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_strict_doctype.html
Mon Sep 24 09:52:22 2007
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC
+ "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+
+<html>
+ <head>
+ <title>HTML 4 Strict Test</title>
+ </head>
+ <body>
+ <Test>
+ </body>
+</html>
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_transitional_doctype.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_transitional_doctype.html?rev=578875&view=auto
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_transitional_doctype.html
(added)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/html4_transitional_doctype.html
Mon Sep 24 09:52:22 2007
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC
+ "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+ <head>
+ <title>HTML 4 Transitional Test</title>
+ </head>
+ <body>
+ <Test>
+ </body>
+</html>
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_frameset_doctype.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_frameset_doctype.html?rev=578875&r1=578874&r2=578875&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_frameset_doctype.html
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_frameset_doctype.html
Mon Sep 24 09:52:22 2007
@@ -4,7 +4,7 @@
<html>
<head>
- <title>HTML 4 Strict Test</title>
+ <title>XHTML 1.0 Frameset Test</title>
</head>
<body>
<Test>
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_strict_doctype.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_strict_doctype.html?rev=578875&r1=578874&r2=578875&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_strict_doctype.html
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_strict_doctype.html
Mon Sep 24 09:52:22 2007
@@ -4,7 +4,7 @@
<html>
<head>
- <title>HTML 4 Strict Test</title>
+ <title>XHTML 1.0 Strict Test</title>
</head>
<body>
<Test>
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_transitional_doctype.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_transitional_doctype.html?rev=578875&r1=578874&r2=578875&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_transitional_doctype.html
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/xhtml1_transitional_doctype.html
Mon Sep 24 09:52:22 2007
@@ -4,7 +4,7 @@
<html>
<head>
- <title>HTML 4 Strict Test</title>
+ <title>XHTML 1.0 Transitional Test</title>
</head>
<body>
<Test>