diff --git a/doc2md.py b/doc2md.py index 3300b9f4..b22e9ed3 100755 --- a/doc2md.py +++ b/doc2md.py @@ -6,7 +6,7 @@ Convert parser doc string to markdown import sys import importlib from inspect import isfunction, signature, cleandoc -import yapf +import yapf # type: ignore import os import sys @@ -29,7 +29,7 @@ header = f'''[Home](https://kellyjonbrazil.github.io/jc/) # {mod_path} ''' -summary = module.__doc__ +summary = module.__doc__ or '' functions = [] for attribute in dir(module): @@ -45,7 +45,7 @@ for attribute in dir(module): functions.append(attribute) ######## TABLE OF CONTENTS ######## -toc = f'# Table of Contents\n\n*[{mod_path}](#{mod_path})\n' +toc = f'## Table of Contents\n\n*[{mod_path}](#{mod_path})\n' for api in functions: toc = f'{toc} *[{api}](#{mod_path}.{api})\n' @@ -78,6 +78,7 @@ if 'jc.parsers.' in mod_path and not 'universal' in mod_path: footer = footer + 'This parser can be used with the `--slurp` command-line option.\n\n' footer = footer + f'Version {ver} by {author} ({author_email})\n' +final_doc = '' if 'jc.parsers.' in mod_path and not 'universal' in mod_path: final_doc = header + '\n' + summary + '\n\n' + api_docs + '\n' + footer elif mod_path == 'jc': diff --git a/docs/lib.md b/docs/lib.md index 935d3519..abddc6cb 100644 --- a/docs/lib.md +++ b/docs/lib.md @@ -3,7 +3,7 @@ # jc.lib -# Table of Contents +## Table of Contents *[jc.lib](#jc.lib) *[all_parser_info](#jc.lib.all_parser_info) diff --git a/docs/parsers/universal.md b/docs/parsers/universal.md index d532eed2..d899daca 100644 --- a/docs/parsers/universal.md +++ b/docs/parsers/universal.md @@ -3,7 +3,7 @@ # jc.parsers.universal -# Table of Contents +## Table of Contents *[jc.parsers.universal](#jc.parsers.universal) *[simple_table_parse](#jc.parsers.universal.simple_table_parse) diff --git a/docs/streaming.md b/docs/streaming.md index cb1f3526..0e216ebe 100644 --- a/docs/streaming.md +++ b/docs/streaming.md @@ -3,7 +3,7 @@ # jc.streaming -# Table of Contents +## Table of Contents *[jc.streaming](#jc.streaming) *[add_jc_meta](#jc.streaming.add_jc_meta) diff --git a/docs/utils.md b/docs/utils.md index 5465d57b..aa8da804 100644 --- a/docs/utils.md +++ b/docs/utils.md @@ -3,7 +3,7 @@ # jc.utils -# Table of Contents +## Table of Contents *[jc.utils](#jc.utils) *[compatibility](#jc.utils.compatibility)