From 993f2d912cb429d86982a14c328639798738e576 Thu, 12 Jan 2012 17:15:10 +0100
From: Bram Goffings <bramgoffings@gmail.com>
Date: Thu, 12 Jan 2012 17:15:06 +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..d82cda7 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -1289,7 +1289,7 @@
 }
 
 /**
- * Processes variables for book-node-export-html.tpl.php.
+ * Preprocesses variables for book-node-export-html.tpl.php.
  *
  * The $variables array contains the following elements:
  * - node
@@ -1298,9 +1298,25 @@
  * @see book-node-export-html.tpl.php
  */
 function template_preprocess_book_node_export_html(&$variables) {
+  global $language;
+
   $variables['depth'] = $variables['node']->book['depth'];
   $variables['title'] = check_plain($variables['node']->title);
   $variables['content'] = $variables['node']->rendered;
+
+  // 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']);
 }
 
 /**
