Also print the description if present. - gophercgis - Collection of gopher CGI/DCGI for geomyidae
(HTM) hg clone https://bitbucket.org/iamleot/gophercgis
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) changeset 48bda1e62ffa26000aa74f21d941a5520c099748
(DIR) parent b5191d95a317ae6e93b82c28a0aeea696f0d64df
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Tue, 7 Aug 2018 19:15:02
Also print the description if present.
Diffstat:
lobsters/comments.dcgi | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff -r b5191d95a317 -r 48bda1e62ffa lobsters/comments.dcgi
--- a/lobsters/comments.dcgi Tue Aug 07 19:06:44 2018 +0200
+++ b/lobsters/comments.dcgi Tue Aug 07 19:15:02 2018 +0200
@@ -6,7 +6,7 @@
/usr/pkg/bin/jq -r '
.title + "\u001c" + .url + "\u001c" + ( .score | tostring ) + "\u001c" +
( .created_at[0:19] + "Z" | sub("T"; " ") | sub("Z"; "") | sub(":[0-9]+$"; "") ) + "\u001c" +
- .submitter_user.username + "\u001e",
+ .submitter_user.username + "\u001c" + .description + "\u001e",
( .comments[] |
.commenting_user.username + "\u001c" +
( .indent_level | tostring ) + "\u001c" +
@@ -43,13 +43,19 @@
return s
}
-function print_title(title, url, score, created_at, username) {
+function print_title(title, url, score, created_at, username, description) {
+ fmt_cmd = "/usr/pkg/bin/par -d 0 -B=. -w 80"
+
gsub("\\|", "\\|", title)
print ""
print "Lobsters - Comments"
print ""
print "[h|" title "|" "URL:" url "|server|port]"
+ if (description) {
+ print description | fmt_cmd
+ close(fmt_cmd)
+ }
print "via " username " " created_at " " "(" score ")"
print ""
}
@@ -80,8 +86,9 @@
score = $3
created_at = $4
username = $5
+ description = html2text($6)
- print_title(title, url, score, created_at, username)
+ print_title(title, url, score, created_at, username, description)
next
}