pike.git / lib / modules / Tools.pmod / Standalone.pmod / autodoc_to_html.pike

version» Context lines:

pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:88:   string render_tag(string tag, mapping(string:string) attrs, int|void term)   {    string res = "<" + tag;    foreach(sort(indices(attrs)), string attr) {    res += " " + attr + "='" + attrs[attr] + "'";    }    if (term) res += " /";    return res + ">";   }    - Node get_first_element(Node n) { + Node get_first_element(Node n) + { +  if (!n) return UNDEFINED;    foreach(n->get_children(), Node c)    if(c->get_node_type()==XML_ELEMENT) {    if(c->get_any_name()!="source-position")    return c;    else    position->update(c);    } -  error( "Node had no element child.\n" ); +  return UNDEFINED;   }      int section, subsection;      string low_parse_chapter(Node n, int chapter) {    string ret = "";    Node dummy = Node(XML_ELEMENT, "dummy", ([]), "");    foreach(n->get_elements(), Node c)    switch(c->get_any_name()) {   
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:224:    }       ret += low_parse_chapter(n, (int)n->get_attributes()->number);       if(!noheader)    ret = ret + "</dd></dl>";       return ret;   }    + string parse_appendix(Node n, void|int noheader) { +  string ret =""; +  if(!noheader) +  ret += "<dl><dt>" +  "<table width='100%' cellpadding='3' cellspacing='0' border='0'><tr>" +  "<td bgcolor='#EEEEEE'><font size='+3'>&nbsp; Appendix " + +  (string)({ 64+(int)n->get_attributes()->number }) + ". " + +  n->get_attributes()->name + "</font></td></tr></table><br />\n" +  "</dt><dd>"; +  +  Node c = n->get_first_element("doc"); +  if(c) +  ret += parse_text(c); +  else +  error( "No doc element in appendix.\n" ); +  + #ifdef DEBUG +  if(sizeof(n->get_elements("doc"))>1) +  error( "More than one doc element in appendix node.\n" ); + #endif +  +  if(!noheader) +  ret = ret + "</dd></dl>"; +  +  return ret; + } +    string parse_autodoc(Node n)   {    string ret ="";       mapping m = n->get_attributes();       Node c = n->get_first_element("doc");    if(c)    ret += "<dl>" + parse_doc(c) + "</dl>";   
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:729:    ret += lay->dochead + "Description" + lay->_dochead +    lay->docbody + parse_text(c) + lay->_docbody;       foreach(n->get_elements("group"), Node c) {    Node header = c->get_first_element();    string name = header->get_any_name();    switch(name) {    case "param":    foreach(c->get_elements("param"), Node d)    ret += lay->dochead + "Parameter " + lay->parameter + -  quote(d->get_attributes()->name) + lay->_parameter + lay->_dochead + +  quote(d->get_attributes()->name || "") + +  lay->_parameter + lay->_dochead +    "<dd></dd>";    if (c = c->get_first_element("text")) {    ret += lay->docbody + parse_text(c) + lay->_docbody;    }    break;       case "seealso":    ret += lay->dochead + "See also" + lay->_dochead;    if (c = c->get_first_element("text")) {    ret += lay->docbody + parse_text(c) + lay->_docbody;
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:1025:    {    // Hide the class path for methods.    attrs->class_path = "";    }    return;    case "constant":    case "inherit":    case "import":    case "typedef":    case "variable": +  case "directive":    // These don't have children.    attrs->class_path = path;    return;    }    foreach(n->get_children(), Node child)    {    resolve_class_paths(child, path, n);    }   }   
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:1098: Inside #if 0 and #if defined(DEBUG)
  #ifdef DEBUG    error( "Parent module is " + n->get_parent()->get_any_name() + ".\n" );   #else    return "";   #endif   }   #endif /* 0 */      string parse_not_doc(Node n) {    string ret = ""; -  int method, argument, variable, const, typedf; +  int method, argument, variable, const, typedf, cppdir;    -  +  if (!n) return ""; +     foreach(n->get_children(), Node c) {       if(c->get_node_type()!=XML_ELEMENT)    continue;       Node cc;    switch(c->get_any_name()) {       case "doc":    continue;       case "source-position":    position->update(c);    continue;       case "method":    if(method++) ret += "<br />\n"; - #ifdef DEBUG + #if 0    if(!c->get_first_element("returntype")) -  continue; -  // error( "No returntype element in method element.\n" ); +  error( "No returntype element in method element.\n" );   #endif    switch( c->get_attributes()->name )    {    case "create":    ret += "<tt>" + parse_type(get_first_element(c->get_first_element("returntype"))); // Check for more children    ret += " ";    ret += c->get_attributes()->class_path+"<b>(</b>";    ret += parse_not_doc( c->get_first_element("arguments") );    ret += "<b>)</b></tt>";    break;
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:1223:    ret += "<font face='courier'> : " + "<font color='#F000F0'>" +    Parser.encode_html_entities(c->get_attributes()->name) +    "</font></font>";    }    break;       // We don't need import information.    case "import":    break;    +  case "directive": +  if(cppdir++) ret += "<br />\n"; +  ret += "<tt><font color='#006666'>" + quote(c->get_attributes()->name) + +  "</font></tt>"; +  break; +     default:    error( "Illegal element " + c->get_any_name() + " in !doc.\n" );    break;    }    }       return ret;   }      int foo;
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:1256:    quote((m->belongs?m->belongs+" ":"") + m["homogen-name"]) +    "</b></font>\n";    } else {    array(string) names =    Array.uniq(map(n->get_elements(m["homogen-type"]),    lambda(Node child) {    return child->get_attributes()->name ||    child->value_of_node();    }));    foreach(names, string name) -  ret += type + "<font size='+1'><b>" + name + "</b></font><br />\n"; +  ret += type + +  "<font size='+1'><b>" + quote(name) + "</b></font><br />\n";    }    }    else    ret += "Syntax";    ret += lay->_typehead;    }       ret += lay->ndochead;       ret += parse_not_doc(n);
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:1335:    {    cwd=getcwd();    cd(dest_path);    }    Stdio.write_file( c->get_attributes()->name,    frame_html(layout_toploop(c)) );    if(cwd)    cd(cwd);    break;    +  case "appendix": +  if (!(flags & Tools.AutoDoc.FLAG_COMPAT)) { +  error("Appendices are only supported in compat mode.\n"); +  } +  res += parse_appendix(c); +  break; +     case "chapter":    res += parse_chapter(c);    break;       default:    error("Unknown element %O.\n", c->get_any_name());    }    return res;   }   
pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:1397:    if (verbosity >= Tools.AutoDoc.FLAG_VERBOSE) {    werror("Resolving class paths...\n");    }    resolve_class_paths(n);       mapping m = n->get_attributes();       if (verbosity >= Tools.AutoDoc.FLAG_VERBOSE) {    werror("Layouting...\n");    } -  manual_title = m->title || (m->version?"Reference Manual for "+m->version:"Pike Reference Manual"); +  if (flags & Tools.AutoDoc.FLAG_NO_DYNAMIC) { +  manual_title = m->title || "Pike Reference Manual"; +  } else { +  manual_title = m->title || +  (m->version?"Reference Manual for "+m->version:"Pike Reference Manual"); +  }    layout_toploop(n, exporter);       if (verbosity >= Tools.AutoDoc.FLAG_VERBOSE) {    werror("Took %d seconds.\n\n", time()-t);    }       return 0;   }      int main(int num, array args) {