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 / info2.ex < prev    next >
Encoding:
Text File  |  2004-02-22  |  1.3 KB  |  41 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.   if "!(/)2" == "/"
  12.   then {
  13.     r (d/"dir")
  14.     try %s/&/\&/g
  15.     try %s/</\</g
  16.     try %s/>/\>/g
  17.     try %s/^\* \([^:]*\): (\([^)]*\))\(.*\)\.$/* <a href="info:\2#\3">\1<\/a>: (\2)\3/
  18.     try %s/^\* \([^:]*\): (\([^)]*\))\(.*\)/* <a href="info:\2#\3">\1<\/a>: (\2)\3/
  19.   }
  20.   else {
  21.     if exists(d/"!2.info")
  22.     then r !!cat (d)/!2.info (d)/!2.info-* 2>/dev/null
  23.     eval r !!gzip -d -c (d)/!2.info*.gz (d)/!2.info-*.gz 2>/dev/null
  24.     try 1,/^File: .* Node: !(Top)3,/-1 d
  25.     try %s/&/\&/g
  26.     try %s/</\</g
  27.     try %s/>/\>/g
  28.   }
  29.   try %s/^$/<hr>/
  30.   try %s/^\(File: .* Node: \)\([^:,]*\)/+2s,.*,<a name="\2">\&<\/a>,/x
  31.   try g/^File: /s/\(Prev\|Next\|Up\): \([^:,]*\)/\1: <a href="#\2">\2<\/a>/g
  32.   try %s/<a href="#(dir)">/<a href="info:">/g
  33.   try %s/^\* \(.*\)::/* <a href="info:!2#\1">\1<\/a>::/
  34.   1i <pre>
  35.   $a </pre>
  36.   se bufdisplay=html noinitialsyntax nomod
  37. }
  38.  
  39. alias info sp info:!1
  40.