mirror of
https://github.com/len0rd/personal-website.git
synced 2025-02-28 19:42:15 -05:00
clear out old project generation script
This commit is contained in:
parent
3e7802908a
commit
6a3164fd33
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -9,14 +9,11 @@
|
|||
"version": "0.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dynamic-scrollspy": "^0.2.0",
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.17.1",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-hashtag": "^0.4.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"showdown": "^2.1.0",
|
||||
"showdown-highlight": "^3.0.0"
|
||||
"mkdirp": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
|
@ -936,8 +933,7 @@
|
|||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||
},
|
||||
"dynamic-scrollspy": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dynamic-scrollspy/-/dynamic-scrollspy-0.2.0.tgz",
|
||||
"version": "https://registry.npmjs.org/dynamic-scrollspy/-/dynamic-scrollspy-0.2.0.tgz",
|
||||
"integrity": "sha512-MpzvxeGr8AjpbAF52Dfob926pImY7hwEA7HO5lfNsydZyGB5uS2oLGn/1NKoKkkxQ5VcLfua65RgNZYaFqIRgg=="
|
||||
},
|
||||
"ee-first": {
|
||||
|
@ -1332,8 +1328,7 @@
|
|||
}
|
||||
},
|
||||
"showdown-highlight": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/showdown-highlight/-/showdown-highlight-3.0.0.tgz",
|
||||
"version": "https://registry.npmjs.org/showdown-highlight/-/showdown-highlight-3.0.0.tgz",
|
||||
"integrity": "sha512-xrMPNGaECoFMueD3uortV5r69NFY4oZp50QTrHf21T6aYgBO6FBdv5ibBvGd2atd/FeSsPjUhJOipLL6pwELhg==",
|
||||
"requires": {
|
||||
"highlight.js": "^11.5.0",
|
||||
|
|
|
@ -18,13 +18,10 @@
|
|||
},
|
||||
"homepage": "https://github.com/len0rd/personal-website",
|
||||
"dependencies": {
|
||||
"dynamic-scrollspy": "^0.2.0",
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.17.1",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-hashtag": "^0.4.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"showdown": "^2.1.0",
|
||||
"showdown-highlight": "^3.0.0"
|
||||
"mkdirp": "^1.0.4"
|
||||
}
|
||||
}
|
||||
|
|
34
prestart.js
34
prestart.js
|
@ -9,8 +9,6 @@ const showdown = require('showdown'),
|
|||
showdownHighlight = require("showdown-highlight"),
|
||||
fs = require('fs'),
|
||||
mkdirp = require('mkdirp'),
|
||||
projectInputDir = './project_writeups/',
|
||||
projectOutputDir = './views/partials/md/projects/',
|
||||
recipeInputDir = './recipes/',
|
||||
recipeOutputDir = './views/partials/md/recipes/',
|
||||
recipeListGeneratedOutputDir = './views/partials/generated/',
|
||||
|
@ -47,37 +45,6 @@ const projectsAddHeaderClass = {
|
|||
filter: text => { return addClassToTag(text, projectClassMap); }
|
||||
};
|
||||
|
||||
// create Showdown converters
|
||||
const projectsConverter = new showdown.Converter({
|
||||
extensions: [projectsAddHeaderClass, showdownHighlight],
|
||||
tables: true
|
||||
});
|
||||
|
||||
function convertMarkdownInDirWithShowdown(inputDir, outputDir, converter) {
|
||||
// make the directory for the html output if necessary
|
||||
mkdirp.sync(outputDir);
|
||||
fs.readdir(inputDir, (err, files) => {
|
||||
files.forEach(file => {
|
||||
if (file.endsWith('.md')) {
|
||||
let fileNameNoExtension = file.slice(0, -3);
|
||||
console.log('converting: ' + fileNameNoExtension);
|
||||
fs.readFile(inputDir + file, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
} else {
|
||||
let html = converter.makeHtml(data); // where the magic happens
|
||||
fs.writeFile(outputDir + fileNameNoExtension + '.ejs', html, 'utf8', (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function convertRecipeMarkdown(inputDir, outputDir) {
|
||||
var md = require('markdown-it')()
|
||||
.use(require('markdown-it-hashtag'));
|
||||
|
@ -257,6 +224,5 @@ function generateRecipeNavigatorList(recipeSrcDir, generatedOutputDir) {
|
|||
});
|
||||
}
|
||||
|
||||
convertMarkdownInDirWithShowdown(projectInputDir, projectOutputDir, projectsConverter);
|
||||
convertRecipeMarkdown(recipeInputDir, recipeOutputDir);
|
||||
generateRecipeNavigatorList(recipeInputDir, recipeListGeneratedOutputDir);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
lenordsNet project documentation
|
||||
================================
|
||||
|
||||
`Home <../../>`_
|
||||
----------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<% var rootPath = '../../'; %>
|
||||
<% var navExt = '-nav' %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<%- include(rootPath + 'partials/include') %>
|
||||
<link rel="stylesheet" type="text/css" href="/css/projects.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<%- include(rootPath + 'partials/nav') %>
|
||||
</header>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="row">
|
||||
<div class="col-3 mt-5" id="scrollBar">
|
||||
|
||||
</div>
|
||||
<div data-spy="scroll" data-target="#scrollBar" data-offset="0" class="col-9 mt-5 pt-5 pb-5">
|
||||
<%- include(rootPath + page) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%- include(rootPath + 'partials/footer') %>
|
||||
<%- include(rootPath + 'partials/post_html_include') %>
|
||||
<script type="text/javascript" src="/script/dynamicscrollspy.min.js"></script>
|
||||
<script>
|
||||
$('#scrollBar').DynamicScrollspy({
|
||||
ulClassNames: 'navbar navbar-light bg-light sticky-top sticky-offset'
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue