Browse Source

Fixed small issues with the static blog previewer.

pull/29/head
jrtechs 6 years ago
parent
commit
83ca381fd6
2 changed files with 10 additions and 40 deletions
  1. +0
    -1
      includes/staticContentServer.js
  2. +10
    -39
      utils/renderBlogPost.js

+ 0
- 1
includes/staticContentServer.js View File

@ -13,7 +13,6 @@ module.exports=
serveStaticContent: function(request, result, filename, baseURL)
{
console.log(filename);
if (filename.includes(".svg") || filename.includes(".svg"))
{
includes.sendSVG(result, baseURL + filename);

+ 10
- 39
utils/renderBlogPost.js View File

@ -79,50 +79,21 @@ module.exports=
{
sql.getCategory(post.category_id).then(function(category)
{
resolve(module.exports.generateBlogPost(post.url, category[0].url, blocks));
// const pathName = "blogContent/posts/" + category[0].url + "/"
// + post.url + ".md";
// var markDown = utils.getFileContents(pathName).toString();
// markDown = markDown.split("(media/").join("(" + "../blogContent/posts/"
// + category[0].url + "/media/");
//
// module.exports.convertToHTML(markDown, blocks).then(function(result)
// {
//
// result = result.split("<figcaption>").join("<figcaption style=\"visibility: hidden;\">");
//
// //this line prevents older versions of pandoc from including invalid cdm scripts
// result = result.split("<script src=\"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full\" type=\"text/javascript\"></script>").join("");
//
// if(blocks == -1)
// resolve(result);
//
// const htmlBlocks = result.split("<p>");
// var html = "";
// for(var i = 0; i < blocks; i++)
// {
// html += "<p>" + htmlBlocks[i];
// }
//
// html += " <div style=\"\">\n" +
// " <p class='text-center'><button class=\"btn btn-secondary btn-lg " +
// "w3-padding-large w3-white w3-border\" onclick=\"location.href='" +
// "http://jrtechs.net/" + category[0].url + "/" + post.url +
// "'\"><b>READ MORE &raquo;</b></button></p>\n" +
// " </div>\n";
//
// resolve(html);
//
// }).catch(function(error)
// {
// reject(error);
// })
resolve(module.exports.generateBlogPostComponent(category[0].url, post.url, blocks));
});
})
},
/**
* Decomposition from Generate Blog Post used for the
* blog previewer.
*
* @param categoryURL
* @param postURL
* @param blocks
* @returns {Promise}
*/
generateBlogPostComponent: function(categoryURL, postURL, blocks)
{
return new Promise(function(resolve, reject)

Loading…
Cancel
Save