Skip to content

JavaScript error with --one-file #1426

@jacob-carlborg

Description

@jacob-carlborg

When generating documentation with the --one-file flag, the generate output contains a JavaScript error.

Steps to reproduce

  1. Run the following commands:
    cat << EOF >> foo.rb
    # Foobar
    class Foo
    end
    EOF
    
    yard doc --one-file --no-save -o .
    
  2. Open the generate index.html in the browser
  3. Look at the browser console/JavaScript errors

Actual Output

I get this error, both in Safari and Chrome:

ReferenceError: Can't find variable: pathId
    postMessage - index.html:780

The error occurs in a JavaScript function called: navExpander. The issue is probably that the --one-file output does not have a navigation bar, but the JavaScript is shared with the default template, which do have a navigation bar.

Expected Output

No JavaScript errors.

Environment details:

  • OS: macOS 12.0.1
  • Ruby version (ruby -v): ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
  • YARD version (yard -v): yard 0.9.27

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions