Use par to pretty print the description - 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 dae9e4abfe7af0c07b25bd6c60cebf6208755a19
(DIR) parent d7d0a2fd899095ce246b62e82f68b61d39d107a9
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Wed, 2 Jan 2019 11:58:13
Use par to pretty print the description
Diffstat:
ilmanifesto/edition.dcgi | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff -r d7d0a2fd8990 -r dae9e4abfe7a ilmanifesto/edition.dcgi
--- a/ilmanifesto/edition.dcgi Wed Jan 02 01:45:41 2019 +0100
+++ b/ilmanifesto/edition.dcgi Wed Jan 02 11:58:13 2019 +0100
@@ -20,6 +20,15 @@
return s
}
+function print_description(text)
+{
+ cmd = "par -d 0 -B=. -w 72"
+ cmd = cmd " | sed -e \"s/^/t/\""
+
+ print text | cmd
+ close(cmd)
+}
+
/<article class="edition-toc__item"/ {
# Extract all article information to generate the menu
n = split($0, a, /<\/article>/)
@@ -47,7 +56,7 @@
}
printf("[0|%s|%s?%s|server|port]\n", entry, cgi, href)
if (description) {
- printf("t%s\n", description)
+ print_description(description)
}
printf("\n")
}