Compare commits
2 commits
90fa345862
...
a3a6f409dc
Author | SHA1 | Date | |
---|---|---|---|
a3a6f409dc | |||
afc44a56df |
3 changed files with 12 additions and 21 deletions
|
@ -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) "
|
||||||
|
|
21
flake.nix
21
flake.nix
|
@ -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" ];
|
||||||
|
|
|
@ -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
|
|
Loading…
Add table
Reference in a new issue