From 63aaad529c9ae9358f22fd9563aeabc679f4defd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 10 Aug 2015 18:28:53 +0200 Subject: Add support for generating XHTML5 --- tests/web/xhtml/driver.cxx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/web/xhtml/driver.cxx (limited to 'tests/web/xhtml/driver.cxx') diff --git a/tests/web/xhtml/driver.cxx b/tests/web/xhtml/driver.cxx new file mode 100644 index 0000000..23531f7 --- /dev/null +++ b/tests/web/xhtml/driver.cxx @@ -0,0 +1,44 @@ +// file : tests/web/xhtml/driver.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +#include + +#include + +using namespace std; +using namespace xml; + +int +main () +{ + using namespace web::xhtml; + + serializer s (cout, "output"); + + s << HTML + << HEAD + << TITLE << "Example XHTML5 document" << ~TITLE + << ~HEAD + << BODY + // + // Inline elements (no indentation). + // + << P << "Here be " << B << "Dragons!" << ~B << *BR + << "and a newline" << ~P + // + // Various ways to specify attributes. + // + << P(ID=123, CLASS="cool") << "Text" << ~P + << P << (ID=123) << (CLASS="cool") << "Text" << ~P + << P << ID(123) << CLASS("cool") << "Text" << ~P + << P << ID << 123 << ~ID << CLASS << "cool" << ~CLASS << "Text" << ~P + // + // Empty element with attributes. + // + << P << "Text" << *BR(CLASS="double") << ~P + << ~BODY + << ~HTML; +} -- cgit v1.1