forked from enlightenment/efl
eolian: Leave default text for libeolian users
Summary: Instead of setting the default text at the library level, keep the summary empty if nothing is provided. The libeolian users them are free to check if the summary was actually empty or a placeholder text was added. ref T8309 Test Plan: Run attached tests Reviewers: q66, segfaultxavi Subscribers: cedric, brunobelo, #reviewers, felipealmeida, #committers Tags: #efl Maniphest Tasks: T8309 Differential Revision: https://phab.enlightenment.org/D10285
This commit is contained in:
parent
cbe3c944df
commit
86191b02c7
|
@ -18,6 +18,8 @@ _indent_line(Eina_Strbuf *buf, int ind)
|
|||
#define DOC_LIMIT(ind) ((ind > DOC_LINE_TEST) ? (ind + DOC_LINE_OVER) \
|
||||
: DOC_LINE_LIMIT)
|
||||
|
||||
#define SUMMARY_OR_DEFAULT(sum) (sum ? sum : "No description supplied.")
|
||||
|
||||
static void
|
||||
_generate_ref(const Eolian_State *state, const char *refn, Eina_Strbuf *wbuf)
|
||||
{
|
||||
|
@ -385,6 +387,7 @@ _gen_doc_buf(const Eolian_State *state, const Eolian_Documentation *doc,
|
|||
if (!doc) return NULL;
|
||||
|
||||
const char *sum = eolian_documentation_summary_get(doc);
|
||||
sum = SUMMARY_OR_DEFAULT(sum);
|
||||
const char *desc = eolian_documentation_description_get(doc);
|
||||
const char *since = eolian_documentation_since_get(doc);
|
||||
|
||||
|
@ -549,7 +552,7 @@ eo_gen_docs_func_gen(const Eolian_State *state, const Eolian_Function *fid,
|
|||
/* only summary, nothing else; generate standard brief doc */
|
||||
if (!desc && !par && !vpar && !rdoc && (ftype == EOLIAN_METHOD || !pdoc))
|
||||
{
|
||||
_gen_doc_brief(state, sum ? sum : "No description supplied.", since, group,
|
||||
_gen_doc_brief(state, SUMMARY_OR_DEFAULT(sum), since, group,
|
||||
NULL, indent, buf);
|
||||
return buf;
|
||||
}
|
||||
|
@ -560,7 +563,7 @@ eo_gen_docs_func_gen(const Eolian_State *state, const Eolian_Function *fid,
|
|||
curl += _indent_line(buf, indent);
|
||||
eina_strbuf_append(buf, " * @brief ");
|
||||
curl += sizeof(" * @brief ") - 1;
|
||||
_append_section(state, sum ? sum : "No description supplied.",
|
||||
_append_section(state, SUMMARY_OR_DEFAULT(sum),
|
||||
indent, curl, buf, wbuf);
|
||||
|
||||
eina_strbuf_append_char(buf, '\n');
|
||||
|
@ -588,7 +591,8 @@ eo_gen_docs_func_gen(const Eolian_State *state, const Eolian_Function *fid,
|
|||
const char *pdesc = eolian_documentation_description_get(pdoc);
|
||||
curl = _indent_line(buf, indent);
|
||||
eina_strbuf_append(buf, " * ");
|
||||
_append_section(state, eolian_documentation_summary_get(pdoc), indent,
|
||||
const char *psum = eolian_documentation_summary_get(pdoc);
|
||||
_append_section(state, SUMMARY_OR_DEFAULT(psum), indent,
|
||||
curl + 3, buf, wbuf);
|
||||
eina_strbuf_append_char(buf, '\n');
|
||||
if (pdesc)
|
||||
|
@ -651,7 +655,8 @@ eo_gen_docs_func_gen(const Eolian_State *state, const Eolian_Function *fid,
|
|||
{
|
||||
eina_strbuf_append_char(buf, ' ');
|
||||
curl += 1;
|
||||
_append_section(state, eolian_documentation_summary_get(adoc),
|
||||
const char *asum = eolian_documentation_summary_get(adoc);
|
||||
_append_section(state, SUMMARY_OR_DEFAULT(asum),
|
||||
indent, curl, buf, wbuf);
|
||||
}
|
||||
|
||||
|
@ -684,7 +689,8 @@ eo_gen_docs_func_gen(const Eolian_State *state, const Eolian_Function *fid,
|
|||
curl = _indent_line(buf, indent);
|
||||
eina_strbuf_append(buf, " * @return ");
|
||||
curl += sizeof(" * @return ") - 1;
|
||||
_append_section(state, eolian_documentation_summary_get(rdoc), indent,
|
||||
const char *rsum = eolian_documentation_summary_get(rdoc);
|
||||
_append_section(state, SUMMARY_OR_DEFAULT(rsum), indent,
|
||||
curl, buf, wbuf);
|
||||
eina_strbuf_append_char(buf, '\n');
|
||||
if (since)
|
||||
|
|
|
@ -522,8 +522,6 @@ read_doc(Eo_Lexer *ls, Eo_Token *tok, int line, int column)
|
|||
|
||||
if (eina_strbuf_length_get(rbuf))
|
||||
doc->description = eina_stringshare_add(eina_strbuf_string_get(rbuf));
|
||||
if (!doc->summary)
|
||||
doc->summary = eina_stringshare_add("No description supplied.");
|
||||
if (!doc->since && ls->klass && ls->klass->doc)
|
||||
doc->since = eina_stringshare_ref(ls->klass->doc->since);
|
||||
eina_strbuf_free(rbuf);
|
||||
|
|
|
@ -132,6 +132,16 @@ EOAPI void eo_docs_prop_set(Eo *obj, int val);
|
|||
*/
|
||||
EOAPI int eo_docs_prop_get(const Eo *obj);
|
||||
|
||||
EOAPI void eo_docs_no_doc_meth(Eo *obj);
|
||||
|
||||
/** No description supplied.
|
||||
*
|
||||
* @since 1.18
|
||||
*
|
||||
* @ingroup Eo_Docs
|
||||
*/
|
||||
EOAPI void eo_docs_doc_with_empty_doc(Eo *obj);
|
||||
|
||||
EWAPI extern const Efl_Event_Description _EO_DOCS_EVENT_CLICKED;
|
||||
|
||||
/** Event docs.
|
||||
|
|
|
@ -78,6 +78,13 @@ class Eo_Docs {
|
|||
val: int; [[Value documentation.]]
|
||||
}
|
||||
}
|
||||
|
||||
no_doc_meth {
|
||||
}
|
||||
|
||||
doc_with_empty_doc {
|
||||
[[]]
|
||||
}
|
||||
}
|
||||
events {
|
||||
clicked: void; [[Event docs.]]
|
||||
|
|
|
@ -1263,6 +1263,15 @@ EFL_START_TEST(eolian_docs)
|
|||
"Event docs."));
|
||||
fail_if(eolian_documentation_description_get(doc));
|
||||
|
||||
fail_if(!(fid = eolian_class_function_by_name_get(class, "no_doc_meth", EOLIAN_METHOD)));
|
||||
fail_if(!(fimp = eolian_function_implement_get(fid)));
|
||||
fail_if((doc = eolian_implement_documentation_get(fimp, EOLIAN_METHOD)));
|
||||
|
||||
fail_if(!(fid = eolian_class_function_by_name_get(class, "doc_with_empty_doc", EOLIAN_METHOD)));
|
||||
fail_if(!(fimp = eolian_function_implement_get(fid)));
|
||||
fail_if(!(doc = eolian_implement_documentation_get(fimp, EOLIAN_METHOD)));
|
||||
fail_if(eolian_documentation_summary_get(doc));
|
||||
|
||||
eolian_state_free(eos);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
|
Loading…
Reference in New Issue