Skip to content

Replacing javadoc parsing of fetch with parsing package #16

@vzhang03

Description

@vzhang03

private parseJavadocString(script: string) {
const dataString = script.match(/data:\s*{([\s\S]*?)};\s*/).join();
const result = {};
// Regular expression to match each variable block
const varRegex = /\/\*\*\s*([\s\S]*?)\s*\*\/\s*(\w+):\s*{\s*([\s\S]*?)\s*},?/gs;
const propRegex = /\s*(\w+):\s*([^,\s]+)/g;
// Match each variable block
let match;
while ((match = varRegex.exec(dataString)) !== null) {
let [, description, varName, props] = match;
description = description.trim().replace(/\s+/g, " "); // Clean up description
const propsObj = {};
let propMatch;
while ((propMatch = propRegex.exec(props)) !== null) {
let [, propName, propValue] = propMatch;
propsObj[propName] = propValue;
}
result[varName] = {
description: description,
...propsObj, // Add all additional properties to the result object
};
}
return result;
}
}

Currently the metadata module parses the javadoc using a prewritten and defined function. Because the structure of javascript or how plugins are written may change in the future, this may invalidate the package in its current form. To prevent this, would be good to replace this with a javadoc scraping package that is maintained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions