add quote to babycode, improve quote text
This commit is contained in:
parent
2773ba5243
commit
22f97dcc82
@ -154,6 +154,14 @@ pre code {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
padding: 10px 20px;
|
||||||
|
margin: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border-left: 10px solid rgb(229.84, 231.92, 227.28);
|
||||||
|
background-color: rgb(135.1928346457, 145.0974015748, 123.0025984252);
|
||||||
|
}
|
||||||
|
|
||||||
.user-posts {
|
.user-posts {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 200px 1fr;
|
grid-template-columns: 200px 1fr;
|
||||||
|
@ -38,6 +38,8 @@ function babycode.to_html(s, escape_html)
|
|||||||
text = text:gsub("%[i%](.-)%[/i%]", "<em>%1</em>")
|
text = text:gsub("%[i%](.-)%[/i%]", "<em>%1</em>")
|
||||||
text = text:gsub("%[s%](.-)%[/s%]", "<del>%1</del>")
|
text = text:gsub("%[s%](.-)%[/s%]", "<del>%1</del>")
|
||||||
|
|
||||||
|
text = text:gsub("%[quote%](.-)%[/quote%]", "<blockquote>%1</blockquote>")
|
||||||
|
|
||||||
-- replace loose links
|
-- replace loose links
|
||||||
text = text:gsub("(https?://[%w-_%.%?%.:/%+=&~%@#%%]+[%w-/])", function(url)
|
text = text:gsub("(https?://[%w-_%.%?%.:/%+=&~%@#%%]+[%w-/])", function(url)
|
||||||
if not text:find('<a[^>]*>'..url..'</a>') then
|
if not text:find('<a[^>]*>'..url..'</a>') then
|
||||||
|
@ -192,6 +192,14 @@ pre code {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
padding: 10px 20px;
|
||||||
|
margin: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border-left: 10px solid $lighter;
|
||||||
|
background-color: $dark2;
|
||||||
|
}
|
||||||
|
|
||||||
.user-posts {
|
.user-posts {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 200px 1fr;
|
grid-template-columns: 200px 1fr;
|
||||||
|
@ -17,45 +17,51 @@
|
|||||||
|
|
||||||
<div class="post-content-container"<%= is_latest and 'id=latest-post' or "" %>>
|
<div class="post-content-container"<%= is_latest and 'id=latest-post' or "" %>>
|
||||||
<div class="post-info">
|
<div class="post-info">
|
||||||
<a href="<%= url_for("thread", {slug = thread.slug}, {page = page}) .. "#post-" .. post.id %>" title="Permalink"><i>
|
<%
|
||||||
<% if tonumber(post.edited_at) > tonumber(post.created_at) then -%>
|
local post_url = url_for("thread", {slug = thread.slug}, {page = page}) .. "#post-" .. post.id
|
||||||
Edited at <%= os.date("%c", post.edited_at) %>
|
%>
|
||||||
<% else -%>
|
<a href="<%= post_url %>" title="Permalink"><i>
|
||||||
Posted at <%= os.date("%c", post.created_at) %>
|
<% if tonumber(post.edited_at) > tonumber(post.created_at) then -%>
|
||||||
<% end -%>
|
Edited at <%= os.date("%c", post.edited_at) %>
|
||||||
</i></a>
|
<% else -%>
|
||||||
<span>
|
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
|
</i></a>
|
||||||
if show_edit then
|
<span>
|
||||||
|
<%
|
||||||
|
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
|
||||||
|
%>
|
||||||
|
<a class="linkbutton" href="<%= url_for("edit_post", {post_id = post.id}) %>">Edit</a>
|
||||||
|
<% 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)
|
||||||
%>
|
%>
|
||||||
<a class="linkbutton" href="<%= url_for("edit_post", {post_id = post.id}) %>">Edit</a>
|
<button value="<%= reply_text %>" class="reply-button">Reply</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%
|
</span>
|
||||||
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)
|
|
||||||
%>
|
|
||||||
<button value="<%= reply_text %>" class="reply-button">Reply</button>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
<% if not edit then %>
|
<% if not edit then %>
|
||||||
<%- post.content %>
|
<%- post.content %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% render("views.common.babycode-editor", {
|
<% render("views.common.babycode-editor", {
|
||||||
cancel_url = url_for("thread", {slug = thread.slug}, {page = page}) .. "#post-" .. post.id,
|
cancel_url = post_url,
|
||||||
prefill = post.original_markup,
|
prefill = post.original_markup,
|
||||||
ta_name = "new_content"
|
ta_name = "new_content"
|
||||||
}) %>
|
}) %>
|
||||||
|
Loading…
Reference in New Issue
Block a user