Commit c5605433 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* display whole HTML in list mode instead of calling...

* 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
parent 2f557904
......@@ -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>
......
<?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>
......@@ -374,7 +374,7 @@
<string>Reference</string>
</tuple>
<tuple>
<string>WebSection_getFirstParagraph</string>
<string>asStrippedHTML</string>
<string>Summary</string>
</tuple>
<tuple>
......
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
79
\ No newline at end of file
80
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment