- " title="Permalink">
- <% if tonumber(post.edited_at) > tonumber(post.created_at) then -%>
- Edited at <%= os.date("%c", post.edited_at) %>
- <% else -%>
- Posted at <%= os.date("%c", post.created_at) %>
- <% end -%>
-
-
- <%
- local show_edit = me.id == post.user_id and not me:is_guest() and not ntob(thread.is_locked) and not no_reply
- if show_edit then
+ <%
+ local post_url = url_for("thread", {slug = thread.slug}, {page = page}) .. "#post-" .. post.id
+ %>
+
+ <% if tonumber(post.edited_at) > tonumber(post.created_at) then -%>
+ Edited at <%= os.date("%c", post.edited_at) %>
+ <% else -%>
+ Posted at <%= os.date("%c", post.created_at) %>
+ <% end -%>
+
+
+ <%
+ local show_edit = me.id == post.user_id and not me:is_guest() and not ntob(thread.is_locked) and not no_reply
+ if show_edit then
+ %>
+ ">Edit
+ <% end %>
+ <%
+ local show_reply = true
+ if ntob(thread.is_locked) and not me:is_mod() then
+ show_reply = false
+ elseif me:is_guest() then
+ show_reply = false
+ elseif edit then
+ show_reply = false
+ elseif no_reply then
+ show_reply = false
+ end
+ if show_reply then
+ local d = post.created_at < post.edited_at and post.edited_at or post.created_at
+ local quote_src_text = ("On [url=%s]%s[/url], [url=%s]%s[/url] said:"):format(
+ post_url, os.date("%c", d), url_for("user", {username = post.username}), post.username
+ )
+ local reply_text = ("%s\n[quote]%s[/quote]\n---\n\n"):format(quote_src_text, post.original_markup)
%>
- ">Edit
+
<% end %>
- <%
- local show_reply = true
- if ntob(thread.is_locked) and not me:is_mod() then
- show_reply = false
- elseif me:is_guest() then
- show_reply = false
- elseif edit then
- show_reply = false
- elseif no_reply then
- show_reply = false
- end
- if show_reply then
- local d = post.created_at < post.edited_at and post.edited_at or post.created_at
- local reply_text = ("On %s, %s said:\n%s\n\n---\n\n"):format(os.date("%c", d), post.username, post.original_markup)
- %>
-
- <% end %>
-
+