mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix auto-generated reST :doc: references to strip .bro file suffixes.
It's allowed for a script to "@load example.bro", but Sphinx doesn't want that file extension for the purposes of generating cross-referencing links to other documentation.
This commit is contained in:
parent
037a6906af
commit
8b79971e21
2 changed files with 18 additions and 1 deletions
|
@ -56,6 +56,22 @@ BroDoc::~BroDoc()
|
|||
FreeBroDocObjPtrList(redefs);
|
||||
}
|
||||
|
||||
void BroDoc::AddImport(const std::string& s)
|
||||
{
|
||||
size_t ext_pos = s.find_last_of('.');
|
||||
|
||||
if ( ext_pos == std::string::npos )
|
||||
imports.push_back(s);
|
||||
else
|
||||
{
|
||||
if ( s.substr(ext_pos + 1) == "bro" )
|
||||
imports.push_back(s.substr(0, ext_pos));
|
||||
else
|
||||
fprintf(stderr, "Warning: skipped documenting @load of file "
|
||||
"without .bro extension: %s\n", s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void BroDoc::SetPacketFilter(const std::string& s)
|
||||
{
|
||||
packet_filter = s;
|
||||
|
|
|
@ -52,10 +52,11 @@ public:
|
|||
|
||||
/**
|
||||
* Schedules an import (@load) to be documented.
|
||||
* If the script being loaded has a .bro suffix, it is internally stripped.
|
||||
* This should be called whenever the scanner sees an @load.
|
||||
* @param s The name of the imported script.
|
||||
*/
|
||||
void AddImport(const std::string& s) { imports.push_back(s); }
|
||||
void AddImport(const std::string& s);
|
||||
|
||||
/**
|
||||
* Schedules a namespace (module) to be documented.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue