mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-21 21:47:18 +09:00
2.0.3
This commit is contained in:
parent
4cc6be225e
commit
d774c992bf
@ -1,4 +1,4 @@
|
||||
2.0.3 / unreleased
|
||||
2.0.3 / 2017-05-06
|
||||
------------------
|
||||
* Improve title cleanuping
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "summaly",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"description": "Get web page's summary",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"license": "MIT",
|
||||
|
@ -9,11 +9,12 @@ export default function(title: string, siteName?: string): string {
|
||||
const x = escapeRegExp(siteName);
|
||||
|
||||
const patterns = [
|
||||
`^(.+?)\s?[\-\|:・]\s?${x}$`
|
||||
].map(p => new RegExp(p));
|
||||
`^(.+?)\\s?[\\-\\|:・]\\s?${x}$`
|
||||
];
|
||||
|
||||
for (let i = 0; i < patterns.length; i++) {
|
||||
const [, match] = patterns[i].exec(title);
|
||||
const pattern = new RegExp(patterns[i]);
|
||||
const [, match] = pattern.exec(title) || [null, null];
|
||||
if (match) return match;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user