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

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) $ go install marisa.chaotic.ninja/aya/cmd/aya@latest (1)
--- or --- --- or ---
$ git clone https://git.chaotic.ninja/yakumo.izuru/aya $ git clone https://git.chaotic.ninja/yakumo_izuru/aya
$ cd aya $ cd aya
$ make $ make
# make install # make install
@@ -88,36 +88,35 @@ echo '</rss>' >> $AYA_OUTDIR/blog/rss.xml
``` ```
## Hooks ## Hooks
There are two special plugin names that are executed every time the build 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 happens - `prehook` and `posthook`. You can define some global actions here like
content generation, or additional commands, like LESS to CSS conversion: 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
Note, you can also place `.gcss` files for [gcss](https://github.com/yosssi/gcss) to process instead Note, you can also place `.gcss` files for [gcss](https://github.com/yosssi/gcss) to process instead
## Command line usage ## Command line usage
Read `aya(1)`
`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.
## License ## 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 .Os
.Sh NAME .Sh NAME
.Nm aya .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 .Sh DESCRIPTION
Does it need one? Does it need one?
.Sh FEATURES .Sh FEATURES
@@ -14,6 +21,7 @@ Does it need one?
.It Works well for blogs and generic static websites (landing pages etc) .It Works well for blogs and generic static websites (landing pages etc)
.It Easy to learn .It Easy to learn
.It Fast (of course) .It Fast (of course)
.It Only 4 external dependencies!
.El .El
.Sh USAGE .Sh USAGE
.Bl -tag -width 11n -compact .Bl -tag -width 11n -compact
@@ -39,17 +47,41 @@ any file changed.
.El .El
.Sh HISTORY .Sh HISTORY
.Nm .Nm
was originally forked from was forked from
prologic/zs by Izuru out of disgust .Lk https://git.mills.io/prologic/zs
with the latest revision, so he used an due to disgust with how the project
earlier commit as a base, and then turned out to be.
eventually reimplemented older features from Later on, features from the original
the original project. 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 .Sh AUTHORS
.Nm .Nm
is maintained by is maintained by
.An Izuru Yakumo .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 .Sh BUGS
Report them to this mailing list If you find any, please report them to
.Mt devel@chaotic.ninja .Aq Mt aya-dev@chaotic.ninja

View File

@@ -38,7 +38,7 @@ func buildAll(watch bool) {
run(vars, "prehook") run(vars, "prehook")
modified = true modified = true
} }
fmt.Println("build:", path) fmt.Println("GEN", path)
return build(path, nil, vars) return build(path, nil, vars)
} }
return nil return nil

View File

@@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"log"
"os" "os"
"strings" "strings"
@@ -39,15 +40,13 @@ func main() {
buildAll(false) buildAll(false)
} else if len(args) == 1 { } else if len(args) == 1 {
if err := build(args[0], os.Stdout, globals()); err != nil { if err := build(args[0], os.Stdout, globals()); err != nil {
fmt.Println("ERROR: " + err.Error()) log.Fatal("[build]" + err.Error())
os.Exit(1)
} }
} else { } else {
fmt.Println("ERROR: too many arguments") log.Fatal("[build] Too many arguments")
os.Exit(1)
} }
case "clean": case "clean":
fmt.Println("Removing generated site directory") fmt.Println("[clean] Removing generated site directory")
os.RemoveAll(PUBDIR) os.RemoveAll(PUBDIR)
case "help": case "help":
aya.PrintUsage() aya.PrintUsage()
@@ -55,12 +54,11 @@ func main() {
aya.HttpServe(PUBDIR, 8000) aya.HttpServe(PUBDIR, 8000)
case "var": case "var":
if len(args) == 0 { if len(args) == 0 {
fmt.Println("var: filename expected") log.Fatal("[var] Filename expected")
os.Exit(1)
} else { } else {
s := "" s := ""
if vars, _, err := getVars(args[0], Vars{}); err != nil { if vars, _, err := getVars(args[0], Vars{}); err != nil {
fmt.Println("var: " + err.Error()) log.Fatal("[var]" + err.Error())
} else { } else {
if len(args) > 1 { if len(args) > 1 {
for _, a := range args[1:] { for _, a := range args[1:] {
@@ -75,13 +73,13 @@ func main() {
fmt.Println(strings.TrimSpace(s)) fmt.Println(strings.TrimSpace(s))
} }
case "version": case "version":
fmt.Printf("%v\n", aya.PrintVersion()) aya.PrintVersion()
os.Exit(0) os.Exit(0)
case "watch": case "watch":
buildAll(true) buildAll(true)
default: default:
if s, err := run(globals(), cmd, args...); err != nil { if s, err := run(globals(), cmd, args...); err != nil {
fmt.Println(err) log.Fatal(err)
} else { } else {
fmt.Println(s) fmt.Println(s)
} }

View File

@@ -1,4 +1,5 @@
// Copy files as-is from source to destination // Copy files as-is from source to destination
// If there are heavy files, the generation process can slow down
package main package main
import ( import (

8
doc.go
View File

@@ -4,14 +4,6 @@
// Requires zero configuration to get started // Requires zero configuration to get started
// Named after Aya Shameimaru from Touhou Project // 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 // 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 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 // 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) { func HttpServe(Dir string, Port int) {
handler := &Handler{http.FileServer(http.Dir(Dir))} handler := &Handler{http.FileServer(http.Dir(Dir))}
http.Handle("/", handler) http.Handle("/", handler)
addr := fmt.Sprintf(":%d", Port) addr := fmt.Sprintf("127.0.0.1:%d", Port)
log.Printf("Listening on %s\n", addr) log.Printf("[aya.HttpServe] Listening on %s\n", addr)
log.Fatal(http.ListenAndServe(addr, nil)) log.Fatal(http.ListenAndServe(addr, nil))
} }

View File

@@ -8,7 +8,7 @@ import (
func PrintUsage() { func PrintUsage() {
fmt.Printf("aya/%v\n", PrintFullVersion()) fmt.Printf("aya/%v\n", PrintFullVersion())
fmt.Println("Homepage: https://aya.chaotic.ninja") 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("==")
fmt.Println("build [file] · (Re)build a site or a file in particular") fmt.Println("build [file] · (Re)build a site or a file in particular")
fmt.Println("clean · Remove the generated .pub directory") fmt.Println("clean · Remove the generated .pub directory")