course-renderer
Version:
Manages CA School Courses file system storage and HTML conversion
25 lines (24 loc) • 709 B
JavaScript
;
/**
* @module PathSanitizer
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* sanitizer - Sanitizes the path's on the rendered HTML attribute values. This is to hide the internal file system structure on the HTML.
*/
function pathSanitize(tokens, courseName, chapter) {
return sanitizeChapter(tokens, chapter);
}
exports.pathSanitize = pathSanitize;
function sanitizeChapter(tokens, chapter) {
tokens.forEach((token) => {
if (token.children instanceof Array) {
token.chapter = chapter;
sanitizeChapter(token.children, chapter);
}
else {
token.chapter = chapter;
}
});
return tokens;
}