add docs + args on script

Signed-off-by: Superkooka <aymeric.gueracague@gmail.com>
This commit is contained in:
Aymeric GUERACAGUE 2024-04-01 01:46:50 +02:00
parent a7c63fcea0
commit efd2bb1df8
Signed by: Superkooka
GPG Key ID: F78F2B172E894865
3 changed files with 8 additions and 18 deletions

View File

@ -2,23 +2,13 @@
> Under construction, may not working
## Table of contents
- [Setup](#setup)
- [License](#license)
## Setup
This project require only perl, janet and a web server.
This project require only janet to build and a webserver to be served.
> You can use ``perl blog --help`` to see all command available.
To build your differents file into ``public`` directory, just run ``perl blog build``. Now just have to serve static file 🥳.
Note: In developpement, you can use Vagrant with the provided Vagrantfile
You can build a page like that: `janet page.janet raw/~blog/blog.md public/~blog/blog.html`
## License
- Color for code block are heavly inspired by [paste.artemix.org](paste.artemix.org). You can find source code on [Artemis's sourcehut](https://git.sr.ht/~artemis/paste-go)
This program is inspired by [sidey theme](https://github.com/ronv/sidey), [aphrodite.dev source code](https://git.sr.ht/~artemis/aphrodite.dev/tree/1e4c18597c0dae8f41a28b42e6261a71e34c5b54) and [atom 'one light syntax' color theme](https://github.com/atom/one-light-syntax).
This program is distributed under AGPL3, see LICENSE file for more information.

View File

@ -1,7 +1,7 @@
#!/usr/bin/env janet
(def to-ast
"A custom markdown flavored grammar"
"PHP Grammar"
~{
:end-of-line (* (? "\r") "\n")

View File

@ -76,7 +76,7 @@
""))
(defn pp-ast
"Pretty prints the Mardown AST (as provided by (peg/match md-to-ast))"
"Pretty prints the AST (as provided by (peg/match {lang}/to-ast))"
[ast]
(if ast
(do
@ -85,7 +85,7 @@
(print "]"))))
(defn main [bin & args]
(write-to-file "test4.html" (string
(write-to-file (get args 1) (string
```
<!DOCTYPE html>
<html lang="en">
@ -97,7 +97,7 @@
<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">
<link href="public/highlight-style.css" rel="stylesheet">
<link href="../../public/highlight-style.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com/3.3.7"></script>
<script>
tailwind.config = {
@ -126,7 +126,7 @@
</nav>
<main class="my-8 ml-24 mr-[38rem] w-[100%] p-4">
```
(page-ast-to-html (peg/match markdown-page/to-ast (read-from-file "raw/~blog/blog.md")))
(page-ast-to-html (peg/match markdown-page/to-ast (read-from-file (get args 0))))
```
</main>
<footer class="w-full fixed m-1 left-0 bottom-0 flex justify-center">