From 3312541e08d25f72843a9117c77ce364a49da06d Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Sat, 29 Oct 2011 20:32:13 +0900
Subject: [PATCH] Issue #1077602 by Jacine, skottler, dcmouyard, jasonrsavino,
 matglas86, cosmicdreams, scor: Convert node.tpl.php to HTML5.

---
 modules/node/node.module  | 17 +++++++++++++++++
 modules/node/node.tpl.php | 40 ++++++++++++++++++++-------------------
 2 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/modules/node/node.module b/modules/node/node.module
index 0c3cfb7a0062..5dc3efec3687 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1352,6 +1352,9 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
     $node = node_invoke($node, 'view', $view_mode, $langcode);
   }
 
+  // Make the view mode available in the node object.
+  $node->view_mode = $view_mode;
+
   // Build fields content.
   // In case of a multiple view, node_view_multiple() already ran the
   // 'prepare_view' step. An internal flag prevents the operation from running
@@ -1423,6 +1426,20 @@ function node_is_page($node) {
   return (!empty($page_node) ? $page_node->nid == $node->nid : FALSE);
 }
 
+/**
+ * Process variables for page.tpl.php
+ *
+ * @see page.tpl.php
+ */
+function node_preprocess_page(&$variables) {
+  // In order to have properly sectioned HTML5 markup for nodes, the title is
+  // always printed inside node.tpl.php. This code prevents it from printing in
+  // page.tpl.php as well.
+  if (!empty($variables['node']->view_mode) && $variables['node']->view_mode == 'full' && node_is_page($variables['node'])) {
+    $variables['title'] = '';
+  }
+}
+
 /**
  * Process variables for node.tpl.php
  *
diff --git a/modules/node/node.tpl.php b/modules/node/node.tpl.php
index 06dc1997bc8e..678e0a4ed8ca 100644
--- a/modules/node/node.tpl.php
+++ b/modules/node/node.tpl.php
@@ -77,34 +77,36 @@
  * @see template_preprocess_node()
  * @see template_process()
  */
-?>
-<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
 
-  <?php print $user_picture; ?>
+// Hide the comments and links so they can be rendered apart from $content
+// afterwards.
+hide($content['comments']);
+hide($content['links']);
+?>
+<article id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>
 
   <?php print render($title_prefix); ?>
-  <?php if (!$page): ?>
-    <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
+  <?php if ($display_submitted || $user_picture || $title): ?>
+    <header>
+      <?php print $user_picture; ?>
+      <?php if ($page): ?>
+        <h1<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h1>
+      <?php else: ?>
+        <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
+      <?php endif; ?>
+      <p class="submitted"><?php print $submitted; ?></p>
+    </header>
   <?php endif; ?>
   <?php print render($title_suffix); ?>
 
-  <?php if ($display_submitted): ?>
-    <div class="submitted">
-      <?php print $submitted; ?>
-    </div>
-  <?php endif; ?>
-
   <div class="content"<?php print $content_attributes; ?>>
-    <?php
-      // We hide the comments and links now so that we can render them later.
-      hide($content['comments']);
-      hide($content['links']);
-      print render($content);
-    ?>
+    <?php print render($content); ?>
   </div>
 
-  <?php print render($content['links']); ?>
+  <?php if ($links = render($content['links'])): ?>
+    <nav><?php print $links; ?></nav>
+  <?php endif; ?>
 
   <?php print render($content['comments']); ?>
 
-</div>
+</article>
-- 
GitLab