mirror of
https://github.com/MillironX/nfdocs-parser.git
synced 2024-11-22 08:59:55 +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 sys
|
||||||
import yaml
|
import yaml
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
from docutils.parsers.rst import Directive
|
||||||
|
|
||||||
# Declare the docstring starting characters
|
class NFDocs(Directive):
|
||||||
DOC_STARTER = "/// "
|
|
||||||
|
|
||||||
def definition_type(signature):
|
# Declare the docstring starting characters
|
||||||
|
DOC_STARTER = "/// "
|
||||||
|
|
||||||
|
def definition_type(signature):
|
||||||
# Returns "name", workflow|process|function
|
# Returns "name", workflow|process|function
|
||||||
def_type = "unknown"
|
def_type = "unknown"
|
||||||
if "workflow" in signature:
|
if "workflow" in signature:
|
||||||
|
@ -26,7 +29,7 @@ def definition_type(signature):
|
||||||
# Return the results
|
# Return the results
|
||||||
return def_name, def_type
|
return def_name, def_type
|
||||||
|
|
||||||
def params_to_list(params):
|
def params_to_list(params):
|
||||||
if "tuple" in params.keys():
|
if "tuple" in params.keys():
|
||||||
tuple_item = nodes.list_item()
|
tuple_item = nodes.list_item()
|
||||||
if "name" in params.keys():
|
if "name" in params.keys():
|
||||||
|
@ -45,9 +48,9 @@ def params_to_list(params):
|
||||||
io_item += nodes.paragraph(text=params["description"])
|
io_item += nodes.paragraph(text=params["description"])
|
||||||
return io_item
|
return io_item
|
||||||
|
|
||||||
# Take path as single argument for now
|
# Take path as single argument for now
|
||||||
nextflow_path = sys.argv[1]
|
nextflow_path = sys.argv[1]
|
||||||
with open(nextflow_path) as nextflow_file:
|
with open(nextflow_path) as nextflow_file:
|
||||||
|
|
||||||
# Split by lines
|
# Split by lines
|
||||||
nextflow_lines = nextflow_file.readlines()
|
nextflow_lines = nextflow_file.readlines()
|
||||||
|
|
Loading…
Reference in a new issue