home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / share / elvis-2.2_0 / scripts / info.ex < prev    next >
Encoding:
Text File  |  2004-02-22  |  1.2 KB  |  45 lines

  1. " This file tries to implement an "info:" protocol, for viewing info pages
  2. " inside elvis.  It doesn't quite succeed, but it comes close.
  3. " This assumes your info pages are stored in /usr/share/info.  If they're
  4. " stored someplace else, then you'll need to edit the "local d=..." line below.
  5.  
  6. alias readINFO {
  7.   local d=/usr/share/info
  8.   local report=0
  9.   local magic magicchar=^$.[* noignorecase
  10.   local m
  11.   let m=display
  12.   display normal
  13.   if "!(/)2" == "/"
  14.   then {
  15.     eval r !!cd (d); ls *.info.gz
  16.     try {
  17.       %s/\(.*\)\.info\.gz/<a href="info:\1">\1<\/a>/
  18.       se bufdisplay=html noinitialsyntax
  19.     }
  20.     se nomod
  21.   }
  22.   else {
  23.     eval r !!gzip -d -c (d)/!2.info.gz (d)/!2.info-*.gz
  24.     try {
  25.       1,/^File: .* Node: !(Top)3,/-1 d
  26.       try %s/&/\&/g
  27.       try %s/</\</g
  28.       try %s/>/\>/g
  29.       %s/^$/<hr>/
  30.       %s/^\(File: .* Node: \)\([^:,]*\)/+2s,.*,<a name="\2">\&<\/a>,/x
  31.       g/^File: /s/\(Prev\|Next\|Up\): \([^:,]*\)/\1: <a href="#\2">\2<\/a>/g
  32.       try %s/<a href="#(dir)">/<a href="info:">/g
  33.       %s/^\* \(.*\)::/* <a href="info:!2#\1">\1<\/a>::/
  34.       1i <pre>
  35.       $a </pre>
  36.       se bufdisplay=html noinitialsyntax
  37.     }
  38.     se nomod
  39.   }
  40.   eval display (m)
  41. }
  42.  
  43. alias info sp info:!1
  44.