mirror of
https://gitlab.com/octtspacc/sitoctt
synced 2025-06-05 22:09:20 +02:00
Init con Hugo, conversione ListedDownsync.js, fix metadati post
This commit is contained in:
@ -6,24 +6,33 @@ Exp.ConfigParser = require('./config-ini-parser').ConfigIniParser;
|
||||
Exp.importAll = function importAll(){ delete this.importAll; Object.assign(global, this); };
|
||||
|
||||
Exp.ParseMeta = (Raw) => {
|
||||
let Mid = { Meta: "", Macros: "", };
|
||||
let Data = { Meta: {}, Macros: {}, };
|
||||
let Mid = { Meta: "", Macros: "" };
|
||||
let Data = { Meta: {}, Macros: {}, IsToml: false };
|
||||
const Lines = Raw.trim().split('\n');
|
||||
if (Lines[0].trim() === '+++' && Lines.slice(-1)[0].trim() === '+++') {
|
||||
Data.IsToml = true;
|
||||
Lines = Lines.slice(1, -1);
|
||||
}
|
||||
for (let i=0; i<Lines.length; i++) {
|
||||
let Type;
|
||||
let Line = Lines[i].trim();
|
||||
if (Line.startsWith('//')) {
|
||||
Line = Line.slice('2').trim();
|
||||
};
|
||||
if (Line.startsWith('%')) {
|
||||
Type = 'Meta';
|
||||
} else if (Line.startsWith('$')) {
|
||||
Type = 'Macros';
|
||||
}
|
||||
if (['%', '$'].includes(Line[0])) {
|
||||
if (Line.startsWith('%')) {
|
||||
Type = 'Meta';
|
||||
} else if (Line.startsWith('$')) {
|
||||
Type = 'Macros';
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
if (!Data.IsToml) {
|
||||
continue;
|
||||
}
|
||||
Mid.Meta += Line.trim() + '\n';
|
||||
}
|
||||
Mid[Type] += Line.substring(1).trim() + '\n';
|
||||
};
|
||||
}
|
||||
Object.keys(Mid).forEach((Type) => {
|
||||
const Items = new ConfigParser().parse(Mid[Type]).items();
|
||||
Items.forEach((Item) => {
|
||||
|
Reference in New Issue
Block a user