Compare commits

..

No commits in common. "a3a6f409dc5c09e0d887db28a4bd6ae2b4a84051" and "90fa34586217de24fa3cc62db061ebd82042122e" have entirely different histories.

3 changed files with 21 additions and 12 deletions

View file

@ -23,7 +23,7 @@
;(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 :markdown2 :extension ".md" :command "mm-sh %OUT data/%IN")
(converter :name :markdown2 :extension ".md" :command "multimarkdown -o %OUT data/%IN")
(converter :name :org-mode :extension ".org"
:command (concatenate 'string
"emacs data/%IN --batch --eval '(with-temp-buffer (org-mode) "

View file

@ -11,16 +11,6 @@
flake-utils.lib.eachDefaultSystem (system:
let
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
{
packages = {
@ -43,7 +33,16 @@
pkgs.asdf
pkgs.perl
pkgs.multimarkdown
mm-sh
# pkgs.writeShellScript "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" ];

10
multimarkdown.sh Executable file
View file

@ -0,0 +1,10 @@
#!/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