Skip to content

Commit

Permalink
Merge branch 'main' into trace
Browse files Browse the repository at this point in the history
  • Loading branch information
rnwgnr committed Aug 7, 2023
2 parents be7208a + 28c8eae commit 259c49b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 8 additions & 14 deletions astro
Original file line number Diff line number Diff line change
Expand Up @@ -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#???}
Expand All @@ -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
Expand Down

0 comments on commit 259c49b

Please sign in to comment.