FEATURE: allow advanced specification of excerpts for posts

Previously users could control excerpt with `<span class='excerpt'>`
in Markdown, this is somewhat limited for plugins that need to define this
across a section. This adds support for DIV as well
This commit is contained in:
Sam 2018-12-04 15:13:34 +11:00
parent 9248ad1905
commit 5c17e46274
2 changed files with 16 additions and 0 deletions

View File

@ -183,6 +183,7 @@ const DEFAULT_LIST = [
"small",
"span[lang]",
"span.excerpt",
"div.excerpt",
"span.hashtag",
"span.mention",
"strike",

View File

@ -270,6 +270,21 @@ describe PostCreator do
}.to_not change { topic.excerpt }
end
it 'supports custom excerpts' do
raw = <<~MD
<div class='excerpt'>
I am
a custom excerpt
</div>
testing
MD
post = create_post(raw: raw)
expect(post.excerpt).to eq("I am\na custom excerpt")
end
it 'creates post stats' do
Draft.set(user, 'new_topic', 0, "test")