mirror of
https://github.com/MillironX/nfdocs-parser.git
synced 2024-11-24 17:59:54 +00:00
Promote the parser script to a Directive class
Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com>
This commit is contained in:
parent
01bd885867
commit
c09f664328
1 changed files with 100 additions and 97 deletions
|
@ -2,11 +2,14 @@
|
|||
import sys
|
||||
import yaml
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import Directive
|
||||
|
||||
# Declare the docstring starting characters
|
||||
DOC_STARTER = "/// "
|
||||
class NFDocs(Directive):
|
||||
|
||||
def definition_type(signature):
|
||||
# Declare the docstring starting characters
|
||||
DOC_STARTER = "/// "
|
||||
|
||||
def definition_type(signature):
|
||||
# Returns "name", workflow|process|function
|
||||
def_type = "unknown"
|
||||
if "workflow" in signature:
|
||||
|
@ -26,7 +29,7 @@ def definition_type(signature):
|
|||
# Return the results
|
||||
return def_name, def_type
|
||||
|
||||
def params_to_list(params):
|
||||
def params_to_list(params):
|
||||
if "tuple" in params.keys():
|
||||
tuple_item = nodes.list_item()
|
||||
if "name" in params.keys():
|
||||
|
@ -45,9 +48,9 @@ def params_to_list(params):
|
|||
io_item += nodes.paragraph(text=params["description"])
|
||||
return io_item
|
||||
|
||||
# Take path as single argument for now
|
||||
nextflow_path = sys.argv[1]
|
||||
with open(nextflow_path) as nextflow_file:
|
||||
# Take path as single argument for now
|
||||
nextflow_path = sys.argv[1]
|
||||
with open(nextflow_path) as nextflow_file:
|
||||
|
||||
# Split by lines
|
||||
nextflow_lines = nextflow_file.readlines()
|
||||
|
|
Loading…
Reference in a new issue