From ccda6693634cda82fdb69e1847600db6976c50e3 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Mon, 10 Jan 2022 17:41:20 -0600 Subject: [PATCH] Add plural string understanding to section titles Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> --- nfdocs-parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nfdocs-parser.py b/nfdocs-parser.py index e0acbe6..3c2d236 100755 --- a/nfdocs-parser.py +++ b/nfdocs-parser.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +import inflect import os import yaml from docutils import nodes @@ -102,6 +103,8 @@ class NFDocs(Directive): # Declare the docstring starting characters DOC_STARTER = "/// " + pe = inflect.engine() + def run(self): # Take path as single argument for now nextflow_path = self.arguments[0] @@ -161,7 +164,7 @@ class NFDocs(Directive): for block_type, block_docs in docstrings.items(): if len(block_docs) > 0: block_section = nodes.section() - block_section += nodes.title(text=block_type.capitalize()) + block_section += nodes.title(text=self.pe.plural(block_type.capitalize(), len(block_docs))) for proc_name, proc_docs in block_docs.items(): proc_section = nodes.section() proc_section += nodes.title(text=proc_name)