#!/usr/bin/install-menu
# I need menu-1!
# $Id: dwww.menu-method,v 1.11 2006-05-07 18:30:09 robert Exp $
#
# Dwww compatibility menu-method to create
# in /var/lib/dwww/menu-method directory docbase-like
# files structure
#
# NOTE: the first line of this script _must_ be
# equal to "#!/usr/bin/install-menu", otherwise update-menus
# will feed this script old-compat-mode data.
#
# More info: /usr/share/doc/menu/html.
#
compat="menu-1"

!include menu.h

compat="menu-2"


function header()=
              "Dwww-Section: " $section "\n"
              ifelse($longtitle
                    ,
                      "Title: " $longtitle "\n"
                      "Dwww-Title: " $title "\n"
                    ,
                      "Title: " $title "\n"
                    )
              "Abstract: " $description "\n"
              "\n";

supported;
  dwww =      header()
              "Format: HTML\n"
              "Index: "$command "\n"
              "Files: "$command "\n";

  url =       header()
              "Format: Dwww-URL\n"
              "Index: "$command "\n"
              "Files: "$command "\n";

endsupported;

preoutput=      "";
startmenu=      "";
endmenu=        "";
mainmenutitle=  "";
submenutitle=   "";
rootsection=    "";
outputlanguage= "C";

prerun=         "find " prefix() " -type f -exec rm -f {} \\;";
postrun=        "/usr/sbin/dwww-build-menu";
genmenu=        ifelse($command, replacewith(cppesc($title), "$", "-"),  "/");
removemenu=     "find " prefix() " -type f -exec rm -f {} \\;";

rootprefix=     "/var/lib/dwww/menu-method/";
onlyrunasroot=  true;
treewalk=       "(mc)";
