Skip to content
Snippets Groups Projects
Select Git revision
21 results Searching

manpages

Blame
  • manpages 6.12 KiB
    // -*- Pike -*-
    // $Id: manpages,v 1.20 1999/04/17 15:55:36 grubba Exp $
    
    #include "types.h"
    
    #if __VERSION__ >= 0.6
    import ".";
    #endif /* __VERSION__ >= 0.6 */
    
    inherit Stdio.File : out;
    
    int verbose = 0;
    
    string globalbase;
    object windex;
    object whatis;
    
    // Conversion table:
    //
    // "*"		"\\(**"
    // "\\"		"\\e"
    // "()"		"(\\|)"
    // " - "	" \\- "
    // "..."	"\&.\|.\|."
    
    string quote_text(string s)
    {
      s=replace(s,({">","&","<"}),
    	    ({">","&","<"}));
      return(replace(s, ({ "*", "\\", "()", " - ", "..." }),
    		 ({ "\\(**", "\\e", "(\\|)", " \\- ", "\&.\|.\|." })));
    }
    
    // Some versions of nroff don't like 8-bit chars at all.
    string strip_eightbit(string s)
    {
      return(s & String.strmult("\177", sizeof(s)));
    }
    
    string strip_empty_lines(string s)
    {
      return(Array.filter(s/"\n", lambda(string line) {
    				return(replace(line,
    					       ({ "\t", " " }),
    					       ({ "", "" })) != "");
    			      })*"\n");
    }
    
    void make_page(string base, TAG tag, string ind, string fbase);
    
    void mkdirhier(string what)
    {
       string d=".";
       foreach (what/"/",string add)
       {
          d+="/"+add;
          mkdir(d);
       }
    }
    
    int stripws=1;
    
    string make_manpage(string base, SGML data, string ind, string fbase)
    {
      string res="";
    
      if (verbose) {
        werror(sprintf("data:%O\n", data));
      }