another post converted

This commit is contained in:
2018-05-24 01:20:18 +02:00
parent 85d5d2c2fc
commit c574383eec
8 changed files with 69 additions and 6 deletions

6
dist/main.js vendored
View File

@ -6,18 +6,14 @@ const logger = require("./log");
const express = require("express");
function getPageOptions(contentStr) {
let pageOptions = {};
// logger.info(`contentStr: ${contentStr}`)
try {
let lines = contentStr.split("\n");
let firstLine = lines[0];
// logger.info(`firstLine: ${firstLine}`)
let pageOptionsStr = firstLine.replace(/^\s*<!-- (\{.+\}) -->[\s\S]*$/, "\$1");
// logger.info(`pageOptionsStr: ${pageOptionsStr}`)
pageOptions = JSON.parse(pageOptionsStr);
// logger.info(JSON.stringify(pageOptions))
}
catch (_a) {
// logger.info("No pageOptions found")
logger.info("No pageOptions found");
}
return pageOptions;
}