efl-mono: Remove trailing () from doc references

Summary:
Some EO docs include () after a @method reference (some don't).
When the method reference is redered by DocFX it already includes
the trailing parenthese (and it even includes the parameter types),
so it looks very weird: Efl.Gfx.Stack.Raise()()

This patch removes the "()" string from any text comment following
an @ reference.

Test Plan:
Check DocFX docs for Efl.Gfx.Stack.Lower before and after this patch.
There are references to other methods which include the double parentheses.

Reviewers: lauromoura

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7504
This commit is contained in:
Xavi Artigas 2018-12-21 17:52:34 +01:00
parent 8fa3f39e31
commit 47728f0c89
1 changed files with 11 additions and 2 deletions

View File

@ -130,6 +130,7 @@ struct documentation_generator
::Eolian_Doc_Token token;
const char *text_ptr = text.c_str();
::eolian_doc_token_init(&token);
::Eolian_Doc_Token_Type previous_token_type = ::EOLIAN_DOC_TOKEN_UNKNOWN;
while ((text_ptr = ::eolian_documentation_tokenize(text_ptr, &token)) != NULL)
{
std::string token_text, name_tail;
@ -139,11 +140,18 @@ struct documentation_generator
token_text = token_text_cstr;
free(token_text_cstr);
if (token_text.length() > 4)
name_tail = token_text.substr(token_text.size() - 4, 4);
name_tail = token_text.substr(token_text.length() - 4, 4);
}
switch(::eolian_doc_token_type_get(&token))
::Eolian_Doc_Token_Type token_type = ::eolian_doc_token_type_get(&token);
switch(token_type)
{
case ::EOLIAN_DOC_TOKEN_TEXT:
// If previous token was a reference and this text token starts with
// parentheses, remove them, since the reference will be rendered
// with the parentheses already.
if ((previous_token_type == ::EOLIAN_DOC_TOKEN_REF) &&
(token_text.substr(0, 2) == "()"))
token_text = token_text.substr(2, token_text.length() - 2);
new_text += token_text;
break;
case ::EOLIAN_DOC_TOKEN_REF:
@ -174,6 +182,7 @@ struct documentation_generator
default:
break;
}
previous_token_type = token_type;
}
return new_text;
}