Auto-doc framework now handles multiple script authors more conveniently.

This commit is contained in:
Jon Siwek 2011-03-21 14:03:11 -05:00
parent 5fbcde7344
commit e0a77cb794
3 changed files with 7 additions and 8 deletions

View file

@ -85,7 +85,8 @@ void BroDoc::WriteDocFile() const
WriteSectionHeading("Summary", '-'); WriteSectionHeading("Summary", '-');
WriteStringList("%s\n", "%s\n\n", summary); WriteStringList("%s\n", "%s\n\n", summary);
WriteToDoc(":Author: %s\n", author_name.c_str()); WriteToDoc(":Author(s): ");
WriteStringList("%s, ", "%s\n", authors);
WriteToDoc(":Namespaces: "); WriteToDoc(":Namespaces: ");
WriteStringList("`%s`, ", "`%s`\n", modules); WriteStringList("`%s`, ", "`%s`\n", modules);

View file

@ -83,12 +83,11 @@ public:
void AddPortAnalysis(const std::string& analyzer, const std::string& ports); void AddPortAnalysis(const std::string& analyzer, const std::string& ports);
/** /**
* Sets the author of the script. * Adds a script author.
* The scanner should call this when it sees "## Author: ..." * The scanner should call this when it sees "## Author: ..."
* @param s The name, email, etc. of the script author(s). Must be * @param s The name, email, etc. of the script author.
* all on one line.
*/ */
void SetAuthor(const std::string& s) { author_name = s; } void AddAuthor(const std::string& s) { authors.push_back(s); }
/** /**
* Schedules documentation of a script option. An option is * Schedules documentation of a script option. An option is
@ -166,10 +165,9 @@ protected:
FILE* reST_file; FILE* reST_file;
std::string reST_filename; std::string reST_filename;
std::string source_filename; std::string source_filename;
std::string author_name;
std::string packet_filter; std::string packet_filter;
std::list<std::string> ls; std::list<std::string> authors;
std::list<std::string> modules; std::list<std::string> modules;
std::list<std::string> summary; std::list<std::string> summary;
std::list<std::string> imports; std::list<std::string> imports;

View file

@ -137,7 +137,7 @@ ESCSEQ (\\([^\n]|[0-7]+|x[[:xdigit:]]+))
##{OWS}Author:.* { ##{OWS}Author:.* {
if ( generate_documentation ) if ( generate_documentation )
current_reST_doc->SetAuthor( current_reST_doc->AddAuthor(
skip_whitespace( // Skip whitespace after "Author:" skip_whitespace( // Skip whitespace after "Author:"
skip_whitespace(yytext + 2) // Skip whitespace after ## skip_whitespace(yytext + 2) // Skip whitespace after ##
+ 7) // Skip "Author:" + 7) // Skip "Author:"