mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
Fixed minor weirdnesses with excerpts
- remove HRs ---- and blockquote > symbols from excerpts - we want the excerpt to not contain "markdown-like" symbols, but just be plaintext
This commit is contained in:
parent
6cc0c2b76b
commit
cdb365c29d
@ -48,7 +48,11 @@ const loadConverters = () => {
|
||||
{selector: 'figcaption', format: 'skip'},
|
||||
// Strip inline and bottom footnotes
|
||||
{selector: 'a[rel=footnote]', format: 'skip'},
|
||||
{selector: 'div.footnotes', format: 'skip'}
|
||||
{selector: 'div.footnotes', format: 'skip'},
|
||||
// Don't output hrs
|
||||
{selector: 'hr', format: 'skip'},
|
||||
// Don't output > in blockquotes
|
||||
{selector: 'blockquote', format: 'block'}
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -81,7 +81,7 @@ Object {
|
||||
|
||||
An about page is a great example of one you might want to set up early on so people can find out more about you, and what you do. Why should people subscribe to your site and become a member? Details help!
|
||||
|
||||
> Tip: If you're reading any post or page on your site and you notice something y",
|
||||
Tip: If you're reading any post or page on your site and you notice something you",
|
||||
"feature_image": null,
|
||||
"feature_image_alt": null,
|
||||
"feature_image_caption": null,
|
||||
|
@ -70,4 +70,21 @@ describe('Html to Plaintext', function () {
|
||||
assert.equal(excerpt, expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Special cases', function () {
|
||||
it('Instagram (blockquotes)', function () {
|
||||
// This is an instagram embed, but with all the style attributes & svg content removed for brevity
|
||||
const html = '<p>Some text in a paragraph.</p><!--kg-card-begin: html--><blockquote class=\"instagram-media\" data-instgrm-captioned data-instgrm-permalink=\"https://www.instagram.com/p/AbC123dEf/?utm_source=ig_embed&utm_campaign=loading\" data-instgrm-version=\"14\"><div> <a href=\"https://www.instagram.com/p/AbC123dEf/?utm_source=ig_embed&utm_campaign=loading\" target=\"_blank\"><div><div></div><div><div></div><div></div></div></div><div></div><div><svg width=\"50px\" height=\"50px\" viewBox=\"0 0 60 60\" version=\"1.1\" xmlns=\"https://www.w3.org/2000/svg\" xmlns:xlink=\"https://www.w3.org/1999/xlink\"><!-- svg stuff --></svg></div><div><div>View this post on Instagram</div></div><div></div><div><div><div></div><div></div><div></div></div><div><div></div><div><div></div><div></div><div></div></div></div><div><div></div><div></div></div></a><p><a href=\"https://www.instagram.com/p/AbC123dEf/?utm_source=ig_embed&utm_campaign=loading\" target=\"_blank\">A post shared by Some Dude (@somedude)</a></p></div></blockquote><script async src=\"//www.instagram.com/embed.js\"></script><!--kg-card-end: html-->';
|
||||
const expected = 'Some text in a paragraph.\n\nView this post on Instagram\n\nA post shared by Some Dude (@somedude)';
|
||||
const {excerpt} = getEmailandExcert(html);
|
||||
assert.equal(excerpt, expected);
|
||||
});
|
||||
|
||||
it('HRs', function () {
|
||||
const html = '<p>See you later alligator...</p><hr><p>...in a while crocodile</p>';
|
||||
const expected = 'See you later alligator...\n\n...in a while crocodile';
|
||||
const {excerpt} = getEmailandExcert(html);
|
||||
assert.equal(excerpt, expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user