From 1d27b23704036d84bd30e79d8d9ec0447a1afead Sun, 11 Dec 2011 20:56:44 +0100
From: Bram Goffings <bramgoffings@gmail.com>
Date: Sun, 11 Dec 2011 20:56:06 +0100
Subject: [PATCH] book export html


diff --git a/core/modules/book/book-export-html.tpl.php b/core/modules/book/book-export-html.tpl.php
index 4b25a76..e903bb5 100644
--- a/core/modules/book/book-export-html.tpl.php
+++ b/core/modules/book/book-export-html.tpl.php
@@ -16,8 +16,8 @@
  * @see template_preprocess_book_export_html()
  */
 ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language; ?>" xml:lang="<?php print $language->language; ?>">
+<!DOCTYPE html >
+<html<?php print $html_attributes; ?>>
   <head>
     <title><?php print $title; ?></title>
     <?php print $head; ?>
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index 1080984..0464037 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -1106,7 +1106,7 @@
 }
 
 /**
- * Process variables for book-export-html.tpl.php.
+ * Preprocesses variables for book-export-html.tpl.php.
  *
  * The $variables array contains the following arguments:
  * - $title
@@ -1123,6 +1123,20 @@
   $variables['language'] = $language;
   $variables['language_rtl'] = ($language->direction == LANGUAGE_RTL);
   $variables['head'] = drupal_get_html_head();
+
+  // HTML element attributes.
+  $variables['html_attributes_array']['lang'] = $language->language;
+  $variables['html_attributes_array']['dir'] = $language->direction ? 'rtl' : 'ltr';
+}
+
+/**
+ * Processes variables for book-export-html.tpl.php.
+ *
+ * @see book-export-html.tpl.php
+ */
+function template_process_book_export_html(&$variables) {
+  // Flatten out html_attributes
+  $variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']);
 }
 
 /**
