何をしていたか忘れてしまった

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/aya/trunk@84 cec141ff-132a-4243-88a5-ce187bd62f94
This commit is contained in:
yakumo.izuru 2024-03-26 02:18:06 +00:00
parent 41c95cb9ff
commit f3a35c5a2b
8 changed files with 76 additions and 54 deletions

View File

@ -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 '</rss>' >> $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 <file>` re-builds one file and prints resulting content to stdout.
`aya serve` serves your site over HTTP.
`aya var <filename> [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) license.
The software is distributed under the MIT/X11 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 |
---

52
aya.1
View File

@ -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 <file>
.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

View File

@ -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

View File

@ -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)
}

View File

@ -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 (

8
doc.go
View File

@ -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

View File

@ -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))
}

View File

@ -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")