mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-22 05:57:19 +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
|
* Improve title cleanuping
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "summaly",
|
"name": "summaly",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"description": "Get web page's summary",
|
"description": "Get web page's summary",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -9,11 +9,12 @@ export default function(title: string, siteName?: string): string {
|
|||||||
const x = escapeRegExp(siteName);
|
const x = escapeRegExp(siteName);
|
||||||
|
|
||||||
const patterns = [
|
const patterns = [
|
||||||
`^(.+?)\s?[\-\|:・]\s?${x}$`
|
`^(.+?)\\s?[\\-\\|:・]\\s?${x}$`
|
||||||
].map(p => new RegExp(p));
|
];
|
||||||
|
|
||||||
for (let i = 0; i < patterns.length; i++) {
|
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;
|
if (match) return match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user