Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/cleaners/author.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { normalizeSpaces } from 'utils/text';
import { decodeEntities, normalizeSpaces } from 'utils/text';
import { CLEAN_AUTHOR_RE } from './constants';

// Take an author string (like 'By David Smith ') and clean it to
// just the name(s): 'David Smith'.
export default function cleanAuthor(author) {
// Convert HTML encoded entities back to into characters
author = decodeEntities(author);

return normalizeSpaces(author.replace(CLEAN_AUTHOR_RE, '$2').trim());
}
7 changes: 5 additions & 2 deletions src/cleaners/dek.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { stripTags } from 'utils/dom';
import { excerptContent, normalizeSpaces } from 'utils/text';
import { excerptContent, decodeEntities, normalizeSpaces } from 'utils/text';

import { TEXT_LINK_RE } from './constants';

Expand All @@ -13,11 +13,14 @@ export default function cleanDek(dek, { $, excerpt }) {
if (excerpt && excerptContent(excerpt, 10) === excerptContent(dek, 10))
return null;

const dekText = stripTags(dek, $);
let dekText = stripTags(dek, $);

// Plain text links shouldn't exist in the dek. If we have some, it's
// not a good dek - bail.