tazpkg diff modules/description @ rev 844
Finish modularization. Beta release: still have few FIXMEs and TODOs.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Mon Oct 05 03:53:47 2015 +0300 (2015-10-05) |
parents | a02e36d44d06 |
children | 45d90da42ede |
line diff
1.1 --- a/modules/description Fri Aug 28 16:10:34 2015 +0300 1.2 +++ b/modules/description Mon Oct 05 03:53:47 2015 +0300 1.3 @@ -23,11 +23,11 @@ 1.4 unset desc 1.5 1.6 # 1) Localized description 1.7 -for LC in $LANG ${LANG%_*}; do 1.8 - [ -e "$PKGS_DB/descriptions.$LC.txt" ] && 1.9 +for lang in $LANG ${LANG%_*}; do 1.10 + [ -e "$PKGS_DB/descriptions.$lang.txt" ] || continue 1.11 desc="$(awk -vRS='' -vFS='\n' -vOFS='\n' -vp="$1" ' 1.12 $1 == p { $1 = ""; print $0; exit; } 1.13 - ' "$PKGS_DB/descriptions.$LC.txt" | sed '1d')" 1.14 + ' "$PKGS_DB/descriptions.$lang.txt" | sed '1d')" 1.15 done 1.16 1.17 # 2) Installed description 1.18 @@ -44,9 +44,9 @@ 1.19 1.20 # 4) Short description only in interactive terminal 1.21 if [ -z "$desc" ] && im; then 1.22 - for LC in $LANG ${LANG%_*}; do 1.23 - [ -e "$PKGS_DB/packages-desc.$LC" ] && 1.24 - desc=$(awk -F$'\t' -vp="$1" '$1==p {print $2; exit}' "$PKGS_DB/packages-desc.$LC") 1.25 + for lang in $LANG ${LANG%_*}; do 1.26 + [ -e "$PKGS_DB/packages-desc.$lang" ] || continue 1.27 + desc=$(awk -F$'\t' -vp="$1" '$1==p {print $2; exit}' "$PKGS_DB/packages-desc.$lang") 1.28 done 1.29 1.30 [ -z "$desc" -a -s "$PKGS_DB/packages.info" ] && 1.31 @@ -54,10 +54,30 @@ 1.32 fi 1.33 1.34 if [ -n "$desc" ]; then 1.35 - # Title and footer only in interactive terminal 1.36 - im && title 'Description of package "%s"' "$1" 1.37 - longline "$desc" 1.38 - im && footer 1.39 + case $output in 1.40 + html) 1.41 + # Description for TazPanel in html format 1.42 + if [ -n "$(which sundown)" ]; then 1.43 + # Parse description as markdown 1.44 + echo "$desc" | sundown 1.45 + else 1.46 + # Dump description within <pre> tag 1.47 + echo '<pre class="pre-wrap">' 1.48 + echo "$desc" | sed -e 's|\&|\&|g; s|<|\<|g; s|>|\>|g' 1.49 + echo '</pre>' 1.50 + fi 1.51 + ;; 1.52 + *) 1.53 + # Description for terminal tazpkg in plain text 1.54 + # Title and footer only in interactive terminal 1.55 + im && title 'Description of package "%s"' "$1" 1.56 + echo "$desc" 1.57 + im && footer 1.58 + ;; 1.59 + esac 1.60 + 1.61 else 1.62 im && _ 'Description absent.' 1.63 fi 1.64 + 1.65 +exit 0