mirror of
https://github.com/MillironX/nfdocs-parser.git
synced 2024-11-22 00:56:04 +00:00
Add plural string understanding to section titles
Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
This commit is contained in:
parent
c8d642002b
commit
ccda669363
1 changed files with 4 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
import inflect
|
||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
@ -102,6 +103,8 @@ class NFDocs(Directive):
|
||||||
# Declare the docstring starting characters
|
# Declare the docstring starting characters
|
||||||
DOC_STARTER = "/// "
|
DOC_STARTER = "/// "
|
||||||
|
|
||||||
|
pe = inflect.engine()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Take path as single argument for now
|
# Take path as single argument for now
|
||||||
nextflow_path = self.arguments[0]
|
nextflow_path = self.arguments[0]
|
||||||
|
@ -161,7 +164,7 @@ class NFDocs(Directive):
|
||||||
for block_type, block_docs in docstrings.items():
|
for block_type, block_docs in docstrings.items():
|
||||||
if len(block_docs) > 0:
|
if len(block_docs) > 0:
|
||||||
block_section = nodes.section()
|
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():
|
for proc_name, proc_docs in block_docs.items():
|
||||||
proc_section = nodes.section()
|
proc_section = nodes.section()
|
||||||
proc_section += nodes.title(text=proc_name)
|
proc_section += nodes.title(text=proc_name)
|
||||||
|
|
Loading…
Reference in a new issue