1 # ===================================================================== 2 # genCatlist.awk: W-TW group category list applet. 3 # 4 # Copyright (c) 2007,2009 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 BEGIN { 22 23 fmt = tmp = ""; i = 0; delete a 24 25 # build links to recent pages. 26 27 # Set output format string. 28 29 fmt = readfmt("tw-group-catlist") 30 gsub(/%/,"%%",fmt) # turn plain '%' into '%%'. 31 gsub(/\\/,"\\\\&",fmt) # turn '\' into '\\'. 32 gsub(/[\n\r]+/,"",fmt) # just in case. 33 34 # this format string is currently not customizable. 35 if (!sub(//,"%s",fmt)) fmt = fmt "" 36 if (!sub(//,"%s",fmt)) fmt = fmt "" 37 38 # encode any extra markers. 39 gsub(//,"\\<tw:s/\\>",fmt) 40 41 fmt = fmt "\n" 42 43 g_uri = _rcget("tbl_group.g_uri") 44 45 tmp = "" # needed again later. 46 47 print "" # documentation. 48 } 49 50 /^\001/ { next } # skip table header, if any. 51 52 { 53 # k_page, p_name, p_descr 54 55 split($0,a,"\t") 56 57 # Pages with nil descriptions are excluded from this view. 58 # (already done by the invoking program). 59 #if (a[3] ~ /^ *-/) next 60 61 printf(fmt,ENVIRON["CSA_RPC_URI"] \ 62 "/" ENVIRON["CSA_LANG"] "/" g_uri \ 63 "/tw-" a[1] "-recent-pages",_xmlencode(a[2])) 64 } 65 66 # EOF