about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-05-13 12:44:06 -0500
committerCase Duckworth2024-05-13 12:44:06 -0500
commit1ea0b05d96c88daa25da7bcfec727932448862cc (patch)
tree87bb4bba77e33c731941884a56972c34adec3146
parentFix filters (diff)
downloadjimmy-1ea0b05d96c88daa25da7bcfec727932448862cc.tar.gz
jimmy-1ea0b05d96c88daa25da7bcfec727932448862cc.zip
Fix filters
-rwxr-xr-xjimmy21
1 files changed, 16 insertions, 5 deletions
diff --git a/jimmy b/jimmy index a85c448..ed6c2b7 100755 --- a/jimmy +++ b/jimmy
@@ -68,12 +68,14 @@ gmi() {
68 68
69### Filters 69### Filters
70 70
71filter_buff_html(){ cat; }
72
71filter_buff() { 73filter_buff() {
72 f="filter_buff_$to" 74 f="filter_buff_$to"
73 if type "$f" | grep -q function 75 if type "$f" | grep -q function
74 then "$f" | sed -e "s/$nl/\n/g" -e "s/$sp/ /g" # fix whitespace 76 then "$f"
75 else sed -e "s/$nl/\n/g" -e "s/$sp/ /g" 77 else cat
76 fi 78 fi | sed -e "s/$nl/\n/g" -e "s/$sp/ /g" # fix whitespace
77} 79}
78 80
79filter_line() { 81filter_line() {
@@ -106,8 +108,7 @@ pushline() {
106} 108}
107 109
108bufprint() { 110bufprint() {
109 b="$(cat<"$buff" | filter_buff)" 111 b="$(cat<"$buff")"
110 test -n "$b" || return
111 printf "$(eval echo "\$fmtbuff_$1")" "$b" | filter_buff 112 printf "$(eval echo "\$fmtbuff_$1")" "$b" | filter_buff
112 : > "$buff" 113 : > "$buff"
113} 114}
@@ -131,6 +132,16 @@ process() {
131 verbatim=false 132 verbatim=false
132 prev= 133 prev=
133 else 134 else
135 # CONSIDER: "types" of verbatim
136 # designated by extra fields after the
137 # sigil
138 ## ``` class_of_content
139 # ^- change the class of the content,
140 # eg. in html do <pre class="type">
141 # other formats might do other things
142 ## ``` | some_program
143 # ^- pipe the buffer to some_program
144 ## others?
134 bufprint "$prev" 145 bufprint "$prev"
135 verbatim=true 146 verbatim=true
136 fi 147 fi