|
|
@ -61,8 +61,10 @@ export default class Pages {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Edits single page based on id and task
|
|
|
|
* Edits single page based on id and task
|
|
|
|
* @parameter id: id of page being edited
|
|
|
|
* @parameter body: object that contains all page information
|
|
|
|
* @parameter task: type of task being performed
|
|
|
|
* @parameter id: identifier for page being edited
|
|
|
|
|
|
|
|
* @parameter task: type of task being performed - listed in DataEvents Class
|
|
|
|
|
|
|
|
* @parameter user: object containin user information
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
editPage(body, id, task, user) {
|
|
|
|
editPage(body, id, task, user) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
@ -177,6 +179,10 @@ export default class Pages {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Renders all pages from markdown to html
|
|
|
|
|
|
|
|
* @parameter theme: current theme being used as defined in settings
|
|
|
|
|
|
|
|
*/
|
|
|
|
publish(theme) {
|
|
|
|
publish(theme) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this.getPage()
|
|
|
|
this.getPage()
|
|
|
@ -205,7 +211,8 @@ export default class Pages {
|
|
|
|
let html = md.render(buffed, { html: true, xhtmlOut: true });
|
|
|
|
let html = md.render(buffed, { html: true, xhtmlOut: true });
|
|
|
|
let file = pug.renderFile('content/themes/' + theme + '/index.pug', {
|
|
|
|
let file = pug.renderFile('content/themes/' + theme + '/index.pug', {
|
|
|
|
title: page.metadata.title,
|
|
|
|
title: page.metadata.title,
|
|
|
|
content: html
|
|
|
|
default_bg: page.metadata.feature,
|
|
|
|
|
|
|
|
content_index: html
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fs.writeFile('public/index.html', file, err => {
|
|
|
|
fs.writeFile('public/index.html', file, err => {
|
|
|
|