From 64347c601fcb30904857e3ffc3b4d54a617b6441 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sun, 11 Apr 2021 12:40:09 +0430 Subject: everything seems to be working now --- css/devibeans.css | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ css/master.css | 30 +++++++++++++------ server.js | 30 +++++++++++++++---- views/index.ejs | 9 ++++-- 4 files changed, 140 insertions(+), 17 deletions(-) create mode 100644 css/devibeans.css diff --git a/css/devibeans.css b/css/devibeans.css new file mode 100644 index 0000000..cd78393 --- /dev/null +++ b/css/devibeans.css @@ -0,0 +1,88 @@ +/* + devibeans (dark) + Created by Farzad Sadeghi (http://github.com/terminaldweller) + Inspired by vim's jellybeans theme (https://github.com/nanotech/jellybeans.vim) +*/ + +.hljs-comment, +.hljs-quote { + color: #339966; +} + +.hljs-params { + color: #a39e9b; +} + +.hljs-regexp { + color: #d700ff; +} + +/* Red */ +.hljs-tag, +.hljs-selector-id, +.hljs-number, +.hljs-literal { + color: #ef5350; +} + +.hljs.meta { + color: #0087ff; +} + +.hljs-operator { + color: #005faf; +} + +/* devibeans blue */ +.hljs-selector-class, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-keyword { + color: #64b5f6; +} + +/* Paraíso Orange */ +.hljs-built_in, +.hljs-title, +.hljs-deletion { + color: #ff8700; +} + +/* Paraíso Yellow */ +.hljs-type, +.hljs-section, +.hljs-function, +.hljs-name, +.hljs-attribute { + color: #ffd75f; +} + +/* Paraíso Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #558b2f; +} + +/* Paraíso Purple */ +.hljs-selector-tag { + color: #9966ff; +} + +.hljs { + display: block; + overflow-x: auto; + background: #000000; + color: #a39e9b; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/css/master.css b/css/master.css index e1ebd90..0f819e3 100644 --- a/css/master.css +++ b/css/master.css @@ -1,30 +1,42 @@ -@import "parasiso-dark.css"; +@import "devibeans.css"; -body{$ +body { + color: #005f87; + background: #000000; + font-family: "DejaVuSansMono NF", Helvetica, monospace; +} + +.article{$ text-align: left; padding: 2%; border-style: solid; position: relative; - /* left: 0; */ - /* right: 50%; */ white-space: -moz-pre-wrap !important; color: #005f87; background: #000000; font-family: "DejaVuSansMono NF", Helvetica, monospace; overflow-wrap: break-word; + float: left; + width: 78%; } .sidenav { + padding: 2%; color: #005f87; height: 100%; - width: 10%; border-style: solid; - position: fixed; - z-index: 0; + position: relative; + /* z-index: 0; */ top: 0; right: 0; background-color: #000000; overflow-x: hidden; - padding-top: 1%; - text-align: center; + text-align: left; + float: right; + width: 13%; +} + +a { + color: #005f87; + text-decoration: none; } diff --git a/server.js b/server.js index 82b4b07..86681e9 100755 --- a/server.js +++ b/server.js @@ -20,18 +20,16 @@ const mit = require("markdown-it")({ html: true }) }); const app = express(); -app.use(express.static(__dirname)); app.use(express.static(path.join(__dirname, "css"))); app.set("views", path.join(__dirname, "views")); app.set("view engine", "ejs"); app.engine("ejs", require("ejs").__express); -app.get("/", (req, res) => { +app.get("/$", (req, res) => { let readStream = fs.createReadStream( - path.join(__dirname, "mds/cstruct2luatable.md"), + path.join(__dirname, "mds", "cstruct2luatable.md"), "utf-8" ); - // FIXME-this is gonna be so wrong when the md is bigger than one chunk readStream.on("data", (chunk) => { res.render("index", { data: { @@ -42,4 +40,26 @@ app.get("/", (req, res) => { }); }); -app.listen(3000); +app.get("/mds/:mdname$", (req, res) => { + if (req.params["mdname"] == "") { + res.write("nothing requested!"); + } + try { + let readStream = fs.createReadStream( + path.join(__dirname, req.path), + "utf-8" + ); + readStream.on("data", (chunk) => { + res.render("index", { + data: { + blogHttp: mit.render(chunk), + mds: fs.readdirSync(path.join(__dirname, "mds"), "utf-8"), + }, + }); + }); + } catch (err) { + console.log(err); + } +}); + +app.listen(9000); diff --git a/views/index.ejs b/views/index.ejs index 69e8a9d..8c2fe43 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -4,16 +4,19 @@ Blog - +
<% data.mds.forEach(function(md) { %> -

<%= md %>

- <%= md %> + <% }) %>
+
<%- data.blogHttp %> +
-- cgit v1.2.3