Merge remote-tracking branch 'origin/fastpath'

* origin/fastpath:
  Improve Broxygen end-of-sentence detection.
This commit is contained in:
Robin Sommer 2013-10-11 17:23:25 -07:00
commit 1a9835a00a
7 changed files with 47 additions and 9 deletions

View file

@ -1,4 +1,8 @@
2.2-beta-57 | 2013-10-11 17:23:25 -0700
* Improve Broxygen end-of-sentence detection. (Jon Siwek)
2.2-beta-55 | 2013-10-10 13:36:38 -0700 2.2-beta-55 | 2013-10-10 13:36:38 -0700
* A couple of new TLS extension numbers. (Bernhard Amann) * A couple of new TLS extension numbers. (Bernhard Amann)

View file

@ -1 +1 @@
2.2-beta-55 2.2-beta-57

@ -1 +1 @@
Subproject commit 7ca51fc46c5c3dd4f3d803e5c617c2e35129fb05 Subproject commit 81fa2d664a7ef7306a03928484b10611fbe893b8

View file

@ -167,6 +167,10 @@ export {
# it's fine if the type is inferred, that information is self-documenting # it's fine if the type is inferred, that information is self-documenting
global var_without_explicit_type = "this works"; global var_without_explicit_type = "this works";
## The first.sentence for the summary text ends here. And this second
## sentence doesn't show in the short description.
global dummy: string;
############## functions/events ############ ############## functions/events ############
## Summarize purpose of "a_function" here. ## Summarize purpose of "a_function" here.

View file

@ -74,6 +74,27 @@ int BroDocObj::LongestShortDescLen() const
return max; return max;
} }
static size_t end_of_first_sentence(string s)
{
size_t rval = 0;
while ( (rval = s.find_first_of('.', rval)) != string::npos )
{
if ( rval == s.size() - 1 )
// Period is at end of string.
return rval;
if ( isspace(s[rval + 1]) )
// Period has a space after it.
return rval;
// Period has some non-space character after it, keep looking.
++rval;
}
return rval;
}
void BroDocObj::FormulateShortDesc() void BroDocObj::FormulateShortDesc()
{ {
if ( ! reST_doc_strings ) if ( ! reST_doc_strings )
@ -87,7 +108,7 @@ void BroDocObj::FormulateShortDesc()
{ {
// The short description stops at the first sentence or the // The short description stops at the first sentence or the
// first empty comment. // first empty comment.
size_t end = it->find_first_of("."); size_t end = end_of_first_sentence(*it);
if ( end == string::npos ) if ( end == string::npos )
{ {

View file

@ -20,11 +20,11 @@ Options
Types Types
##### #####
======================================= ====================================== ======================================= ========================================
:bro:type:`TestEnum1`: :bro:type:`enum` There's tons of ways an enum can look. :bro:type:`TestEnum1`: :bro:type:`enum` There's tons of ways an enum can look...
:bro:type:`TestEnum2`: :bro:type:`enum` The final comma is optional :bro:type:`TestEnum2`: :bro:type:`enum` The final comma is optional
======================================= ====================================== ======================================= ========================================
Redefinitions Redefinitions
############# #############

View file

@ -40,13 +40,15 @@ Options
State Variables State Variables
############### ###############
=========================================================================== ======================================= =========================================================================== ==================================================
:bro:id:`Example::a_var`: :bro:type:`bool` put some documentation for "a_var" here :bro:id:`Example::a_var`: :bro:type:`bool` put some documentation for "a_var" here
:bro:id:`Example::var_with_attr`: :bro:type:`count` :bro:attr:`&persistent` :bro:id:`Example::var_with_attr`: :bro:type:`count` :bro:attr:`&persistent`
:bro:id:`Example::var_without_explicit_type`: :bro:type:`string` :bro:id:`Example::var_without_explicit_type`: :bro:type:`string`
=========================================================================== =======================================
:bro:id:`Example::dummy`: :bro:type:`string` The first.sentence for the summary text ends here.
=========================================================================== ==================================================
Types Types
##### #####
@ -156,6 +158,13 @@ State Variables
:Type: :bro:type:`string` :Type: :bro:type:`string`
:Default: ``"this works"`` :Default: ``"this works"``
.. bro:id:: Example::dummy
:Type: :bro:type:`string`
The first.sentence for the summary text ends here. And this second
sentence doesn't show in the short description.
Types Types
##### #####
.. bro:type:: Example::SimpleEnum .. bro:type:: Example::SimpleEnum