plugin support
This commit is contained in:
parent
317dd961a2
commit
4ee5913bd0
7 changed files with 58 additions and 12 deletions
14
examples/plugins/plural.sh
Executable file
14
examples/plugins/plural.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
alterName=$1
|
||||
|
||||
cat << EOF
|
||||
<div class="alter alter-${alterName}">
|
||||
<span class="alter-name">
|
||||
${alterName}@41666$>
|
||||
</span>
|
||||
<span class="message">
|
||||
$(<"/dev/stdin")
|
||||
</span>
|
||||
</div>
|
||||
EOF
|
|
@ -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)
|
||||
];
|
||||
}
|
7
examples/quickstart/pluginTests.doll
Normal file
7
examples/quickstart/pluginTests.doll
Normal 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]
|
13
examples/quickstart/plugins/inline-example.sh
Executable file
13
examples/quickstart/plugins/inline-example.sh
Executable 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
|
8
flake.lock
generated
8
flake.lock
generated
|
@ -59,11 +59,11 @@
|
|||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745093370,
|
||||
"narHash": "sha256-M4Nal2SQ9hW08VVjgV80V5KqC3W/8flsc9hUluIYdYM=",
|
||||
"lastModified": 1745344651,
|
||||
"narHash": "sha256-5hCu3usWVtVPh5WrN7uCu1Kr3rU26/jxD68l9ZhmEfs=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "fb42921ee9a4592b5f055a4e8c4fe244275e4fef",
|
||||
"revCount": 79,
|
||||
"rev": "bd5f16268020b438e9022ddfe555431d3efe891b",
|
||||
"revCount": 81,
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/0x57e11a/markdoll.git"
|
||||
},
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
version,
|
||||
|
||||
# TODO: do not require flakes
|
||||
markdollParser ? inputs.markdoll.packages.${pkgs.system}.markdoll,
|
||||
markdollParser ? inputs.markdoll.packages.${pkgs.system}.markdoll.override({
|
||||
danger = true;
|
||||
}),
|
||||
markdollPlugins ? [],
|
||||
src,
|
||||
|
||||
|
@ -17,6 +19,7 @@ in pkgs.stdenvNoCC.mkDerivation {
|
|||
inherit name version src;
|
||||
|
||||
buildPhase = ''
|
||||
export PATH="$PATH:${pkgs.lib.makeBinPath markdollPlugins}"
|
||||
mkdir dist
|
||||
|
||||
echoerr() { cat <<< "$@" 1>&2; }
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{ pkgs }: binPath: pkgs.stdenvNoCC.mkDerivation {
|
||||
src = binPath;
|
||||
buildPhase = ''
|
||||
mkdir -p $out
|
||||
cp $src $out/plugin
|
||||
'';
|
||||
{ pkgs }: name: src: pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit name src;
|
||||
version = "0.0.0";
|
||||
dontUnpack = true;
|
||||
installPhase = "
|
||||
mkdir -p $out/bin
|
||||
cp $src $out/bin/${name}
|
||||
";
|
||||
}
|
Loading…
Add table
Reference in a new issue