Skip to content

bug: script in reference.ts is buggy resulting in failure of parsing docs of many methods in p5.sound.js #1226

@kunstewi

Description

@kunstewi

Most appropriate sections of the p5.js website?

Reference

What is your operating system?

Mac OS

Web browser and version

Helium: 0.9.4.1 (Official Build) (arm64)

Actual Behavior

check out this issue by dave to see the problem in p5.sound.js - here

When i decided to dig deeper the first thing I found that there was no way to test p5.sound.js reference docs locally on p5.js-website.

so the first thing I did was to update the p5.js-website script to support p5.sound.js docs local testing. I have raised a PR for this - here. It would be needed in the future testing p5.sound.js docs.

After this I tried updating class names, method tag, for tag every possible combination but the changes were not reflecting on the p5.js-website reference. I was testing on beta.p5js.org for information as p5.sound.js is on 2.0 beta website.

Then after diving deeper i finally found the problem which was this old script in reference.ts file:

      // Fix p5.sound classes
      for (const key in soundData.classes) {
        const newName = `p5.${  soundData.classes[key].name}`;
        const updated = {
          ...soundData.classes[key],
          name: newName,
        };
        soundData.classes[newName] = updated;
        delete soundData.classes[key];
      }
      for (const item of soundData.classitems) {
        item.class = `p5.${  item.class}`;
      }

The reason those functions did not show up on the reference website is due to a small bug in how the parser grouped p5.sound's global functions.

In the JSDoc comments for p5.sound.js, global functions like userStartAudio, getAudioContext, and loadSound state that they belong to the p5.sound module. This led the parser to temporarily assign their class to "p5.sound". Yet, the build script in reference.ts had a simple loop that added "p5." in front of every parsed class name. Because of this, "p5.sound" was changed to "p5.p5.sound".

The Astro website organizes the reference documentation by class. Since there is no actual class called p5.p5.sound, the generator placed these Markdown files into a "black hole" folder (src/content/reference/en/p5.p5.sound/) and they were cut off from the sidebar index.

Expected Behavior

Expected behaviour is the p5.js-website loads all the references from Utils.js and SoundFile of p5.sound.js and show it properly on the p5.sound.js reference page.

Steps to reproduce

Check out dave's comment.

Would you like to work on the issue?

Yes

@davepagurek @limzykenneth @ksen0

please take a look whenever you are free.

Thanks a lot for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions