Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/481 jsdoc annotations exporter #740

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions core/lib/annotation_exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ const annotations_exporter = function (pl) {
const paths = pl.config.paths;
let oldAnnotations;

/*
Returns the array of comments that used to be wrapped in raw JS.
/**
* Parses JS annotations.
* @returns array of comments that used to be wrapped in raw JS
*/
function parseAnnotationsJS() {
//attempt to read the file
Expand All @@ -38,6 +39,12 @@ const annotations_exporter = function (pl) {
return oldAnnotationsJSON.comments;
}

/**
* Build the annotation markdown.
* @param annotationsYAML
* @param markdown_parser
* @returns annotation
*/
function buildAnnotationMD(annotationsYAML, markdown_parser) {
const annotation = {};
const markdownObj = markdown_parser.parse(annotationsYAML);
Expand All @@ -48,6 +55,11 @@ const annotations_exporter = function (pl) {
return annotation;
}

/**
* Parse markdown file annotations.
* @param annotations
* @param parser
*/
function parseMDFile(annotations, parser) {
//let annotations = annotations;
const markdown_parser = parser;
Expand All @@ -65,8 +77,10 @@ const annotations_exporter = function (pl) {
};
}

/*
Converts the *.md file yaml list into an array of annotations
/**
* Converts the *.md file yaml list into an array of annotations
*
* @returns annotations
*/
function parseAnnotationsMD() {
const markdown_parser = new mp();
Expand All @@ -77,6 +91,11 @@ const annotations_exporter = function (pl) {
return annotations;
}

/**
* Gathers JS & MD annotations.
*
* @returns array of annotations
*/
function gatherAnnotations() {
const annotationsJS = parseAnnotationsJS();
const annotationsMD = parseAnnotationsMD();
Expand Down