Fortran-FOSS-Programmers / ford

Automatically generates FORtran Documentation from comments within the code.
https://forddocs.readthedocs.io
GNU General Public License v3.0
410 stars 134 forks source link

`extra_filetypes: c` fails #659

Closed HugoMVale closed 3 months ago

HugoMVale commented 3 months ago

I tried adding extra_filetypes: c to the metadata block in the project file, but it results in immediate failure. Any idea what might be the cause?

PS C:\Code\odrpack95> ford --version        
ford version 7.0.8
PS C:\Code\odrpack95> ford .\api-doc-ford.md
Traceback (most recent call last):
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\Scripts\ford.exe\__main__.py", line 7, in <module>
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\__init__.py", line 485, in run
    proj_data, proj_docs = initialize()
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\__init__.py", line 141, in initialize
    proj_docs, proj_data = load_settings(proj_docs, directory, args.project_file.name)
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\__init__.py", line 320, in load_settings
    proj_data, proj_docs = load_markdown_settings(directory, proj_docs, filename)
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\settings.py", line 312, in load_markdown_settings
    settings = convert_types_from_metapreprocessor(ProjectSettings, settings, filename)
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\settings.py", line 384, in convert_types_from_metapreprocessor
    settings[key] = convert_setting(default_type, key, value)
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\settings.py", line 356, in convert_setting
    file_types = [ExtraFileType.from_string(string) for string in resvalue]
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\settings.py", line 356, in <listcomp>
    file_types = [ExtraFileType.from_string(string) for string in resvalue]
  File "C:\Users\hugom\.pyenv\pyenv-win\versions\3.10.10\lib\site-packages\ford\settings.py", line 112, in from_string
    file_type = cls(parts[0], parts[1])
IndexError: list index out of range
ZedThree commented 3 months ago

Ah, that's not a very helpful error message, but I think the error is due to the format. You need to include the comment syntax too:

extra_filetypes: c //
HugoMVale commented 3 months ago

Thanks a lot for the quick explanation.