From c5605433d2226b722299f389a88cc9a6bc3b2413 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Fri, 12 Nov 2010 15:06:54 +0000
Subject: [PATCH] * display whole HTML in list mode instead of calling
 WebSection_getFirstParagraph, that is far from perfect. * fix invalid HTML.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40243 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_web_blog/ListBox_viewAsBlog.xml      |  11 +-
 .../WebSection_getFirstParagraph.xml          | 151 ------------------
 .../WebSection_viewBlogFrontPage/listbox.xml  |   2 +-
 bt5/erp5_web_blog/bt/change_log               |   3 +
 bt5/erp5_web_blog/bt/revision                 |   2 +-
 5 files changed, 10 insertions(+), 159 deletions(-)
 delete mode 100644 bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml
 create mode 100644 bt5/erp5_web_blog/bt/change_log

diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/ListBox_viewAsBlog.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/ListBox_viewAsBlog.xml
index 98806c94ac..16b66d72ef 100644
--- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/ListBox_viewAsBlog.xml
+++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/ListBox_viewAsBlog.xml
@@ -59,7 +59,7 @@
                            date_rendered python: date_renderer(date)">\n
 \n
 <div class="post_head">\n
-  <a tal:attributes="href url"><h1 tal:content="title">This is the title of the blog post</h1></a>\n
+  <h1><a tal:attributes="href url" tal:content="title">This is the title of the blog post</a></h1>\n
 \n
   <small class="post_time">\n
     <strong tal:content="structure date_rendered">date</strong>\n
@@ -70,13 +70,13 @@
 \n
 </div><!--End post_head -->\n
 \n
-  <div class="post_body" tal:replace="structure summary">Here is a blog post content</div>\n
+  <div class="post_body" tal:content="structure summary">Here is a blog post content</div>\n
 \n
   <div class="post_read_more"><a tal:attributes="href url" i18n:translate="" i18n:domain="ui">Read more</a></div>\n
   <div class="post_bottom">\n
     <a tal:attributes="href comments_url"><tal:block tal:replace="comment_count">0</tal:block> <tal:block i18n:translate="" i18n:domain="ui">comment</tal:block></a> | \n
-    <tal:block i18n:translate="" i18n:domain="ui">Share</tal:block>: <a title="Facebook" tal:attributes="href facebook_url"><img width="20px" alt="Facebook logo" src="erp5_web_blog_image/facebook-button.png"></a>&nbsp;&nbsp;\n
-         <a title="Twitter" tal:attributes="href twitter_url"><img width="20px" alt="Twitter Logo" src="erp5_web_blog_image/twitter-button.png"></a>\n
+    <tal:block i18n:translate="" i18n:domain="ui">Share</tal:block>: <a title="Facebook" tal:attributes="href facebook_url"><img width="20px" alt="Facebook logo" src="erp5_web_blog_image/facebook-button.png" /></a>\n
+         <a title="Twitter" tal:attributes="href twitter_url"><img width="20px" alt="Twitter Logo" src="erp5_web_blog_image/twitter-button.png" /></a>\n
 \n
   </div><!--End post_bottom-->\n
 \n
@@ -87,8 +87,7 @@
 \n
     <tal:block tal:condition="not: repeat/line/end"><br /><hr class="post_separator" /></tal:block>\n
 \n
-</tal:block>\n
-
+</tal:block>
 
 ]]></unicode> </value>
         </item>
diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml
deleted file mode 100644
index ef016d0e71..0000000000
--- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-"""\n
-  This simple script returns the first paragraph of an HTML or raw text.\n
-  The separator is specified through the layout property \n
-    layout_blog_first_part_separator.\n
-  In the case of a raw text, the first line is returned, splitted by \\n.\n
-"""\n
-content = context.getTextContent()\n
-separator = "</p>"\n
-if hasattr(context, \'REQUEST\'):\n
-  here = context.REQUEST.get(\'current_web_section\', None)\n
-  if here is not None:\n
-    separator = here.getLayoutProperty(\'layout_blog_first_part_separator\', separator)\n
-\n
-if context.getContentType() == "text/html":\n
-  # We must analyse the separator a bit.\n
-  # XXXX: this whole logic is too light for this problem, but I don\'t want to parse the whole HTML.\n
-  if "</" in separator:\n
-    # We will repeat the separator to be sure the content is approximately XHTML valid.\n
-    return content.split(separator)[0] + separator\n
-  else:\n
-    return content.split(separator)[0]\n
-else:\n
-  return content.split("\\n")[0]\n
-
-
-]]></string> </value>
-        </item>
-        <item>
-            <key> <string>_code</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>errors</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_code</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>co_argcount</string> </key>
-                        <value> <int>0</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>_getattr_</string>
-                            <string>context</string>
-                            <string>content</string>
-                            <string>separator</string>
-                            <string>hasattr</string>
-                            <string>None</string>
-                            <string>here</string>
-                            <string>_getitem_</string>
-                          </tuple>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_defaults</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>WebSection_getFirstParagraph</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml
index d7e9679448..8051de874b 100644
--- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml
+++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml
@@ -374,7 +374,7 @@
                           <string>Reference</string>
                         </tuple>
                         <tuple>
-                          <string>WebSection_getFirstParagraph</string>
+                          <string>asStrippedHTML</string>
                           <string>Summary</string>
                         </tuple>
                         <tuple>
diff --git a/bt5/erp5_web_blog/bt/change_log b/bt5/erp5_web_blog/bt/change_log
new file mode 100644
index 0000000000..aa25f07348
--- /dev/null
+++ b/bt5/erp5_web_blog/bt/change_log
@@ -0,0 +1,3 @@
+2010-11-12 Kazuhiko
+* display whole HTML in list mode instead of calling WebSection_getFirstParagraph, that is far from perfect.
+* fix invalid HTML.
\ No newline at end of file
diff --git a/bt5/erp5_web_blog/bt/revision b/bt5/erp5_web_blog/bt/revision
index eb13855b7d..e3f1e9b791 100644
--- a/bt5/erp5_web_blog/bt/revision
+++ b/bt5/erp5_web_blog/bt/revision
@@ -1 +1 @@
-79
\ No newline at end of file
+80
\ No newline at end of file
-- 
2.30.9