Exemplo n.º 1
0
 def get_context_data(self, **kwargs):
     data = super(EntryPreview, self).get_context_data(**kwargs)
     text = self.request.POST.get("text", u"")
     text = text.replace(Entry.MORE_MARKER, u"")
     markdown = "markdown" in self.request.POST
     data["text"] = mark_safe(render_text(text, markdown))
     return data
Exemplo n.º 2
0
 def short_text(self):
     text = self.text
     #noinspection PyUnresolvedReferences
     parts = text.split(self.MORE_MARKER, 1)
     if len(parts) > 1:
         text = parts[0]
         site = Site.objects.get_current()
         full_url = "http://%s%s" % (site.domain, self.get_absolute_url())
         text += """<p class="read-more"><a href="%s#cut">%s</a></p>""" % (full_url, _(u"Read more"))
     return mark_safe(render_text(text, self.markdown))
Exemplo n.º 3
0
 def full_text(self):
     #noinspection PyUnresolvedReferences
     text = self.text.replace(self.MORE_MARKER, "<a name=\"cut\"></a>")
     return mark_safe(render_text(text, self.markdown))