[geeklog-cvs] geeklog: Define {xmlns} when using XHTML for XHTML compliance

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Mar 21 13:50:06 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/619109d9b69f
changeset: 6843:619109d9b69f
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Mar 21 15:01:34 2009 +0100
description:
Define {xmlns} when using XHTML for XHTML compliance

diffstat:

9 files changed, 49 insertions(+), 16 deletions(-)
plugins/staticpages/functions.inc                       |    3 +
plugins/staticpages/templates/printable.thtml           |    2 -
public_html/article.php                                 |   29 ++++++++++++---
public_html/docs/history                                |    3 +
public_html/docs/theme.html                             |    5 ++
public_html/layout/professional/article/printable.thtml |    8 +---
public_html/layout/professional/header.thtml            |    2 -
public_html/lib-common.php                              |    7 ++-
system/lib-story.php                                    |    6 +--

diffs (178 lines):

diff -r e08747bfab7c -r 619109d9b69f plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Sun Mar 15 21:54:28 2009 +0100
+++ b/plugins/staticpages/functions.inc	Sat Mar 21 15:01:34 2009 +0100
@@ -300,6 +300,9 @@
 
     $spage = new Template( $_CONF['path'] . 'plugins/staticpages/templates/' );
     $spage->set_var('xhtml', XHTML);
+    if (XHTML != '') {
+        $spage->set_var('xmlns', ' xmlns="http://www.w3.org/1999/xhtml"');
+    }
     $spage->set_var('site_url', $_CONF['site_url']);
     $spage->set_var('layout_url', $_CONF['layout_url']);
     $spage->set_var('site_admin_url', $_CONF['site_admin_url']);
diff -r e08747bfab7c -r 619109d9b69f plugins/staticpages/templates/printable.thtml
--- a/plugins/staticpages/templates/printable.thtml	Sun Mar 15 21:54:28 2009 +0100
+++ b/plugins/staticpages/templates/printable.thtml	Sat Mar 21 15:01:34 2009 +0100
@@ -1,5 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html {lang_attribute}>
+<html{lang_attribute}{xmlns}>
 <head>
   <title>{page_title}</title>
   <link rel="stylesheet" type="text/css" href="{layout_url}/print.css"{xhtml}>
diff -r e08747bfab7c -r 619109d9b69f public_html/article.php
--- a/public_html/article.php	Sun Mar 15 21:54:28 2009 +0100
+++ b/public_html/article.php	Sat Mar 21 15:01:34 2009 +0100
@@ -139,6 +139,10 @@
         $story_template = new Template($_CONF['path_layout'] . 'article');
         $story_template->set_file('article', 'printable.thtml');
         $story_template->set_var('xhtml', XHTML);
+        if (XHTML != '') {
+            $story_template->set_var('xmlns',
+                                     ' xmlns="http://www.w3.org/1999/xhtml"');
+        }
         $story_template->set_var('direction', $LANG_DIRECTION);
         $story_template->set_var('page_title',
                 $_CONF['site_name'] . ': ' . $story->displayElements('title'));
@@ -156,10 +160,27 @@
                                      $story->DisplayElements('username'));
         }
 
-        $story_template->set_var('story_introtext',
-                                 $story->DisplayElements('introtext'));
-        $story_template->set_var('story_bodytext',
-                                 $story->DisplayElements('bodytext'));
+        $introtext = $story->DisplayElements('introtext');
+        $bodytext  = $story->DisplayElements('bodytext');
+        if (empty($bodytext)) {
+            $fulltext = $introtext;
+            $fulltext_no_br = $introtext;
+        } else {
+            $fulltext = $introtext . '<br' . XHTML . '><br' . XHTML . '/>'
+                      . $bodytext;
+            $fulltext_no_br = $introtext . ' ' . $bodytext;
+        }
+        if ($story->DisplayElements('postmode') == 'plaintext') {
+            $introtext = '<p>' . $introtext . '</p>';
+            $bodytext = '<p>' . $bodytext . '</p>';
+            $fulltext = '<p>' . $fulltext . '</p>';
+            $fulltext_no_br = '<p>' . $fulltext_no_br . '</p>';
+        }
+
+        $story_template->set_var('story_introtext', $introtext);
+        $story_template->set_var('story_bodytext',  $bodytext);
+        $story_template->set_var('story_text', $fulltext);
+        $story_template->set_var('story_text_no_br', $fulltext_no_br);
 
         $story_template->set_var('site_url', $_CONF['site_url']);
         $story_template->set_var('site_admin_url', $_CONF['site_admin_url']);
diff -r e08747bfab7c -r 619109d9b69f public_html/docs/history
--- a/public_html/docs/history	Sun Mar 15 21:54:28 2009 +0100
+++ b/public_html/docs/history	Sat Mar 21 15:01:34 2009 +0100
@@ -11,6 +11,8 @@
 + (TBD) Comment moderation and editable comments, by Jared Wenerd
 
 Other changes:
