[LTP] [RFC] Remove [Description] subtitle from docparse
Cyril Hrubis
chrubis@suse.cz
Fri Jan 31 12:32:45 CET 2025
Hi!
> Can we remove [Description] part from docparse documentation in tests?
> This is transformed into "Description" subtitle in resulted html/pdf.
>
> 1) It's not really needed (it's obvious that it's a description of the test)
> 2) Sometimes it's missing (inconsistency).
That part can be fixed with something as:
diff --git a/metadata/metaparse.c b/metadata/metaparse.c
index 2b96149dc..422604a2c 100644
--- a/metadata/metaparse.c
+++ b/metadata/metaparse.c
@@ -852,6 +852,14 @@ static struct data_node *parse_file(const char *fname)
if (data_node_array_len(doc)) {
data_node_hash_add(res, "doc", doc);
+
+ char *str = doc->array.array[0]->string.val;
+
+ if (!strstr("[Description]", str)) {
+ fprintf(stderr, "%s: Missing [Description] in doc comment!\n", fname);
+ exit(1);
+ }
+
found = 1;
} else {
data_node_free(doc);
> I would keep other subtitles (e.g. [Algorithm]), just remove the first one.
I find it a bit inconsistent if we do it this way, but I guess either
way is fine.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list