diff --git a/lib/modules/Tools.pmod/AutoDoc.pmod/BMMLParser.pike b/lib/modules/Tools.pmod/AutoDoc.pmod/BMMLParser.pike index c9f8c59b610000e2acef312657273240b36341dc..b442d65cb4fa6d2f4e35252ffef1dd1cfb051086 100644 --- a/lib/modules/Tools.pmod/AutoDoc.pmod/BMMLParser.pike +++ b/lib/modules/Tools.pmod/AutoDoc.pmod/BMMLParser.pike @@ -371,7 +371,10 @@ string convert_page(string path, string fname, cont = cont||read_bytes(path); // perror("foo: "+path[strlen(path)-5..]+".\n"); - if(sscanf(cont,"NAME\n\t%s - %s\n",name,short)) + if(sscanf(cont,"NAME\n\t%s - %s\n",name,short) || + // Both of the following are broken syntax. + sscanf(cont,"NAME\t\n\t%s - %s\n",name,short) || + sscanf(cont,"NAME\n %*[\t ]%s - %s\n",name,short)) { cont=html_quote(cont); @@ -418,11 +421,13 @@ string convert_page(string path, string fname, /* Merge sections that do not have a header together */ for(section=0;section<sizeof(sections);section++) { + string section_header = ""; if (has_prefix(sections[section], "\n")) sections[section] = sections[section][1..]; - if(!strlen(sections[section]) || - sections[section][0] < 'A' || - sections[section][0] > 'Z') + sscanf(sections[section], "%s\n", section_header); + if(!strlen(String.trim_all_whites(section_header)) || + upper_case(section_header) != section_header || + lower_case(section_header) == section_header) { sections[section-1]+="\n\n"+sections[section]; sections=sections[0..section-1]+sections[section+1..0x7fffffff]; @@ -441,8 +446,10 @@ string convert_page(string path, string fname, switch(type) { + case "NAME\t": case "NAME": - if(sscanf(rest,"\t%s - %s",part_name,b)!=2) + if((sscanf(rest, "\t%s - %s", part_name, b)!=2) && + (sscanf(rest," %*[\t ]%s - %s", part_name, b) != 3)) perror("Warning NAME section broken!\n"); section_path = module_path + part_name/"."; @@ -457,14 +464,26 @@ string convert_page(string path, string fname, case "RETURN VALUES": case "DESCRIPTION": case "DESCRIPITON": // Common typo. + case "COPYRIGHT": case "NOTA BENE": + case "WARNING": + case "THANKS": case "BUGS": rest=magic(rest, 0); break; + case "NOTES": + case "NOTES, TODOs AND OTHER THINGS": + type = "NOTES"; + rest=magic(rest, 0); + break; + case "AUTHOR": + rest=magic("Author\n\n" + rest, 0); + break; default: - perror("Warning: Unknown header on page "+path+": "+type+".\n"); - rest=magic(rest,0); + werror("Warning: Unknown section header on page %O: %O\n", + path, type); + rest=magic(type + "\n\n" + rest,0); break; case "KEYWORD": @@ -490,6 +509,7 @@ string convert_page(string path, string fname, case "SYNTAX": case "SYNTAX EXAMPLE": case "SYNAX": // Common typo. + case "STRING": // Common typo. if(search(rest,name+"(")!=-1) efuns[name]=1; rest=syntax_magic(rest); break; @@ -515,10 +535,13 @@ string convert_page(string path, string fname, "RETURN VALUE":"<returns/>", "RETURN VALUES":"<returns/>", "NOTA BENE":"<note/>", + "WARNING":"<note/>", "BUGS":"<bugs/>", "SEE ALSO":"<seealso/>", "EXAMPLE":"<example/>", "EXAMPLES":"<example/>", + "THANKS":"<thanks/>", + "COPYRIGHT":"<copyright/>", ])[type]; if (type) { diff --git a/lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod b/lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod index fb10ebf415416822cf7fd76bcb031b23c959d946..f8cf7fbfe534ce4ffb940a9293c54af01db85fbd 100644 --- a/lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod +++ b/lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod @@ -80,12 +80,14 @@ mapping(string : DocTokenType) keywordtype = "deprecated" : SINGLEKEYWORD, "bugs" : DELIMITERKEYWORD, + "copyright" : DELIMITERKEYWORD, "example" : DELIMITERKEYWORD, "fixme" : DELIMITERKEYWORD, "note" : DELIMITERKEYWORD, "param" : DELIMITERKEYWORD, "returns" : DELIMITERKEYWORD, "seealso" : DELIMITERKEYWORD, + "thanks" : DELIMITERKEYWORD, "throws" : DELIMITERKEYWORD, "code" : CONTAINERKEYWORD, @@ -126,7 +128,8 @@ mapping(string:array(string)) required_attributes = ]); protected constant standard = (< - "note", "bugs", "example", "seealso", "deprecated", "fixme", "code" + "note", "bugs", "example", "seealso", "deprecated", "fixme", "code", + "copyright", "thanks", >); mapping(string : multiset(string)) allowedChildren = diff --git a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike index 8b8cd804a0e3ccd1097a5501219d9839f449cd4b..544ccc3f89c07fdf2c516be0308ea0133d4cdd99 100644 --- a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike +++ b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike @@ -764,8 +764,10 @@ string parse_doc(Node n, void|int no_text) { break; case "bugs": + case "copyright": case "note": case "returns": + case "thanks": case "throws": ret += lay->dochead + String.capitalize(name) + lay->_dochead; if (c = c->get_first_element("text")) { diff --git a/refdoc/keywords.txt b/refdoc/keywords.txt index 8baf4442bd4c04bc4540514d3e2a6bab01843bb2..abc812269b690029ccb41c296718f392f64967a4 100644 --- a/refdoc/keywords.txt +++ b/refdoc/keywords.txt @@ -221,6 +221,17 @@ Examples: XML: <bugs/> _______________________________________________________________________________ +Keyword: @copyright +Description: Inform about implementor(s) and/or license. +Arguments: - +Children: Text (with markup). +Groups with: - +Examples: //! @copyright + //! Licenced under single-clause BSD. + +XML: <copyright/> +_______________________________________________________________________________ + Keyword: @deprecated Description: Documents the fact that the entity is deprecated by one or several other classes/modules/methods/variables. @@ -326,6 +337,19 @@ Examples: //! @seealso XML: <seealso/> _______________________________________________________________________________ +Keyword: @thanks +Description: Inform about people and/or organisations that have helped + with the implementation. +Arguments: - +Children: Text (with markup). +Groups with: - +Examples: //! @thanks + //! Thanks to Lysator Academic Computer Society for + //! providing computer resources for testing this. + +XML: <thanks/> +_______________________________________________________________________________ + Keyword: @throws Description: Describes the conditions for an exception to be thrown from the function.