sections.dcgi - 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
       ---
       sections.dcgi
       ---
            1 #!/bin/sh
            2 
            3 . ../common/config.sh
            4 
            5 ARTICLE_CGI="${CGI_BASEDIR}/internazionale/article.cgi"
            6 CGI="${CGI_BASEDIR}/internazionale/sections.dcgi"
            7 
            8 
            9 section="${2%%/*}"
           10 case "${section}" in
           11         ultimi-articoli | reportage | opinioni | savagelove )
           12                 ;;
           13         *)
           14                 exit 1
           15                 ;;
           16 esac
           17 
           18 if [ "${2}" != "${2##*/}" ]; then
           19         date="${2##*/}"
           20 else
           21         date="$(date +'%Y-%m-%d_%H-%M-%S')"
           22 fi
           23 
           24 echo ""
           25 echo "Internazionale"
           26 echo ""
           27 
           28 url="https://data.internazionale.it/stream_data/items/${section}/0/0/${date}.json"
           29 curl -Lgs -- "${url}" |
           30 jq -r '
           31 ( .items[] | (
           32 "[0|" +
           33     "\(.title | gsub("\\|"; "\\|") )" + "|" +
           34     "'"${ARTICLE_CGI}?"'" + "https://www.internazionale.it" +
           35         "\(.url | gsub("\\|"; "\\|") )" + "|" +
           36     "server|port]"
           37 )),
           38 "t",
           39 "[1|<< Older articles|'"${CGI}?${section}/"'\(.datetime | gsub(" "; "_"))|server|port]"
           40 '