diff options
author | Shaun McCance <shaunm@gnome.org> | 2015-04-03 22:52:36 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2015-04-03 22:52:36 +0800 |
commit | 7607d9dd450275911eec5fcb66b69aacd13a4cc8 (patch) | |
tree | 0be279506acf5ad0ee14c9c031e926e6f357accf | |
parent | 2fab235d10e8aee321133d11df61e4527a02a511 (diff) | |
download | android_external_libxml2-7607d9dd450275911eec5fcb66b69aacd13a4cc8.tar.gz android_external_libxml2-7607d9dd450275911eec5fcb66b69aacd13a4cc8.tar.bz2 android_external_libxml2-7607d9dd450275911eec5fcb66b69aacd13a4cc8.zip |
Allow HTML serializer to output HTML5 DOCTYPE
For https://bugzilla.gnome.org/show_bug.cgi?id=747301
Use simple HTML5 DOCTYPE for about:legacy-compat
HTML5 uses a DOCTYPE without a PUBLIC or SYSTEM identifier. It looks
like this:
<!DOCTYPE html>
I can't use XSLT to output this, because to get a DOCTYPE I have to
provide a PUBLIC or SYSTEM identifier. Luckily, the standards folks
recognized this and provided this semantically equivalent form for the
HTML DOCTYPE:
<!DOCTYPE html SYSTEM "about:legacy-compat">
But people don't like seeing the "legacy" identifier in their output.
They'd rather see the shiny new DOCTYPE. Since we know that
about:legacy-compat is defined by the W3C to be semantically equivalent
to the sans-SYSTEM DOCTYPE, we could just special-case it in the HTML
serializer in libxml2. So if you set the SYSTEM identifier to
"about:legacy-compat", you get an HTML5 short-form DOCTYPE.
-rw-r--r-- | HTMLtree.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -668,7 +668,8 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlOutputBufferWriteString(buf, " "); xmlBufWriteQuotedString(buf->buffer, cur->SystemID); } - } else if (cur->SystemID != NULL) { + } else if (cur->SystemID != NULL && + xmlStrcmp(cur->SystemID, BAD_CAST "about:legacy-compat")) { xmlOutputBufferWriteString(buf, " SYSTEM "); xmlBufWriteQuotedString(buf->buffer, cur->SystemID); } |