Folks,

Doubtless some of you have access CGI man -> HTML converters.  The
FreeBSD project has one at http://www.freebsd.org/cgi/man.cgi.

Norm's stylesheets map markup like

    <citerefentry><refentrytitle>ls</><manvolnum>1</></>

to 

    ls(1)

in the output.  I've just knocked up the following two functions in a
customisation for Norm's stylesheets which turn these in to links to the
man -> HTML gateway, and I thought they might be useful.

        ;; Given the name of the manual page, and it's section number,
        ;; return a string giving the URL to the man -> HTML converter.
        ;;
        ;; Modify this as necessary for your gateway.
        (define ($mancgi-href$ refentrytitle manvolnum)
          (string-append "http://www.freebsd.org/cgi/man.cgi?"
                          refentrytitle
                         "("
                          manvolnum
                         ")"))

        ;; Generate links to the man -> HTML converter for each man page
        ;; reference.
        ;;
        ;; You shouldn't need to modify this.
        (element citerefentry
          (let* ((refentrytitle (select-elements (children (current-node))
                                                 (normalize "refentrytitle")))
                 (manvolnum     (select-elements (children (current-node))
                                                 (normalize "manvolnum")))
                 (href          ($mancgi-href$   (data refentrytitle)
                                                 (data manvolnum))))
            (make element gi: "A"
                  attributes: (list (list "HREF" href))
              (process-children))))

N
-- 
Internet connection, $19.95 a month.  Computer, $799.95.  Modem, $149.95.
Telephone line, $24.95 a month.  Software, free.  USENET transmission,
hundreds if not thousands of dollars.  Thinking before posting, priceless.
Somethings in life you can't buy.  For everything else, there's MasterCard.
  -- Graham Reed, in the Scary Devil Monastery

PGP signature

Reply via email to