From ad4362307ae2b38c97b52e4fa13556ea914417e8 Thu, 12 Jan 2012 19:28:26 +0100
From: Bram Goffings <bramgoffings@gmail.com>
Date: Thu, 12 Jan 2012 19:28:19 +0100
Subject: [PATCH] book export



diff --git a/core/modules/book/book-export-html.tpl.php b/core/modules/book/book-export-html.tpl.php
index 4547788..df04dab 100644
--- a/core/modules/book/book-export-html.tpl.php
+++ b/core/modules/book/book-export-html.tpl.php
@@ -18,8 +18,8 @@
  * @ingroup themeable
  */
 ?>
-<!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->langcode; ?>" xml:lang="<?php print $language->langcode; ?>">
+<!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 f9ae921..0f1a4c8 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -1208,7 +1208,7 @@
 }
 
 /**
- * Processes variables for book-export-html.tpl.php.
+ * Preprocesses variables for book-export-html.tpl.php.
  *
  * The $variables array contains the following elements:
  * - title
@@ -1225,6 +1225,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->langcode;
+  $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']);
 }
 
 /**
