From a4a71d556c1f28ab2878af4698e0d0911f496d31 Mon Sep 17 00:00:00 2001 From: blmayer Date: Sun, 6 Aug 2023 19:22:59 -0300 Subject: [PATCH 1/2] Removed echo -e call * Also improved some pipelines --- astro | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/astro b/astro index 403b531..c2e6628 100755 --- 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 From 28c8eae69727721beeec6d9983bfd9da9d3cc7a2 Mon Sep 17 00:00:00 2001 From: Brian Mayer Date: Mon, 7 Aug 2023 14:11:43 -0300 Subject: [PATCH 2/2] Update README.md --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 66eaf8a..6efee53 100644 --- a/README.md +++ b/README.md @@ -69,17 +69,16 @@ The file uses a simple `key=value` style, see the complete example for the defau * The `style-` keys must be ANSI style codes. ``` -cachehome=~/.cache/ margin=8 -homepage=gemini.circumlunar.space -style-header1=35;4;1 -style-header2=35;1 -style-header3=35;4 -style-quote=2;3 -style-link-bullet=33 -style-link-text=36;3 -style-list-bullet=35;1 -style-list-text=0 +homepage="gemini.circumlunar.space/" +sty_header1='\033[35;7;1m' +sty_header2='\033[35;4;1m' +sty_header3='\033[35;4m' +sty_quote='\033[2;3m ' +sty_linkb='\033[35m%linkcount =>' +sty_linkt='\033[36;3m ' +sty_listb='\033[35;1m •' +sty_listt='\033[0m' ``` ## Meta