eolian/generator: generation of doxygen @note and @warning tags

@feature
This commit is contained in:
Daniel Kolesa 2015-09-14 14:10:32 +01:00
parent 2381d8160a
commit a9968b975f
5 changed files with 36 additions and 0 deletions

View File

@ -122,11 +122,28 @@ static int
_append_section(const char *desc, int ind, int curl, Eina_Strbuf *buf,
Eina_Strbuf *wbuf, Eina_Bool use_legacy)
{
Eina_Bool try_note = EINA_TRUE;
while (*desc)
{
eina_strbuf_reset(wbuf);
while (*desc && isspace(*desc) && (*desc != '\n'))
eina_strbuf_append_char(wbuf, *desc++);
if (try_note)
{
#define CHECK_NOTE(str) !strncmp(desc, str ": ", sizeof(str ": ") - 1)
if (CHECK_NOTE("Note"))
{
eina_strbuf_append(wbuf, "@note ");
desc += sizeof("Note:");
}
else if (CHECK_NOTE("Warning"))
{
eina_strbuf_append(wbuf, "@warning ");
desc += sizeof("Warning:");
}
#undef CHECK_NOTE
try_note = EINA_FALSE;
}
if (*desc == '\\')
{
desc++;
@ -182,6 +199,7 @@ _append_section(const char *desc, int ind, int curl, Eina_Strbuf *buf,
_indent_line(buf, ind);
eina_strbuf_append(buf, " *\n");
desc++;
try_note = EINA_TRUE;
}
curl = _indent_line(buf, ind) + 3;
eina_strbuf_append(buf, " * ");

View File

@ -2,8 +2,13 @@ struct Foo {
[[This is struct Foo.
It does stuff.
Note: This is a note.
This is a longer description for struct Foo.
Warning: This is a warning. You can only use Warning: and
Note: at the beginning of a paragraph.
This is another paragraph.
@since 1.66

View File

@ -14,8 +14,13 @@ typedef Eo Docs;
/**
* @brief This is struct Foo. It does stuff.
*
* @note This is a note.
*
* This is a longer description for struct Foo.
*
* @warning This is a warning. You can only use Warning: and Note: at the
* beginning of a paragraph.
*
* This is another paragraph.
*
* @since 1.66

View File

@ -14,8 +14,13 @@ typedef Eo Docs;
/**
* @brief This is struct Foo. It does stuff.
*
* @note This is a note.
*
* This is a longer description for struct Foo.
*
* @warning This is a warning. You can only use Warning: and Note: at the
* beginning of a paragraph.
*
* This is another paragraph.
*
* @since 1.66

View File

@ -1131,7 +1131,10 @@ START_TEST(eolian_docs)
fail_if(strcmp(eolian_documentation_summary_get(doc),
"This is struct Foo. It does stuff."));
fail_if(strcmp(eolian_documentation_description_get(doc),
"Note: This is a note.\n\n"
"This is a longer description for struct Foo.\n\n"
"Warning: This is a warning. You can only use Warning: "
"and Note: at the beginning of a paragraph.\n\n"
"This is another paragraph."));
fail_if(strcmp(eolian_documentation_since_get(doc),
"1.66"));