Skip to content
Permalink
Browse files
Support using post.text() in post-list directive (Issue #1671) and, i…
…n general, get post.text() for posts at any time.
  • Loading branch information
ralsina committed May 1, 2015
1 parent e66df3a commit a35ebf17a5ef99cc92206cdf395b43a49a898eb3
Showing 2 changed files with 9 additions and 0 deletions.
@@ -18,6 +18,7 @@ Features
Bugfixes
--------

* Support using post.text() in post_list_directive.tmpl (Issue #1671)
* Avoid recursive dep when using post-list in a post (Issue #1671)
* Encode IDNs to Punycode in ``nikola init`` and in links;
show an error if the site URL is not Punycode (Issue #1644)
@@ -526,8 +526,16 @@ def text(self, lang=None, teaser_only=False, strip_html=False, show_read_more_li
if lang is None:
lang = nikola.utils.LocaleBorg().current_lang
file_name = self._translated_file_path(lang)

# Yes, we compile it and screw it.
# This may be controversial, but the user (or someone) is asking for the post text
# and the post should not just refuse to give it.
if not os.path.isfile(file_name):
self.compile(lang)

with io.open(file_name, "r", encoding="utf8") as post_file:
data = post_file.read().strip()

if self.compiler.extension() == '.php':
return data
try:

0 comments on commit a35ebf1

Please sign in to comment.