Skip to content

Errors when no outline: present in document #1

@ramfox

Description

@ramfox

If no outline: present in document:

in template:
Parses the doc, but never finds DocumentTok. Continues to read until we get to EofTok, which returns. It returns no error and an empty Doc
We attempt to execute the template using the data in Doc. It's empty so it prints this error: # template: mdIndex:17:5: executing "mdIndex" at <.Name>: can't evaluate field Name in type *lib.Doc

in fmt:
doc is nil, and when we use MarshalIndent, it panics

potential solutions:

  1. if no DocumentTok is found, in other words, if parser.read() never finds tok.Type DocumentTok, error saying the docs are ill-formatted and link to the readme.
    or
  2. Check for doc == nil before attempting to execute the template or marshal the data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions