;;; menus.mhtml: -*- Meta-HTML -*-  Macros make menus easier.
;;;
;;;  Copyright (c) 1996 Brian J. Fox
;;;  Author: Brian J. Fox (bfox@ai.mit.edu) Sat Feb 10 16:13:30 1996.

<defmacro menu whitespace=delete>
  <in-package menu>
    <set-var lines[]=<prog %body>>
    <set-var i[]=<symbol-info lines> i=0>
    <small-caps upper="+2" lower="+0" other="+2">
      <b>%0 %1 %2 %3 %4 %5 %6 %7</b>
    </small-caps>
    <br>
    <ul>
      <while <lt i i[1]>>
	<set-var
	    item=<get-var lines[i]>
	      link=<match <get-var item> ":.*$" action=extract>
	        item=<match <get-var item> ":.*$" action=delete>
		  link=<match <get-var link> "^:[ \t]*" action=delete>>
	<if <not <match <substring <get-var link> 0 4> "http">>
	        <if <not <match <substring <get-var link> 0 1> "/">>
		    <set-var link =
		        <get-var mhtml::relative-prefix>/<get-var link>>>>
	<li> <a href="<get-var link>"><b><get-var item></b></a>
	<p>
	<increment i>
      </while>
    </ul>
  </in-package>
</defmacro>
