mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
Catching a few more bugs
This commit is contained in:
parent
3d10c98f1c
commit
2aea19bd05
@ -63,7 +63,12 @@ function markdown (mode, input, env) {
|
||||
input = input.replace(/<!--[[\]]-->/g, '');
|
||||
}
|
||||
|
||||
return input ? markdownEngines[mode].render(input, env) : '';
|
||||
try {
|
||||
return input ? markdownEngines[mode].render(input, env) : '';
|
||||
} catch (e) {
|
||||
log(input);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function handlebars (input, env) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
const path = require('path');
|
||||
const { groupBy, keyBy, filter, find, get, memoize } = require('lodash');
|
||||
const { groupBy, keyBy, filter, find, memoize } = require('lodash');
|
||||
const { kind, KIND } = require('./resolve');
|
||||
const File = require('./file');
|
||||
const Asset = require('./asset');
|
||||
@ -22,7 +22,7 @@ module.exports = exports = class Files {
|
||||
this.assets = assets || [];
|
||||
|
||||
this._getTitlecard = memoize(() =>
|
||||
find(assets, { name: 'titlecard', dir: this.base })
|
||||
find(assets, { name: 'titlecard', dir: this.base }),
|
||||
);
|
||||
|
||||
this._getWebReady = memoize(() => assets && keyBy(assets.map((a) => a.webready()), 'name'));
|
||||
|
@ -73,7 +73,7 @@ module.exports = exports = function (md, options) {
|
||||
let token, closeIndex;
|
||||
const tokens = [];
|
||||
const preBlock = openIndex > pos && state.src.slice(pos, openIndex);
|
||||
debug({ l: 75, preBlock, startLine, lastLine });
|
||||
debug({ l: 76, preBlock, startLine, lastLine });
|
||||
openIndex += fenceLen;
|
||||
pos = openIndex;
|
||||
|
||||
@ -90,11 +90,11 @@ module.exports = exports = function (md, options) {
|
||||
}
|
||||
}
|
||||
|
||||
debug({ l: 92, tokens });
|
||||
debug({ l: 93, tokens });
|
||||
|
||||
// find terminating fence
|
||||
if (!scanAhead(state, startLine, pos)) {
|
||||
debug({ l: 96, remaining: state.src.slice(pos) });
|
||||
debug({ l: 97, remaining: state.src.slice(pos) });
|
||||
// console.error(state.src)
|
||||
throw new Error(`Could not find terminating "${options.fence}" for a raw html block.`);
|
||||
}
|
||||
@ -163,8 +163,8 @@ module.exports = exports = function (md, options) {
|
||||
startLine = nextLine + 1;
|
||||
endOfLine = state.eMarks[startLine];
|
||||
|
||||
debug({ l: 164, pos, startLine, endOfLine, remaining: state.src.slice(pos) });
|
||||
} while (pos + fenceLen < endOfLine);
|
||||
debug({ l: 164, pos, startLine, endOfLine, remaining: state.src.slice(pos), scan: state.discreteHtmlScan });
|
||||
} while (pos < endOfLine && state.discreteHtmlScan.present);
|
||||
|
||||
if (closer) {
|
||||
state.tokens.push(closer);
|
||||
|
@ -4,6 +4,8 @@ const fs = require('fs-extra');
|
||||
const { map, uniq } = require('lodash');
|
||||
const { resolve, ROOT } = require('./resolve');
|
||||
const { siteInfo } = require(resolve('package.json'));
|
||||
const log = require('fancy-log');
|
||||
|
||||
|
||||
module.exports = exports = async function writePageContent (engines, pages, posts, prod) {
|
||||
const postIndex = index(posts, engines);
|
||||
@ -99,7 +101,12 @@ function processPages (engines, pages, posts, prod) {
|
||||
|
||||
const state = pageState(page, posts);
|
||||
const json = pageJSON(page);
|
||||
const html = String(engines[page.engine](page.source, state));
|
||||
|
||||
try {
|
||||
var html = String(engines[page.engine](page.source, state));
|
||||
} catch (e) {
|
||||
throw new Error(`Error while processing page "${page.input}": ${e.message}`);
|
||||
}
|
||||
|
||||
json.content = page.content;
|
||||
|
||||
|
@ -106,6 +106,7 @@ module.exports = exports = class Page extends File {
|
||||
const { titlecard, webready } = PublicFiles.for(this.dir);
|
||||
this.ignore = this.meta.ignore;
|
||||
this.draft = this.meta.draft;
|
||||
this.siblings = this.meta.siblings;
|
||||
this.images = webready;
|
||||
this.titlecard = titlecard;
|
||||
if (this.meta.tweets && isString(this.meta.tweets)) this.meta.tweets = this.meta.tweets.split(/\s/);
|
||||
|
Loading…
x
Reference in New Issue
Block a user