Omit empty description sections in pod
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/273ce8f8 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/273ce8f8 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/273ce8f8 Branch: refs/heads/cfc-pod-wip2 Commit: 273ce8f8a15c924a54577ee4ba7e27f55f676050 Parents: b067b8e Author: Nick Wellnhofer <[email protected]> Authored: Tue Jul 30 11:50:12 2013 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Wed Jun 25 17:45:00 2014 +0200 ---------------------------------------------------------------------- compiler/src/CFCPerlClass.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/273ce8f8/compiler/src/CFCPerlClass.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPerlClass.c b/compiler/src/CFCPerlClass.c index 5349d5c..6b305cf 100644 --- a/compiler/src/CFCPerlClass.c +++ b/compiler/src/CFCPerlClass.c @@ -405,13 +405,6 @@ CFCPerlClass_create_pod(CFCPerlClass *self) { const char *raw_brief = CFCDocuComment_get_brief(docucom); char *brief = CFCPerlPod_perlify_doc_text(pod_spec, raw_brief); - // Get the class's long description. - const char *raw_description = CFCPerlPod_get_description(pod_spec); - if (!raw_description || !strlen(raw_description)) { - raw_description = CFCDocuComment_get_long(docucom); - } - char *description = CFCPerlPod_perlify_doc_text(pod_spec, raw_description); - // Create SYNOPSIS. const char *raw_synopsis = CFCPerlPod_get_synopsis(pod_spec); char *synopsis = CFCUtil_strdup(""); @@ -420,6 +413,20 @@ CFCPerlClass_create_pod(CFCPerlClass *self) { "\n", NULL); } + // Create DESCRIPTION. + const char *raw_description = CFCPerlPod_get_description(pod_spec); + if (!raw_description || !strlen(raw_description)) { + raw_description = CFCDocuComment_get_long(docucom); + } + char *description = CFCUtil_strdup(""); + if (raw_description && strlen(raw_description)) { + char *desc_text + = CFCPerlPod_perlify_doc_text(pod_spec, raw_description); + description = CFCUtil_cat(description, "=head1 DESCRIPTION\n\n", + desc_text, "\n", NULL); + FREEMEM(desc_text); + } + // Create CONSTRUCTORS. char *constructor_pod = CFCPerlPod_constructors_pod(pod_spec, client); @@ -471,8 +478,6 @@ CFCPerlClass_create_pod(CFCPerlClass *self) { "\n" "%s\n" "\n" - "=head1 DESCRIPTION\n" - "\n" "%s\n" "\n" "%s\n"
