plugin support

This commit is contained in:
41666 2025-04-22 11:18:59 -07:00
parent 317dd961a2
commit 4ee5913bd0
7 changed files with 58 additions and 12 deletions

14
examples/plugins/plural.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
alterName=$1
cat << EOF
<div class="alter alter-${alterName}">
<span class="alter-name">
${alterName}@41666$>&nbsp;
</span>
<span class="message">
$(<"/dev/stdin")
</span>
</div>
EOF

View file

@ -1,4 +1,4 @@
{ pkgs, brewTea, ... }: brewTea {
{ pkgs, brewTea, mkMarkdollPlugin }: brewTea {
name = "examples_quickstart";
version = "0.0.0";
@ -7,4 +7,11 @@
# maybe don't do this but its possible to reference _any file_.
defaultLayout = ./layouts/default.html;
# these are mostly for alias purposes...
# can do an [invoke(plural)(...):yay!] type thing
# one can invoke stuff inline too without doing this.
markdollPlugins = [
(mkMarkdollPlugin "plural" ../plugins/plural.sh)
];
}

View file

@ -0,0 +1,7 @@
---
title: plugin tests
---
&plural plugin
[invoke(plural)(aki):hi this one is aki]
[invoke(plural)(noe):hi this one is noe]

View file

@ -0,0 +1,13 @@
#!/bin/sh
flip() {
LC_ALL=C LC_ALL=en_US.UTF-8 rev <"/dev/stdin"
}
main() {
case $1 in
flip) flip;;
esac
}
main $1