Compare commits

..

2 commits

Author SHA1 Message Date
a3a6f409dc
testing: various changes
All checks were successful
Export / Explore-GitHub-Actions (push) Successful in 42s
2024-08-05 23:31:35 +02:00
afc44a56df
testing: various changes 2024-08-05 23:31:20 +02:00
3 changed files with 12 additions and 21 deletions

View file

@ -23,7 +23,7 @@
;(converter :name :gemini :extension ".md" :command "./gemini.sh %OUT %IN") ;(converter :name :gemini :extension ".md" :command "./gemini.sh %OUT %IN")
(converter :name :markdown :extension ".md" :command "peg-markdown -t html -o %OUT data/%IN") (converter :name :markdown :extension ".md" :command "peg-markdown -t html -o %OUT data/%IN")
(converter :name :markdown2 :extension ".md" :command "multimarkdown -o %OUT data/%IN") (converter :name :markdown2 :extension ".md" :command "mm-sh %OUT data/%IN")
(converter :name :org-mode :extension ".org" (converter :name :org-mode :extension ".org"
:command (concatenate 'string :command (concatenate 'string
"emacs data/%IN --batch --eval '(with-temp-buffer (org-mode) " "emacs data/%IN --batch --eval '(with-temp-buffer (org-mode) "

View file

@ -11,6 +11,16 @@
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = nixpkgs.legacyPackages.${system}.extend cl-nix-lite.overlays.default; pkgs = nixpkgs.legacyPackages.${system}.extend cl-nix-lite.overlays.default;
mm-sh = pkgs.writeShellScriptBin "mm-sh" ''
#!/bin/sh
cat data/$2 |perl -0pe 's/\[\^(.*?)\]\:(.*?)(\n\n)/\<span class="marginnote"\>\2\<\/span\>/gms' > $1.tmp
# perl -0pe 's/\[\^(.*?)\][^:]/\<label for\="\1" class\="margin-toggle"\>/gms'
multimarkdown -t html -o $1 $1.tmp && cat $1 |
perl -0pe 's/(\<h2|^)(.*?)(?=(\<h2)|\Z)/\n\<section\>\n\1\2\n<\/section\>\n/gms' |
perl -0pe 's/(\<blockquote\>.*?\<\/blockquote\>)/\<div class="epigraph"\>\n\1\n\<\/div\>/gms' |
perl -0pe 's/(\<blockquote\>.*?)\n(.*?)(\<\/blockquote\>)/\1\<footer\>\2\<\/footer\>\3/gms' > $1.new && mv $1.new $1
rm $1.tmp
'';
in in
{ {
packages = { packages = {
@ -33,16 +43,7 @@
pkgs.asdf pkgs.asdf
pkgs.perl pkgs.perl
pkgs.multimarkdown pkgs.multimarkdown
# pkgs.writeShellScript "mm-sh" '' mm-sh
# #!/bin/sh
# cat data/$2 |perl -0pe 's/\[\^(.*?)\]\:(.*?)(\n\n)/\<span class="marginnote"\>\2\<\/span\>/gms' > $1.tmp
# # perl -0pe 's/\[\^(.*?)\][^:]/\<label for\="\1" class\="margin-toggle"\>/gms'
# multimarkdown -t html -o $1 $1.tmp && cat $1 |
# perl -0pe 's/(\<h2|^)(.*?)(?=(\<h2)|\Z)/\n\<section\>\n\1\2\n<\/section\>\n/gms' |
# perl -0pe 's/(\<blockquote\>.*?\<\/blockquote\>)/\<div class="epigraph"\>\n\1\n\<\/div\>/gms' |
# perl -0pe 's/(\<blockquote\>.*?)\n(.*?)(\<\/blockquote\>)/\1\<footer\>\2\<\/footer\>\3/gms' > $1.new && mv $1.new $1
# rm $1.tmp
# ''
]; ];
phases = [ "unpackPhase" "installPhase" "cleanupPhase" ]; phases = [ "unpackPhase" "installPhase" "cleanupPhase" ];

View file

@ -1,10 +0,0 @@
#!/bin/sh
cat data/$2 | ${perl} -0pe 's/\[\^(.*?)\]\:(.*?)(\n\n)/\<span class="marginnote"\>\2\<\/span\>/gms' > $1.tmp
# perl -0pe 's/\[\^(.*?)\][^:]/\<label for\="\1" class\="margin-toggle"\>/gms'
${multimarkdown} -t html -o $1 $1.tmp && cat $1 |
${perl} -0pe 's/(\<h2|^)(.*?)(?=(\<h2)|\Z)/\n\<section\>\n\1\2\n<\/section\>\n/gms' |
${perl} -0pe 's/(\<blockquote\>.*?\<\/blockquote\>)/\<div class="epigraph"\>\n\1\n\<\/div\>/gms' |
${perl} -0pe 's/(\<blockquote\>.*?)\n(.*?)(\<\/blockquote\>)/\1\<footer\>\2\<\/footer\>\3/gms' > $1.new && mv $1.new $1
rm $1.tmp