Commits

Marcin Kasperski committed 6b7e17a

Comment about excerpts and dumping appropriate piece to _config_extra.py

Comments (0)

Files changed (1)

serendipity2blogofile.py

       <!--more-->
 
       marker.  Use appropriate excerpt generating function to make use
-      of those.
+      of those. Simple example (to be put into _config.py)
+
+          def my_post_excerpt(post, num_words = 50):
+              strip_place = post.find("<!--more-->")
+              if strip_place != -1:
+                  return post[:strip_place]
+              else:
+                  return post
+
+          blog.post_excerpts.enabled = True
+          blog.post_excerpts.word_length = 20
+          blog.post_excerpts.method = my_post_excerpt
+
+
 """
 
 ###########################################################################
 
 blog.description = "%s"
 
+def my_post_excerpt(post, num_words = 50):
+    strip_place = post.find("<!--more-->")
+    if strip_place != -1:
+        return post[:strip_place]
+    else:
+        return post
+
+blog.post_excerpts.enabled = True
+blog.post_excerpts.word_length = 20
+blog.post_excerpts.method = my_post_excerpt
+
 """ % (baseURL,
        get_config_item("blogTitle"),      
        get_config_item("blogDescription")))