# GAWK script for the creation of HTX pages #### Rajout en commentaire HTML du champ %W ### NEED /usr/local/glu/glu.dic to get the Editor Logos function compress(s){ # Remove all useless blanks gsub(/ +/," ",s); # Multiple blanks squeezed sub(/^ /,"",s); sub(/ $/,"",s); # Initial/Terminal blanks return(s) } # Definitions: Read All Titles (ft) and All Counts (fc) BEGIN { while((getline < ft) > 0){ split($0, w, "="); titre[compress(w[1])] = compress(w[2]); } #while((getline < fc ) > 0) c[$2] = $1 ; fe = "/dev/stderr" ; fu = "U.htx" ; Mark = "#Ala" ; open_file(fu, "U", "Usual Names") ; #### Get the various logos #fglu = "aclient vizier 1649 cat /usr/local/glu/glu.dic" fglu = "cat /home/cds/glu/glu.dic" nglu = 0 while ((fglu|getline ) > 0) { if (substr($0,1,3) != "%A ") continue ; #print $0 " (" substr($0,length($0)-4, 5) ")" > "/tmp/logos.A" if (substr($0,length($0)-4, 5) != ".logo") continue ; s = substr($0, 4) ; i = index(s, ".") ; logo["J." substr(s,1,i-1)] = s ; nglu++ } close(fglu) if (nglu==0) print "****Error getting logos via:\n " fglu \ > "/dev/stderr"; } function close_file(fout, ncats) { printf("\\hr\n%s\\par\\exec\n%s\\tag{/FORM}\n", Mark, Mark) > fout ; printf("\\hr\n\\CDStail{The Catalogue of Catalogues (%s)}\n", pccat) > fout; if (pccat != "META") printf(" \\quad (%d catalogues)\n", ncats) ; printf("====End of file: %s (%d catalogues)\n", fout, ncats) > fe ; } function open_file(fout, category, title) { printf("\\cgidef{-tex -oglu --ic %s%s%s%s\n}\n", \ "\n#\\box #1{\\tag{INPUT TYPE=\"checkbox\" NAME=\"w2c\" VALUE=\"#1\"}}"\ "\n#\\bxx #1{\\quad{\\times} }" \ "\n\\action {\\env{action}}" \ "\n\\submit {\\tag{INPUT TYPE=\"submit\" VALUE=\"SEND to ALADIN\"}}" \ "\n\\reset {\\tag{INPUT TYPE=\"reset\" VALUE=\" RESET \"}}" \ "\n\\exec {\\centerline{{\\bf\\submit} \\quad or \\quad\\reset}}" \ "\n\\box #1{}\n\\bxx #1{}\n\\Ala {}", \ "\n\\Cat #2{(\\gludata{E #2|#1})}" \ "\n\\CatV #2{{\\bf(\\A{/viz-bin/VizieR?-meta.foot&-source=#2}{#1})}}", \ "\n\\pCat #2{\\bxx{#2}\\Cat{#1}{#2}}", \ "\n\\vCat #2{\\bxx{#2}\\CatV{#1}{#2}}" \ "\n\\aCat #2{\\bxx{#2}\\Cat{#1}{#2}}" \ "\n\\WCat #3{\\box{#2}\\html{}\\CatV{#1}{#2}}" \ "\n\\wCat #3{\\box{#2}\\html{}\\Cat{#1}{#2}}" \ ) > fout ; printf("\\title{CDS catalogues %s}\n", category) > fout ; ### Choose the Logo if (category in logo) theLogo = logo[category] ; else theLogo = "VizieR.logo" ; if (substr(category,1,1) == "J") printf(\ "\\CDShead{Electronic tables from\\br %s \\Ala}{%s}\n", title, theLogo)\ > fout ; #"\\begin{html}<&CDS.headStuff2><&CDS.headArea2 \"Electronic tables from\\br %s \\Ala\" \"vizier\">\\end{html}\n", title) \ else printf(\ "\\CDShead{CDS Catalogues. %s \\Ala}{%s}\n", title, theLogo) > fout #"\\begin{html}<&CDS.headStuff2><&CDS.headArea2 \"CDS Catalogues. %s \\Ala\" \"vizier\">\\end{html}\n", title) > fout ; #printf("{\\tt Category: %s -- theLogo=%s}\n", category, theLogo) > fout #for (k in logo) print "logo=" k > fout printf("\\par{\\small\\em %s}\n", \ "Click on a catalogue name or number to move to the corresponding " \ "VizieR page, or to a summary description" \ " when the catalogue is not available through VizieR." \ ) > fout ; print "\\par\\hr" > fout ; printf("%s\\tag{FORM METHOD=\"GET\" ACTION=\"\\action\"}\n%s\\exec\\hr\n", \ Mark, Mark)\ > fout; } function start_cats(date) { ### Beginning of file printf("\\cgidef{-tex -oglu --ic %s\n}\n", \ "" \ ) ; print "\\title{CDS: The Catalogue of Catalogues}"; #print "\\CDShead{Catalogues and files available at CDS}{VizieR.logo}" print "\\CDShead{}{VizieR.logo}" #print "\\begin{html}<&CDS.headStuff2><&CDS.headArea2 \"Catalogues and files available at CDS\" \"vizier\">\\end{html}"; print "\\par\\begin{center}\\fg{DarkGreen}" ; print "{\\LARGE Catalogues and files available at CDS}" printf("\\break\n\\em Version of %s\n", date) ; print "\\end{center}\\par\\hr\\par" ; print "\\begin{MENU}" ; started += 1 ; } ### Start of a Catalogue (change file if necessary) function start_file(I) { #print "....start_file(" I ")" nccat = split(I, accat, "/") ; if (accat[1] == "J") { cccat = "J." accat[2] ; cvol = accat[3] } else { cccat = accat[1] ; cvol = "" } if (cccat == pccat) { # Same catalogue catagory. #if (cvol != pvol) print("\\hr") > fout ; pvol = cvol ; return ; } #### Open a new file if (fout != "") close_file(fout, occat) ; pccat = cccat ; fout = cccat ".htx" ; open_file(fout, cccat, titre[cccat]) ; pvol = cvol ; occat = 0 ; # Counter of number of catalogues # Don't edit the META catalogues. if (pccat == "META") return; #### Insert the Mennu printf("\\item ") ; if (substr(cccat,1,1) == "J") printf("Tables from {\\em ") if (titre[cccat] == "") titre[cccat] = cccat ; printf("\\A{%s.htx}{%s}", cccat, titre[cccat]) ; if (substr(cccat,1,1) == "J") printf("}") ; } #### Print a catalog as \wCat{text}{anchor}{server} or \Cat{text}{anchor}... function print_cat(fout, text, more) { i = index(I, "="); printf("\\%sCat{%s}{%s}", Y,text,substr(I,i+1)) > fout ; if (W != "") printf("{%s}", W) > fout; printf("\\quad ") > fout ; if (t == "") printf("%s (%s)", T, compress(A)) > fout else printf("%s", t) > fout ; printf("%s\\\\\n", more) > fout ; } # End of paragraph: Write out Catalogue Designation, and short title /^%% / { if (started == 0) start_cats($2) } /^ *$/ { if (I == "") next start_file(I) ; occat += 1 ; more = "" ; if (O != "") fg = "\\fg{gray40}"; if (U != "") more = "{\\quad\\bf" fg "(" substr(U,2) ")}" ; if (Y == "") Y = "p" ; if (W != "") { if (Y == "v") Y = "W" ; else Y = "w" ; } if (O != "") { if (t != "") t = "{" fg t "}"; if (T != "") T = "{" fg T "}"; more = more "\\quad{\\bf\\fg{DarkOrange}(obsolete)}" } #####, see <%E " O ")}" print_cat(fout, I, more) ; if (U != "") { nU = split(U, aU, ",") ; for (kU=2; kU<=nU; kU++) { more = "{\\quad\\bf" fg "(" I ")}" ; print_cat(fu, aU[kU], more) oU++ } } Y = "" ; O = "" ; fg = ""; T = "" ; t = "" ; I = ""; A = ""; W = "" ; Y = "" ; U = "" ; } # Recognize the interesting fields #/^%D / { print $0} /^%D[= ]*[Oo][Bb][Ss][Oo][Ll][Ee]/ { O = $NF } /^%. =/ { next } # (headers with definitions) /^%t / { t = substr($0,4) } /^%T / { T = substr($0,4) } /^%A / { A = substr($0,4) } /^%I J/ { nj = split($2, J, "/"); vol = J[3] + 0;} /^%I / { len = length($2); if (substr($2,len,1)=="/") len -= 1; I = substr($2,1,len) ; if(index(I,"=")>0) { # Status: see the equivalent catalog split(I,Jeq,"="); Y=catY[Jeq[2]] #print "%% J.*=, Jeq[2]=" Jeq[2] "==>Y:", Y ; } } /^%Y / { if (index($2, "v") != 0) Y = "v"; else if (index($2,"f") != 0) Y = "a" ; # Save the status of non-J catalogues if (substr(I, 1, 1) != "J") catY[I] = Y ; } /^%W / { W = $2 } /^%U / { U = U "," $2 } # END { close_file(fout, occat); printf("\\par\\item Catalogues ordered by their {\\em\\A{%s.htx}{%s}}\n", "U", "Usual Name") ; close_file(fu, oU) ; printf("\\par\\item Catalogues with {\\em\\A{%s.htx}{%s}}\n", "M", "Additional Material") ; print "\\end{MENU}" print "\\CDStail{The Catalogue of Catalogues (\\basename{\\thefile})}" #print "\\begin{html}<&CDS.tailArea2 \"The Catalogue of Catalogues\" \" \" \"vizier\">\\end{html}" }