mirror of
https://gitlab.com/octtspacc/sitoctt
synced 2025-06-05 22:09:20 +02:00
.
This commit is contained in:
@ -1,11 +1,18 @@
|
||||
#!/usr/bin/env -S node --experimental-fetch
|
||||
require('./Lib/Syncers.js').importAll();
|
||||
const JSDOM = require('jsdom').JSDOM;
|
||||
// TODO: turndown HTML to Markdown
|
||||
|
||||
const BlogURL = 'https://listed.to/@u8'; // Full base URL of the Listed blog (any server)
|
||||
const SiteName = 'sitoctt';
|
||||
//const DefaultMode = 'Include' // 'Include' or 'Exclude' | Not implemented
|
||||
const PostsFileDate = true; // Append dates (YYYY-MM-DD) to posts file names
|
||||
const FrontmatterNew = {
|
||||
createdon: "Date",
|
||||
updatedon: "Lastmod",
|
||||
categories: Array,
|
||||
htmltitle: false,
|
||||
};
|
||||
let Replacements = { // Format: { ReplaceWithString: [ToFindString] }
|
||||
"<h2>[:HNotesRefsHTML:]</h2>": "<h2>🏷️ Note e Riferimenti</h2>",
|
||||
'<div class="footnotes">': ['<div class="footnotes"><hr>', '<div class="footnotes">\n<hr>'],
|
||||
@ -90,8 +97,16 @@ const MakeMetaStr = Post => {
|
||||
const Marks = { Meta: "%", Macros: "$" };
|
||||
Object.keys(Post[Type]).forEach((Key) => {
|
||||
//Str += `// ${Marks[Type]} ${Key} = ${Post[Type][Key]}\n`;
|
||||
// TODO: should this properly handle non-strings?
|
||||
Str += `${Key} = ${JSON.stringify(Post[Type][Key])}\n`;
|
||||
// TODO: should this handle bools properly?
|
||||
let Value = Post[Type][Key];
|
||||
const KeyNew = FrontmatterNew[Key.toLowerCase()];
|
||||
if (KeyNew === false) {
|
||||
return;
|
||||
} else if (KeyNew === Array) {
|
||||
KeyNew = null;
|
||||
Value = `[ "${Value.split(' ').join('", "')}" ]`;
|
||||
}
|
||||
Str += `${KeyNew || Key} = ${isNaN(Value.replaceAll('-', '')) ? JSON.stringify(Value) : Value}\n`;
|
||||
});
|
||||
});
|
||||
return `+++\n${Str}+++\n`; //Str;
|
||||
@ -200,9 +215,8 @@ const HandlePost = (PostSrc, Output) => {
|
||||
if (Output == 'file') {
|
||||
TryMkdirSync(PathDir);
|
||||
Fs.writeFileSync(FinalFilePath, `\
|
||||
${/* Post.IsToml ? Post.RawMeta : */ MakeMetaStr(Post)}
|
||||
${Post.IsToml ? Post.RawMeta : MakeMetaStr(Post)}
|
||||
<!-- Autogenerated by ListedDownsync.js. Do not edit (unless also set "% Downsync = False") - it would be overwritten. -->
|
||||
<h1>${Post.Meta.HTMLTitle ? Post.Meta.HTMLTitle : Post.Meta.Title}</h1>
|
||||
|
||||
${Post.Content}
|
||||
`);
|
||||
|
Reference in New Issue
Block a user