write page to stdout
Signed-off-by: Superkooka <aymeric.gueracague@gmail.com>
This commit is contained in:
parent
842841acff
commit
077ce05710
42
blog.janet
42
blog.janet
|
|
@ -65,11 +65,11 @@
|
|||
(defn ast-to-html
|
||||
"Convert an AST to html"
|
||||
[ast]
|
||||
(defn to-codeblock [lang value] (string "<pre><code>" (htmlspecialchars value) "</code></pre>"))
|
||||
(defn to-codeblock [lang value] (string "<pre class=\"my-4\"><code>" (htmlspecialchars value) "</code></pre>"))
|
||||
(defn to-codeline [value] (string "<code>" (ast-to-html value) "</code>"))
|
||||
(defn to-heading [level value] (string "<h" level ">" (htmlspecialchars value) "</h" level ">"))
|
||||
(defn to-quote [value] (string "<blockquote>" (ast-to-html value) "</blockquote>"))
|
||||
(defn to-line [value] (string "<p>" (ast-to-html value) "</p>"))
|
||||
(defn to-heading [level value] (string "<h" level " class=\"my-4\">" (htmlspecialchars value) "</h" level ">"))
|
||||
(defn to-quote [value] (string "<blockquote class=\"my-4\">" (ast-to-html value) "</blockquote>"))
|
||||
(defn to-line [value] (string "<p class=\"my-4\">" (ast-to-html value) "</p>"))
|
||||
(defn to-italic [value] (string "<em>" (ast-to-html value) "</em>"))
|
||||
(defn to-bold [value] (string "<strong>" (ast-to-html value) "</strong>"))
|
||||
(defn to-stroke [value] (string "<stroke>" (ast-to-html value) "</stroke>"))
|
||||
|
|
@ -77,26 +77,16 @@
|
|||
(string/join
|
||||
(map
|
||||
|(match $0
|
||||
[:code-block lang value]
|
||||
(to-codeblock lang value)
|
||||
[:heading level value]
|
||||
(to-heading level value)
|
||||
[:quote value]
|
||||
(to-quote value)
|
||||
[:hr]
|
||||
"<hr/>"
|
||||
[:line value]
|
||||
(to-line value)
|
||||
[:text value]
|
||||
(htmlspecialchars value)
|
||||
[:italic value]
|
||||
(to-italic value)
|
||||
[:stroke value]
|
||||
(to-stroke value)
|
||||
[:bold value]
|
||||
(to-bold value)
|
||||
[:code-line value]
|
||||
(to-codeline value)
|
||||
[:code-block lang value] (to-codeblock lang value)
|
||||
[:heading level value] (to-heading level value)
|
||||
[:quote value] (to-quote value)
|
||||
[:hr] "<hr/>"
|
||||
[:line value] (to-line value)
|
||||
[:text value] (htmlspecialchars value)
|
||||
[:italic value] (to-italic value)
|
||||
[:stroke value] (to-stroke value)
|
||||
[:bold value] (to-bold value)
|
||||
[:code-line value] (to-codeline value)
|
||||
_
|
||||
(error (string "Invalid symbol: " (get $0 0))))
|
||||
ast)
|
||||
|
|
@ -113,4 +103,6 @@
|
|||
|
||||
(defn main [bin & args]
|
||||
# (pp-ast (peg/match md-to-ast (read-from-file "raw/~blog/blog.md")))
|
||||
(print (ast-to-html (peg/match md-to-ast (read-from-file "raw/~blog/blog.md")))))
|
||||
(print (read-from-file "partial-template/header.html"))
|
||||
(print (ast-to-html (peg/match md-to-ast (read-from-file "raw/~blog/blog.md"))))
|
||||
(print (read-from-file "partial-template/footer.html")))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
</main>
|
||||
<footer class="w-full fixed m-1 left-0 bottom-0 flex justify-center">
|
||||
<a class="mx-1 underline" href="#">Flux RSS</a>
|
||||
<span class="mx-1">•</span>
|
||||
<a class="mx-1 underline" href="#">Inspirer de Sidey</a>
|
||||
<span class="mx-1">•</span>
|
||||
<a class="mx-1 underline" href="#">GitHub</a>
|
||||
<span class="mx-1">•</span>
|
||||
<a class="mx-1 underline" href="#">Instagram</a>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400&display=swap" rel="stylesheet">
|
||||
<script src="https://cdn.tailwindcss.com/3.3.7"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
theme: {
|
||||
extend: {
|
||||
fontFamily: {
|
||||
'sans': ['"Source Sans 3"'],
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<title>Meow</title>
|
||||
</head>
|
||||
|
||||
<body class="flex flex-row my-8">
|
||||
<nav class="my-8 ml-16 text-xl">
|
||||
<div class="flex flex-row">
|
||||
<ul class="flex flex-col mr-6">
|
||||
<li class="p-1 w-max"><a href="../index.html">Blog</a></li>
|
||||
<li class="p-1 w-max"><a href="index.html">Portfolio</a></li>
|
||||
<li class="p-1 w-max"><a href="index.html">À Propos de moi</a></li>
|
||||
</ul>
|
||||
<span class="after:content-[''] after:w-[1px] after:bg-black after:my-2 after:h-4/5 after:block"></span>
|
||||
</div>
|
||||
</nav>
|
||||
<main class="my-8 ml-24 mr-[38rem]">
|
||||
Loading…
Reference in New Issue