diff options
-rw-r--r-- | app/notes/models.py | 8 | ||||
-rw-r--r-- | design/templates/archives/notes.html | 2 | ||||
-rw-r--r-- | design/templates/archives/notes_date.html | 4 | ||||
-rw-r--r-- | design/templates/details/note.html | 2 | ||||
-rw-r--r-- | design/templates/details/note.txt | 2 |
5 files changed, 10 insertions, 8 deletions
diff --git a/app/notes/models.py b/app/notes/models.py index 40323b1..464ea6c 100644 --- a/app/notes/models.py +++ b/app/notes/models.py @@ -79,10 +79,12 @@ class Note(models.Model): def get_next_published(self): return self.get_next_by_date_created() - def link_twitter_names(self): - opts = {'username_include_symbol': True} + def render(self): from twitter_text.autolink import Autolink - return Autolink(self.body_html).auto_link_usernames_or_lists(opts) + opts = {'username_include_symbol': True} + temp = " ".join(self.body_markdown.split("|")) + html = markdown.markdown(urlize(temp, 45), extensions=['extra'], safe_mode=False) + return Autolink(html).auto_link_usernames_or_lists(opts) def save(self): self.body_html = markdown.markdown(urlize(self.body_markdown, 45), extensions=['extra'], safe_mode=False) diff --git a/design/templates/archives/notes.html b/design/templates/archives/notes.html index d7452a6..cd4029c 100644 --- a/design/templates/archives/notes.html +++ b/design/templates/archives/notes.html @@ -15,7 +15,7 @@ {% for object in object_list %} <article class="h-entry"> <div class="p-name e-content"> - {{object.link_twitter_names|safe|amp|smartypants|urlizetrunc:45 }} + {{object.render|safe|amp|smartypants|urlizetrunc:45 }} </div> <span class="p-author h-card"> <data class="p-name" value="Scott Gilbertson"></data> diff --git a/design/templates/archives/notes_date.html b/design/templates/archives/notes_date.html index 632a8ab..d150792 100644 --- a/design/templates/archives/notes_date.html +++ b/design/templates/archives/notes_date.html @@ -14,7 +14,7 @@ <h1>Notes Published in {% if month %}{{month|month_number_to_name}}{%endif%} {{year}}</h1>{% if month %}{% for object in object_list %} <article class="h-entry"> <div class="p-name e-content"> - {{object.link_twitter_names|safe|amp|smartypants|urlizetrunc:45 }} + {{object.render|safe|amp|smartypants|urlizetrunc:45 }} </div> <span class="p-author h-card"> <data class="p-name" value="Scott Gilbertson"></data> @@ -52,7 +52,7 @@ <h2 class="month--header">{{ month.list.0.date_created|date:"F Y" }}</h2>{% for object in month.list|dictsortreversed:"date_created" %} <article class="h-entry"> <div class="p-name e-content"> - {{object.link_twitter_names|safe|amp|smartypants|urlizetrunc:45 }} + {{object.render|safe|amp|smartypants|urlizetrunc:45 }} </div> <footer> <p class="meta"> diff --git a/design/templates/details/note.html b/design/templates/details/note.html index 10ffa37..66dff36 100644 --- a/design/templates/details/note.html +++ b/design/templates/details/note.html @@ -19,7 +19,7 @@ <main role="main"> <article class="h-entry"> <div class="p-name e-content"> - {{object.link_twitter_names|safe|amp|smartypants|urlizetrunc:45 }} + {{object.render|safe|amp|smartypants|urlizetrunc:45 }} </div> <span class="p-author h-card"> <data class="p-name" value="Scott Gilbertson"></data> diff --git a/design/templates/details/note.txt b/design/templates/details/note.txt index 547ce79..c5b1c2e 100644 --- a/design/templates/details/note.txt +++ b/design/templates/details/note.txt @@ -3,6 +3,6 @@ by Scott Gilbertson <{{SITE_URL}}{{object.get_absolute_url}}> - {{object.pub_date|date:"l, d F Y"}} + {{object.date_created|date:"l, d F Y"}} {{object.body_markdown|safe}} |