|
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/packages/metadata/src/PluginCache.ts
Lines 90 to 118 in d8a35f6
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.