Honor FEED_* variables to add extra fields - 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 b3f24cb61f011d7616eedef7789bd6594623e344
 (DIR) parent 29e522c339fc396924111bf6eb240f6c05318b37
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Fri,  7 Sep 2018 02:47:28 
       
       Honor FEED_* variables to add extra fields
       
       Diffstat:
        common/feed.sh |  21 +++++++++++++++++----
        1 files changed, 17 insertions(+), 4 deletions(-)
       ---
       diff -r 29e522c339fc -r b3f24cb61f01 common/feed.sh
       --- a/common/feed.sh    Fri Sep 07 02:26:24 2018 +0200
       +++ b/common/feed.sh    Fri Sep 07 02:47:28 2018 +0200
       @@ -8,7 +8,11 @@
        {
        
               /usr/pkg/bin/sfeed |
       -       awk -v cgi="${ARTICLE_CGI}" -F '\t' '
       +       awk -v feed_author="${FEED_AUTHOR}" \
       +           -v feed_date="${FEED_DATE}" \
       +           -v feed_content="${FEED_CONTENT}" \
       +           -v cgi="${ARTICLE_CGI}" \
       +           -F '\t' '
               {
                       timestamp = $1
                       title = $2
       @@ -18,14 +22,23 @@
                       id = $6
                       author = $7
        
       -               gsub("\\|", "\\|", title)
       +               desc = title
       +               if (feed_author && author) {
       +                       desc = desc ", " author
       +               }
       +               if (feed_date && timestamp) {
       +                       desc = sprintf("%s (%s)", desc,
       +                          strftime("%Y-%m-%d", timestamp))
       +               }
       +
       +               gsub("\\|", "\\|", desc)
                       gsub("\\|", "\\|", cgi)
                       gsub("\\|", "\\|", link)
        
                       if (cgi) {
       -                       printf("[0|%s|%s?%s|server|port]\n", title, cgi, link)
       +                       printf("[0|%s|%s?%s|server|port]\n", desc, cgi, link)
                       } else {
       -                       printf("[h|%s|URL:%s|server|port]\n", title, link)
       +                       printf("[h|%s|URL:%s|server|port]\n", desc, link)
                       }
               }
        '