From 47728f0c89af565e5a0a77aebfb1cc267ec3c979 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Fri, 21 Dec 2018 17:52:34 +0100 Subject: [PATCH] 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 --- src/bin/eolian_mono/eolian/mono/documentation.hh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh index 4e9fc5d4b1..3acec94102 100644 --- a/src/bin/eolian_mono/eolian/mono/documentation.hh +++ b/src/bin/eolian_mono/eolian/mono/documentation.hh @@ -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; }