+- Define {xmlns} when using XHTML for XHTML compliance. Updated header.thtml
+  and article/printable.thtml template files to include that variable [Dirk]
 - Fixed wrong use of '&' when sending a trackback (bug #0000825)
 - Removed incomplete PDF generator (never enabled in any shipped version) [Dirk]
 - Fixed a problem with words being merged together in newsfeeds when the article
@@ -101,6 +103,7 @@
 
 Static Pages plugin
 -------------------
+- The printable.thtml template file now uses the {xmlns} variable [Dirk]
 - Added canonical link [Dirk]
 - Added auto installation support [Dirk]
 - Added support for PLG_getItemInfo, PLG_itemSaved, PLG_itemDeleted [Dirk]
diff -r e08747bfab7c -r 619109d9b69f public_html/docs/theme.html
--- a/public_html/docs/theme.html	Sun Mar 15 21:54:28 2009 +0100
+++ b/public_html/docs/theme.html	Sat Mar 21 15:01:34 2009 +0100
@@ -198,6 +198,11 @@
 <h2><a name="changes">Theme changes in Geeklog 1.6.0</a></h2>
 
 <ul>
+<li>When using <a href="#xhtml">XHTML</a>, the variable <tt>{xmlns}</tt> now
+    contains <tt>xmlns="http://www.w3.org/1999/xhtml"</tt> for XHTML compliance
+    (to be used in the <tt><html></tt> element).</li>
+<li>Added a space between a story's intro text and body text when using the
+    <tt>{story_text_no_br}</tt> variable.</li>
 <li>Bugfix: The variables <tt>{contributedby_user}</tt> and
     <tt>{contributedby_fullname}</tt> were always empty.</li>
 <li>The two variables <tt>{start_contributedby_anchortag}</tt> and
diff -r e08747bfab7c -r 619109d9b69f public_html/layout/professional/article/printable.thtml
--- a/public_html/layout/professional/article/printable.thtml	Sun Mar 15 21:54:28 2009 +0100
+++ b/public_html/layout/professional/article/printable.thtml	Sat Mar 21 15:01:34 2009 +0100
@@ -1,5 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html {lang_attribute}>
+<html{lang_attribute}{xmlns}>
 <head>
   <title>{page_title}</title>
   <link rel="stylesheet" type="text/css" href="{layout_url}/print.css"{xhtml}>
@@ -8,11 +8,9 @@
 <body dir="{direction}">
     <h1>{story_title}</h1>
     <h3>{story_date}</h3>
-    <b>{lang_contributedby} {story_author}</b>
+    <p><b>{lang_contributedby} {story_author}</b></p>
 
-    <p>{story_introtext}</p>
-
-    <p>{story_bodytext}</p>
+    {story_text_no_br}
 
     <p>{comments_with_count}</p>
 
diff -r e08747bfab7c -r 619109d9b69f public_html/layout/professional/header.thtml
--- a/public_html/layout/professional/header.thtml	Sun Mar 15 21:54:28 2009 +0100
+++ b/public_html/layout/professional/header.thtml	Sat Mar 21 15:01:34 2009 +0100
@@ -1,5 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html {lang_attribute}>
+<html{lang_attribute}{xmlns}>
 <head>
 <title>{page_title_and_site_name}</title>
 <meta http-equiv="Content-Script-Type" content="text/javascript"{xhtml}>
diff -r e08747bfab7c -r 619109d9b69f public_html/lib-common.php
--- a/public_html/lib-common.php	Sun Mar 15 21:54:28 2009 +0100
+++ b/public_html/lib-common.php	Sat Mar 21 15:01:34 2009 +0100
@@ -847,7 +847,10 @@
         'leftblocks'    => 'leftblocks.thtml',
         'rightblocks'   => 'rightblocks.thtml'
         ));
-    $header->set_var( 'xhtml', XHTML );
+    $header->set_var('xhtml', XHTML);
+    if (XHTML != '') {
+        $header->set_var('xmlns', ' xmlns="http://www.w3.org/1999/xhtml"');
+    }
 
     // get topic if not on home page
     if( !isset( $_GET['topic'] ))
@@ -6770,7 +6773,7 @@
     $template->set_var('lang_id', $langId);
 
     if (!empty($_CONF['languages']) && !empty($_CONF['language_files'])) {
-        $template->set_var('lang_attribute', $langAttr);
+        $template->set_var('lang_attribute', ' ' . $langAttr);
     } else {
         $template->set_var('lang_attribute', '');
     }
diff -r e08747bfab7c -r 619109d9b69f system/lib-story.php
--- a/system/lib-story.php	Sun Mar 15 21:54:28 2009 +0100
+++ b/system/lib-story.php	Sat Mar 21 15:01:34 2009 +0100
@@ -286,9 +286,9 @@
                 $article->set_var( 'story_page', $story_page );
             }
 
-            $article->set_var( 'story_introtext', $introtext . '<br' . XHTML . '><br' . XHTML . '>'
-                               . $bodytext );
-            $article->set_var( 'story_text_no_br', $introtext . $bodytext );
+            $article->set_var('story_introtext', $introtext
+                    . '<br' . XHTML . '><br' . XHTML . '>' . $bodytext);
+            $article->set_var('story_text_no_br', $introtext . ' ' . $bodytext);
         }
         $article->set_var( 'story_introtext_only', $introtext );
         $article->set_var( 'story_bodytext_only', $bodytext );



More information about the geeklog-cvs mailing list