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 diff --git a/astro b/astro index ede850c..bad6494 100755 --- a/astro +++ b/astro @@ -189,14 +189,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#??}" ;; + "### "*) 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')" link=${line#???} @@ -207,19 +203,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/")$line" - line="$sty_linkb$sty_linkt $linkcount $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