Skip to content
Permalink
Browse files

Fix #1879 -- use user’s HTML for custom teaser text

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 9, 2015
1 parent b5fa0b4 commit 31808f1c657a337e1dc38bff6f4ad5383b37c5e4
Showing with 13 additions and 12 deletions.
  1. +2 −0 CHANGES.txt
  2. +11 −12 nikola/post.py
@@ -4,6 +4,8 @@ New in master
Features
--------

* Use provided teaser format (``*_READ_MORE_LINK``) with custom teaser text
(Issue #1879)
* Delete old ``bootstrap`` theme (use ``bootstrap3`` instead)
* Screen reader-friendly navbar collapses and dropdowns (Issue #1863)
* Modern reST stylesheets, based in part on Bootstrap 3 (Issue #1150)
@@ -593,19 +593,18 @@ def text(self, lang=None, teaser_only=False, strip_html=False, show_read_more_li
if teaser != data:
if not strip_html and show_read_more_link:
if TEASER_REGEXP.search(data).groups()[-1]:
teaser += '<p class="more"><a href="{0}">{1}</a></p>'.format(
self.permalink(lang),
TEASER_REGEXP.search(data).groups()[-1])
teaser_text = TEASER_REGEXP.search(data).groups()[-1]
else:
l = self.config['RSS_READ_MORE_LINK'](lang) if rss_read_more_link else self.config['INDEX_READ_MORE_LINK'](lang)
teaser += l.format(
link=self.permalink(lang, query=rss_links_append_query),
read_more=self.messages[lang]["Read more"],
min_remaining_read=self.messages[lang]["%d min remaining to read"] % (self.remaining_reading_time),
reading_time=self.reading_time,
remaining_reading_time=self.remaining_reading_time,
paragraph_count=self.paragraph_count,
remaining_paragraph_count=self.remaining_paragraph_count)
teaser_text = self.messages[lang]["Read more"]
l = self.config['RSS_READ_MORE_LINK'](lang) if rss_read_more_link else self.config['INDEX_READ_MORE_LINK'](lang)
teaser += l.format(
link=self.permalink(lang, query=rss_links_append_query),
read_more=teaser_text,
min_remaining_read=self.messages[lang]["%d min remaining to read"] % (self.remaining_reading_time),
reading_time=self.reading_time,
remaining_reading_time=self.remaining_reading_time,
paragraph_count=self.paragraph_count,
remaining_paragraph_count=self.remaining_paragraph_count)
# This closes all open tags and sanitizes the broken HTML
document = lxml.html.fromstring(teaser)
try:

0 comments on commit 31808f1

Please sign in to comment.
You can’t perform that action at this time.