From e0a77cb794ccc1f3f5565b3b1eebc00bfc5564aa Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Mon, 21 Mar 2011 14:03:11 -0500 Subject: [PATCH] Auto-doc framework now handles multiple script authors more conveniently. --- src/BroDoc.cc | 3 ++- src/BroDoc.h | 10 ++++------ src/scan.l | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/BroDoc.cc b/src/BroDoc.cc index b0ddfe72bd..80432570a4 100644 --- a/src/BroDoc.cc +++ b/src/BroDoc.cc @@ -85,7 +85,8 @@ void BroDoc::WriteDocFile() const WriteSectionHeading("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: "); WriteStringList("`%s`, ", "`%s`\n", modules); diff --git a/src/BroDoc.h b/src/BroDoc.h index 30b6fe4426..91d51f0dd5 100644 --- a/src/BroDoc.h +++ b/src/BroDoc.h @@ -83,12 +83,11 @@ public: 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: ..." - * @param s The name, email, etc. of the script author(s). Must be - * all on one line. + * @param s The name, email, etc. of the script author. */ - 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 @@ -166,10 +165,9 @@ protected: FILE* reST_file; std::string reST_filename; std::string source_filename; - std::string author_name; std::string packet_filter; - std::list ls; + std::list authors; std::list modules; std::list summary; std::list imports; diff --git a/src/scan.l b/src/scan.l index a032d31ea2..6a104d8776 100644 --- a/src/scan.l +++ b/src/scan.l @@ -137,7 +137,7 @@ ESCSEQ (\\([^\n]|[0-7]+|x[[:xdigit:]]+)) ##{OWS}Author:.* { if ( generate_documentation ) - current_reST_doc->SetAuthor( + current_reST_doc->AddAuthor( skip_whitespace( // Skip whitespace after "Author:" skip_whitespace(yytext + 2) // Skip whitespace after ## + 7) // Skip "Author:"