From 9327d2b56e6bbc1dd4f4bdf8acf45536f356fe11 Mon Sep 17 00:00:00 2001 From: Izuru Yakumo Date: Mon, 25 Mar 2024 23:18:06 -0300 Subject: [PATCH] =?utf8?q?=E4=BD=95=E3=82=92=E3=81=97=E3=81=A6=E3=81=84?= =?utf8?q?=E3=81=9F=E3=81=8B=E5=BF=98=E3=82=8C=E3=81=A6=E3=81=97=E3=81=BE?= =?utf8?q?=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Izuru Yakumo --- README.md | 45 +++++++++++++++++++-------------------- aya.1 | 52 ++++++++++++++++++++++++++++++++++++--------- cmd/aya/buildall.go | 2 +- cmd/aya/main.go | 18 +++++++--------- cmd/aya/raw.go | 1 + doc.go | 8 ------- serve.go | 4 ++-- usage.go | 2 +- 8 files changed, 77 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 97b7c51..a126c81 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Build it manually assuming you have Go (>=1.17) installed: $ go install marisa.chaotic.ninja/aya/cmd/aya@latest (1) --- or --- - $ git clone https://git.chaotic.ninja/yakumo.izuru/aya + $ git clone https://git.chaotic.ninja/yakumo_izuru/aya $ cd aya $ make # make install @@ -88,36 +88,35 @@ echo '' >> $AYA_OUTDIR/blog/rss.xml ``` ## Hooks - There are two special plugin names that are executed every time the build happens - `prehook` and `posthook`. You can define some global actions here like -content generation, or additional commands, like LESS to CSS conversion: - - # .aya/post - - #!/bin/sh - lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css - rm -f $AYA_OUTDIR/styles.css +content generation, or additional commands, like LESS to CSS conversion Note, you can also place `.gcss` files for [gcss](https://github.com/yosssi/gcss) to process instead ## Command line usage - -`aya build` re-builds your site. - -`aya build ` re-builds one file and prints resulting content to stdout. - -`aya serve` serves your site over HTTP. - -`aya var [var1 var2...]` prints a list of variables defined in the -header of a given markdown file, or the values of certain variables (even if -it's an empty string). - -`aya watch` rebuilds your site every time you modify any file. +Read `aya(1)` ## License - -The software is distributed under the MIT/X11 license. +The software is distributed under the [MIT/X11](LICENSE) license. + +## Sites using Aya! +(I know, I made the majority of them, but they still count) + +| Title | Author | Link | +|------------------------|--------------------------------------------------|---------------------------------------| +| Aya (project homepage) | Izuru Yakumo | https://aya.chaotic.ninja | +| Chaotic Ninja | Izuru Yakumo, Mima-sama | https://chaotic.ninja | +| Geidontei | Izuru Yakumo | https://geidontei.chaotic.ninja | +| ChaoticIRC Network | Izuru Yakumo | https://im.chaotic.ninja | +| Kanako | Izuru Yakumo | https://kanako.chaotic.ninja | +| Kill-9 The Revival | Various authors | https://kill-9.chaotic.ninja | +| PXIMG(7) | Izuru Yakumo | https://pximg.chaotic.ninja | +| Shinmyoumaru | Mima-sama | https://shinmyoumaru.chaotic.ninja | +| Suika | Izuru Yakumo | https://suika.chaotic.ninja | +| TechnicalMarisa | Izuru Yakumo | https://technicalmarisa.chaotic.ninja | +| Tengu Space | [DeviousTengu](https://fedi.tengu.space/devious) | https://tengu.space | +| WindowMaker Shrine | Izuru Yakumo | https://themes.chaotic.ninja | --- diff --git a/aya.1 b/aya.1 index da2dc16..224edc3 100644 --- a/aya.1 +++ b/aya.1 @@ -3,7 +3,14 @@ .Os .Sh NAME .Nm aya -.Nd A really fast static site generator +.Nd The fastest static site generator +.Sh SYNOPSIS +.Nm +.Op build +.Op clean +.Op serve +.Op var Ar file Ar variable +.Op watch .Sh DESCRIPTION Does it need one? .Sh FEATURES @@ -14,6 +21,7 @@ Does it need one? .It Works well for blogs and generic static websites (landing pages etc) .It Easy to learn .It Fast (of course) +.It Only 4 external dependencies! .El .Sh USAGE .Bl -tag -width 11n -compact @@ -39,17 +47,41 @@ any file changed. .El .Sh HISTORY .Nm -was originally forked from -prologic/zs by Izuru out of disgust -with the latest revision, so he used an -earlier commit as a base, and then -eventually reimplemented older features from -the original project. +was forked from +.Lk https://git.mills.io/prologic/zs +due to disgust with how the project +turned out to be. +Later on, features from the original +program were reimplemented and +it took a different path from both. +.Sh ENVIRONMENT +.Bl -tag -width 11n +.It Ev AYADIR +Directory where +extensions, layouts and +hooks placed in to be used +by the program +.It Ev PUBDIR +Directory where generated files are +located +.It Ev AYA_* +Internal variables regarding a +Markdown document in question, +see +.Dq aya var +.El +.Sh EXIT STATUS +.Ex -std .Sh AUTHORS .Nm is maintained by .An Izuru Yakumo -.Aq Lk https://geidontei.chaotic.ninja/usr/yakumo_izuru/ +.Aq Mt yakumo.izuru@chaotic.ninja +.Pp +.Nm zs +was made by +.An Serge Zaitsev +.Aq Mt hello@zserge.com .Sh BUGS -Report them to this mailing list -.Mt devel@chaotic.ninja +If you find any, please report them to +.Aq Mt aya-dev@chaotic.ninja diff --git a/cmd/aya/buildall.go b/cmd/aya/buildall.go index e426d8e..b39b3f7 100644 --- a/cmd/aya/buildall.go +++ b/cmd/aya/buildall.go @@ -38,7 +38,7 @@ func buildAll(watch bool) { run(vars, "prehook") modified = true } - fmt.Println("build:", path) + fmt.Println("GEN", path) return build(path, nil, vars) } return nil diff --git a/cmd/aya/main.go b/cmd/aya/main.go index 7a1b352..e517e47 100644 --- a/cmd/aya/main.go +++ b/cmd/aya/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" + "log" "os" "strings" @@ -39,15 +40,13 @@ func main() { buildAll(false) } else if len(args) == 1 { if err := build(args[0], os.Stdout, globals()); err != nil { - fmt.Println("ERROR: " + err.Error()) - os.Exit(1) + log.Fatal("[build]" + err.Error()) } } else { - fmt.Println("ERROR: too many arguments") - os.Exit(1) + log.Fatal("[build] Too many arguments") } case "clean": - fmt.Println("Removing generated site directory") + fmt.Println("[clean] Removing generated site directory") os.RemoveAll(PUBDIR) case "help": aya.PrintUsage() @@ -55,12 +54,11 @@ func main() { aya.HttpServe(PUBDIR, 8000) case "var": if len(args) == 0 { - fmt.Println("var: filename expected") - os.Exit(1) + log.Fatal("[var] Filename expected") } else { s := "" if vars, _, err := getVars(args[0], Vars{}); err != nil { - fmt.Println("var: " + err.Error()) + log.Fatal("[var]" + err.Error()) } else { if len(args) > 1 { for _, a := range args[1:] { @@ -75,13 +73,13 @@ func main() { fmt.Println(strings.TrimSpace(s)) } case "version": - fmt.Printf("%v\n", aya.PrintVersion()) + aya.PrintVersion() os.Exit(0) case "watch": buildAll(true) default: if s, err := run(globals(), cmd, args...); err != nil { - fmt.Println(err) + log.Fatal(err) } else { fmt.Println(s) } diff --git a/cmd/aya/raw.go b/cmd/aya/raw.go index 83e12f3..376db91 100644 --- a/cmd/aya/raw.go +++ b/cmd/aya/raw.go @@ -1,4 +1,5 @@ // Copy files as-is from source to destination +// If there are heavy files, the generation process can slow down package main import ( diff --git a/doc.go b/doc.go index f895c0e..de6c6bc 100644 --- a/doc.go +++ b/doc.go @@ -4,14 +4,6 @@ // Requires zero configuration to get started // Named after Aya Shameimaru from Touhou Project -// Current subcommands available: -// build -- Generate the site, result can be found at .pub -// build [file] -- Only generate the argument passed to standard output -// serve -- Spawn an HTTP server in localhost port 8000, serving the .pub directory -// var [file] -- Query variables from a markdown file -// version -- Print version and exit -// watch -- (Re)generate site while looking for changes - // Aya is licensed under the MIT license // This is a hard fork of git.mills.io/prologic/zs, which in turn is a fork of zserge's zs // This one (re)incorporates the features removed in the former from the latter diff --git a/serve.go b/serve.go index 655793a..fc23984 100644 --- a/serve.go +++ b/serve.go @@ -33,7 +33,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func HttpServe(Dir string, Port int) { handler := &Handler{http.FileServer(http.Dir(Dir))} http.Handle("/", handler) - addr := fmt.Sprintf(":%d", Port) - log.Printf("Listening on %s\n", addr) + addr := fmt.Sprintf("127.0.0.1:%d", Port) + log.Printf("[aya.HttpServe] Listening on %s\n", addr) log.Fatal(http.ListenAndServe(addr, nil)) } diff --git a/usage.go b/usage.go index de29f00..0d0f160 100644 --- a/usage.go +++ b/usage.go @@ -8,7 +8,7 @@ import ( func PrintUsage() { fmt.Printf("aya/%v\n", PrintFullVersion()) fmt.Println("Homepage: https://aya.chaotic.ninja") - fmt.Println("Repository: https://git.chaotic.ninja/yakumo.izuru/aya") + fmt.Println("Repository: https://git.chaotic.ninja/usr/yakumo_izuru/aya") fmt.Println("==") fmt.Println("build [file] · (Re)build a site or a file in particular") fmt.Println("clean · Remove the generated .pub directory") -- 2.43.0