You've already forked obsidian-visualiser
Merge branch 'character' into dev
This commit is contained in:
@@ -34,12 +34,11 @@ export default defineTask({
|
||||
{
|
||||
const title = basename(e.path);
|
||||
const order = /(\d+)\. ?(.+)/gsmi.exec(title);
|
||||
const path = (e.path as string).split('/').map(f => { const check = /(\d+)\. ?(.+)/gsmi.exec(f); return check && check[2] ? check[2] : f }).join('/');
|
||||
return {
|
||||
id: getID(ID_SIZE),
|
||||
path: parsePath(path),
|
||||
path: parsePath(e.path),
|
||||
order: i,
|
||||
title: order && order[2] ? order[2] : title,
|
||||
title: title,
|
||||
type: 'folder',
|
||||
content: null,
|
||||
owner: 1,
|
||||
@@ -52,14 +51,13 @@ export default defineTask({
|
||||
const extension = extname(e.path);
|
||||
const title = basename(e.path, extension);
|
||||
const order = /(\d+)\. ?(.+)/gsmi.exec(title);
|
||||
const path = (e.path as string).split('/').map(f => { const check = /(\d+)\. ?(.+)/gsmi.exec(f); return check && check[2] ? check[2] : f }).join('/');
|
||||
const content = (await $fetch(`https://git.peaceultime.com/api/v1/repos/peaceultime/system-aspect/raw/${encodeURIComponent(e.path)}`));
|
||||
|
||||
return {
|
||||
id: getID(ID_SIZE),
|
||||
path: parsePath(extension === '.md' ? path.replace(extension, '') : path),
|
||||
path: parsePath(extension === '.md' ? e.path.replace(extension, '') : e.path),
|
||||
order: i,
|
||||
title: order && order[2] ? order[2] : title,
|
||||
title: title,
|
||||
type: (typeMapping[extension] ?? 'file'),
|
||||
content: reshapeContent(content as string, typeMapping[extension] ?? 'File'),
|
||||
owner: 1,
|
||||
@@ -107,8 +105,8 @@ function reshapeContent(content: string, type: FileType): string | null
|
||||
return content;
|
||||
case "canvas":
|
||||
const data = JSON.parse(content) as CanvasContent;
|
||||
data.edges?.forEach(e => e.color = typeof e.color === 'string' ? getColor(e.color) : undefined);
|
||||
data.nodes?.forEach(e => e.color = typeof e.color === 'string' ? getColor(e.color) : undefined);
|
||||
data.edges?.forEach(e => { console.log(e.color); e.color = typeof e.color === 'string' ? getColor(e.color) : undefined; console.log(e.color); });
|
||||
data.nodes?.forEach(e => { console.log(e.color); e.color = typeof e.color === 'string' ? getColor(e.color) : undefined; console.log(e.color); });
|
||||
return JSON.stringify(data);
|
||||
default:
|
||||
case 'folder':
|
||||
|
||||
Reference in New Issue
Block a user