Update documentation

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
このコミットが含まれているのは:
Izuru Yakumo 2023-05-07 10:59:02 -03:00
コミット ebe1304fb1
2個のファイルの変更35行の追加24行の削除

ファイルの表示

@ -2,7 +2,7 @@
aya is an extremely minimal static site generator written in Go. aya is an extremely minimal static site generator written in Go.
This crow tengu stands for 'the fastest one in Gensokyo' and yes this is also a Touhou Project reference. Named after [Aya Shameimaru](https://en.touhouwiki.net/wiki/Aya_Shameimaru) from [Touhou 9.5: Shoot the Bullet](https://en.touhouwiki.net/wiki/Shoot_the_Bullet)
## Features ## Features
@ -11,14 +11,19 @@ This crow tengu stands for 'the fastest one in Gensokyo' and yes this is also a
* Highly extensible * Highly extensible
* Works well for blogs and generic static websites (landing pages etc) * Works well for blogs and generic static websites (landing pages etc)
* Easy to learn * Easy to learn
* Fast * Fast (duh!)
## Installation ## Installation
Build it manually assuming you have Go installed: Build it manually assuming you have Go installed:
$ go install marisa.chaotic.ninja/aya/cmd/aya@latest $ go install marisa.chaotic.ninja/aya/cmd/aya@latest
--- or ---
$ git clone https://git.chaotic.ninja/yakumo.izuru/aya
$ cd aya
$ make
# make install
## Ideology ## Ideology
Keep your texts in markdown, or HTML format right in the main directory Keep your texts in markdown, or HTML format right in the main directory
@ -56,23 +61,24 @@ Every variable from the content header will be passed via environment variables
Extensions can be written in any language you know (Bash, Python, Lua, JavaScript, Go, even Assembler). Here's an example of how to scan all markdown blog posts and create RSS items: Extensions can be written in any language you know (Bash, Python, Lua, JavaScript, Go, even Assembler). Here's an example of how to scan all markdown blog posts and create RSS items:
``` bash ``` bash
for f in ./blog/*.md ; do #!/bin/sh
d=$($AYA var $f date) echo "Generating RSS feed"
if [ ! -z $d ] ; then
timestamp=`date --date "$d" +%s` echo '<?xml version="1.0" encoding="utf-8"?>' > $AYA_OUTDIR/blog/rss.xml
url=`$AYA var $f url` echo '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $AYA_OUTDIR/blog/rss.xml
title=`$AYA var $f title | tr A-Z a-z` echo '<channel>' >> $AYA_OUTDIR/blog/rss.xml
descr=`$AYA var $f description` for f in ./blog/*/*.md ; do
echo $timestamp \ d=$($AYA var $f date)
"<item>" \ if [ ! -z $d ] ; then
"<title>$title</title>" \ timestamp=`gdate --date "$d" +%s`
"<link>http://zserge.com/$url</link>" \ url=`$AYA var $f url`
"<description>$descr</description>" \ title=`$AYA var $f title | tr A-Z a-z`
"<pubDate>$(date --date @$timestamp -R)</pubDate>" \ descr=`$AYA var $f description`
"<guid>http://zserge.com/$url</guid>" \ echo $timestamp "<item><title>$title</title><link>https://technicalmarisa.chaotic.ninja/blog/$url</link><description>$descr</description><pubDate>$(gdate --date @$timestamp -R)</pubDate><guid>http://technicalmarisa.chaotic.ninja/blog/$url</guid></item>"
"</item>" fi
fi done | sort -r -n | cut -d' ' -f2- >> $AYA_OUTDIR/blog/rss.xml
done | sort -r -n | cut -d' ' -f2- echo '</channel>' >> $AYA_OUTDIR/blog/rss.xml
echo '</rss>' >> $AYA_OUTDIR/blog/rss.xml
``` ```
## Hooks ## Hooks
@ -87,6 +93,11 @@ content generation, or additional commands, like LESS to CSS conversion:
lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css
rm -f $AYA_OUTDIR/styles.css rm -f $AYA_OUTDIR/styles.css
## Extras
`aya` also supports generating `.html` and `.css` by means of using `.amber`
and `.gcss` files. See more at [eknkc/amber](https://github.com/eknkc/amber) [yosssi/gcss](https://github.com/yosssi/gcss)
## Command line usage ## Command line usage
`aya build` re-builds your site. `aya build` re-builds your site.

ファイルの表示

@ -1,4 +1,4 @@
// $TheSupernovaDuo: cmd/aya/main.go,v 0.5.x 2023/4/26 8:49:6 yakumo_izuru Exp $ // $TheSupernovaDuo: cmd/aya/main.go,v 0.5.x 2023/5/7 10:57:10 yakumo_izuru Exp $
package main package main
import ( import (
@ -300,7 +300,7 @@ func buildRaw(path string, w io.Writer) error {
_, err = io.Copy(w, in) _, err = io.Copy(w, in)
return err return err
} }
// This function passes the files to build to their corresponding functions
func build(path string, w io.Writer, vars Vars) error { func build(path string, w io.Writer, vars Vars) error {
ext := filepath.Ext(path) ext := filepath.Ext(path)
if ext == ".md" || ext == ".mkd" || ext == ".markdown" { if ext == ".md" || ext == ".mkd" || ext == ".markdown" {
@ -367,14 +367,14 @@ func servePubDir() {
log.Printf("Serving %v at port 8000, see http://localhost:8000", rootdir) log.Printf("Serving %v at port 8000, see http://localhost:8000", rootdir)
log.Fatal(http.ListenAndServe(":8000", nil)) log.Fatal(http.ListenAndServe(":8000", nil))
} }
// Initialize the environment
func init() { func init() {
// prepend .aya to $PATH, so plugins will be found before OS commands // prepend .aya to $PATH, so plugins will be found before OS commands
p := os.Getenv("PATH") p := os.Getenv("PATH")
p = os.Getenv("PWD") + "/" + AYADIR + ":" + p p = os.Getenv("PWD") + "/" + AYADIR + ":" + p
os.Setenv("PATH", p) os.Setenv("PATH", p)
} }
// Print usage notes
func printUsage() { func printUsage() {
fmt.Printf("%v <command> [args]\n", os.Args[0]) fmt.Printf("%v <command> [args]\n", os.Args[0])
fmt.Printf("\n") fmt.Printf("\n")