mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-04 16:48:44 +08:00
fix actor/director's name lost space charactor
This commit is contained in:
parent
68b2a57b80
commit
c2ce0c5e0d
@ -85,20 +85,7 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
|||||||
return dataFileNamePath ? dataFileNamePath : DEFAULT_SETTINGS.dataFileNamePath;
|
return dataFileNamePath ? dataFileNamePath : DEFAULT_SETTINGS.dataFileNamePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理特殊字符
|
|
||||||
* @param text
|
|
||||||
* @param textMode
|
|
||||||
*/
|
|
||||||
handleSpecialText(text: string, textMode: TemplateTextMode): string {
|
|
||||||
let result = text;
|
|
||||||
switch (textMode) {
|
|
||||||
case TemplateTextMode.YAML:
|
|
||||||
result = YamlUtil.handleText(text);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -267,6 +254,9 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
|||||||
private parsePartText(template: string, extract: T, context: HandleContext, textMode: TemplateTextMode = TemplateTextMode.NORMAL): string {
|
private parsePartText(template: string, extract: T, context: HandleContext, textMode: TemplateTextMode = TemplateTextMode.NORMAL): string {
|
||||||
const variableMap:Map<string, DataField> = new Map();
|
const variableMap:Map<string, DataField> = new Map();
|
||||||
for (const [key, value] of Object.entries(extract)) {
|
for (const [key, value] of Object.entries(extract)) {
|
||||||
|
if (!value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const type:DataValueType = VariableUtil.getType(value);
|
const type:DataValueType = VariableUtil.getType(value);
|
||||||
variableMap.set(key, new DataField(key, type, value, value));
|
variableMap.set(key, new DataField(key, type, value, value));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@ export default class DoubanMovieLoadHandler extends DoubanAbstractLoadHandler<Do
|
|||||||
.map(i => {
|
.map(i => {
|
||||||
let item = html(i).text();
|
let item = html(i).text();
|
||||||
item = super.html_decode(item);
|
item = super.html_decode(item);
|
||||||
const obj = JSON.parse(item.replace(/[\r\n+]/g, ''));
|
const obj = JSON.parse(item.replace(/[\r\n]+/g, ''));
|
||||||
const idPattern = /(\d){5,10}/g;
|
const idPattern = /(\d){5,10}/g;
|
||||||
const id = idPattern.exec(obj.url);
|
const id = idPattern.exec(obj.url);
|
||||||
const name = obj.name;
|
const name = obj.name;
|
||||||
|
|||||||
@ -86,7 +86,7 @@ export class DoubanTeleplayLoadHandler extends DoubanAbstractLoadHandler<DoubanT
|
|||||||
.map(i => {
|
.map(i => {
|
||||||
let item = html(i).text();
|
let item = html(i).text();
|
||||||
item = super.html_decode(item);
|
item = super.html_decode(item);
|
||||||
const obj = JSON.parse(item.replace(/[\r\n\s+]/g, ''));
|
const obj = JSON.parse(item.replace(/[\r\n]+/g, ''));
|
||||||
const idPattern = /(\d){5,10}/g;
|
const idPattern = /(\d){5,10}/g;
|
||||||
const id = idPattern.exec(obj.url);
|
const id = idPattern.exec(obj.url);
|
||||||
const name = obj.name;
|
const name = obj.name;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user