commit a4a71d556c1f28ab2878af4698e0d0911f496d31 parent 055ecf1cd2a0e46c3d39955b5153d91143f32643 Author: blmayer <git@mail.blmayer.dev> Date: Sun, 6 Aug 2023 19:22:59 -0300 Removed echo -e call * Also improved some pipelines Diffstat:
M | astro | | | 18 | ++++++++---------- |
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/astro b/astro @@ -175,10 +175,10 @@ typesetgmi() { fi case "$line" in - "### "*) sty="$sty_header3" && line="$(echo "$line" | cut -c 5- )" ;; - "## "*) sty="$sty_header2" && line="$(echo "$line" | cut -c 4-)" ;; - "# "*) sty="$sty_header1" && line="$(echo "$line" | cut -c 3-)" ;; - "> "*) sty="$sty_quote" && line="$(echo "$line" | cut -c 3-)" ;; + "### "*) sty="$sty_header3" && line="${line#'### '}" ;; + "## "*) sty="$sty_header2" && line="${line#'## '}" ;; + "# "*) sty="$sty_header1" && line="${line#'# '}" ;; + "> "*) sty="$sty_quote" && line="${line#> }" ;; "=>"*) link="$(echo "$line" | sed -e 's/^=> *\(\S\+\)\(\s*.*\)/\1 \2/g')" echo "$link" >> "$linksfile" @@ -188,19 +188,17 @@ typesetgmi() { line="$(echo $link | cut -d' ' -f2-)" [ -z "$line" ] && line="$link" - sty="$sty_linkt" - line="$(echo "$sty_linkb$sty_linkt" | sed "s/%linkcount/$linkcount/g")$line" - #debug "link line: $line" + sty="$(echo "$sty_linkb$sty_linkt" | sed "s/%linkcount/$linkcount/g")" ;; - '* '*) sty="$sty_listt" && line="$sty_listb$sty_listt$(echo "$line" | cut -c 2-)";; + '* '*) sty="$sty_listt" && line="$sty_listb$sty_listt${line#* }";; *) sty="";; esac echo "$line" | fold -w "$width" -s | { while IFS='' read -r txt do printf "%*s" "$margin" "" - # shellcheck disable=SC2059 - echo -e "$sty$txt" + printf "$sty" + echo "$txt" done } done