1 # ===================================================================== 2 # gencal.rc: W-TW calendar generator applet front-end. 3 # 4 # Copyright (c) 2007,2008,2009,2010,2021 Carlo Strozzi 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; version 2 dated June, 1991. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, write to the Free Software 17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 # 19 # ===================================================================== 20 21 # ===================================================================== 22 # This program must be run after the group+cf has been read. 23 # ===================================================================== 24 25 ~ $'tbl_group.k_group' () && csaExit.fault 0041 tbl_group.k_group 26 ~ $tw_gstem () && csaExit.fault 0041 tw_gstem 27 ~ $TNS_LC_ALL $CSA_LANG^* || csaExit.fault 0041 TNS_LC_ALL 28 29 csaIsFullPath --exits --quiet $gencal_out || 30 csaExit.fault 0037 1 gencal_out 31 32 csaIsFullPath --exits --quiet $gencal_pages || 33 csaExit.fault 0037 1 gencal_pages 34 35 # Allow for 'YYYY-mm-dd HH:MM:SS' split on '-', even if we are 36 # only going to need 'YYYY' and 'mm' here. 37 38 ~ $#gencal_month 2 3 || 39 gencal_month = ($CSA_TIME_LOCAL(1) $CSA_TIME_LOCAL(2)) 40 41 csaMkTemp gencal_cal 42 43 LC_ALL=$TNS_LC_ALL { 44 { 45 if (~ $TNS_LC_ALL it*) { 46 cal -m $gencal_month(2) $gencal_month(1) 47 } else cal $gencal_month(2) $gencal_month(1) 48 } | tr -d -c '[:alnum:] \n' > $gencal_cal 49 } 50 51 gencal_month = $gencal_month(1)^-$gencal_month(2) 52 53 # This view will be sorted on 'vtime', regardless of any ranking. 54 csaAwkCmd genCalendar.awk 55 awktable -i $gencal_pages -- \ 56 'BEGIN{print "\001p_uri\t\001p_vtime\t\001p_descr"}{ 57 # Handle page expiration dates, accounting for older 58 # versions of page+dat which may lack that field. 59 if (p_etime/=1) { 60 # Set default expiration date. 61 if ($p_etime == "") $p_etime = "9999-12-31 23:59:59" 62 if ("'$CSA_TIME_ISO'" >= $p_etime && \ 63 $p_descr !~ /^ *-/) $p_descr = "-" $p_descr 64 } 65 66 # Handle explicit exclusions from static views first. 67 if ($p_descr ~ /^ *!/) next 68 69 # Exclude hidden/redirected pages. Redirections which are 70 # NOT to be excluded must be *immediately* preceeded by "+" . 71 sub(/\+\(:redirect /,"(:+redirect ",$p_descr) 72 if ($p_descr ~ /(^ *-|\(:redirect )/) next 73 sub(/\(:\+redirect /,"(:redirect ",$p_descr) 74 sub(/^.*,/,"",$p_vtime) 75 if($p_vtime ~ /'$gencal_month-'/) print $p_uri,$p_vtime,$p_descr 76 }' | 77 sorttable -r p_vtime | $CSA_RESULT > $gencal_out 78 79 csaStatus || csaExit.fault 0003 awktable/getcolumn/sorttable/awk 80 81 CSA_STATUS = 0 # always recommended. 82 83 # End of program.