Object.keys(sourceFiles).forEach(function (file) { var source; // links are keyed to the shortened path in each doclet's `meta.shortpath` property var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened); helper.registerLink(sourceFiles[file].shortened, sourceOutfile); try { var language = "javascript"; var matches = /\.([a-z0-9]+?)$/i.exec(file); if (matches && matches.length > 0) { language = matches[1]; language = (language == "js") ? "javascript" : language; } source = { kind: 'source', lang: language, code: helper.htmlsafe(fs.readFileSync(sourceFiles[file].resolved, 'utf8')) }; } catch (e) { handle(e); } generate('source', 'Source: ' + sourceFiles[file].shortened, [source], sourceOutfile, false); });
Object.keys(sourceFiles).forEach(function(file) { var source; // links are keyed to the shortened path in each doclet's `meta.shortpath` property var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened); helper.registerLink(sourceFiles[file].shortened, sourceOutfile); try { source = { kind: 'source', code: fs.readFileSync(sourceFiles[file].resolved, encoding) }; } catch(e) { logger.error('Error while generating source file %s: %s', file, e.message); } if (hljs) { //source.code = hljs.highlightAuto(source.code).value; // For a generic template this should be auto. // OpenSeadragon is pure javascript, so this speeds things up. source.code = hljs.highlight('javascript', source.code).value; source.code = generateSourceLineNumberIds(source.code); } else { source.code = helper.htmlsafe(source.code); } generate('Source: ' + sourceFiles[file].shortened, [source], sourceOutfile, false); });
Object.keys(sourceFiles).forEach(function (file) { var source // links are keyed to the shortened path in each doclet's `meta.shortpath` property var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened) helper.registerLink(sourceFiles[file].shortened, sourceOutfile) try { source = { kind: "source", code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) ) } } catch (e) { logger.error("Error while generating source file %s: %s", file, e.message) } generate( "Source", sourceFiles[file].shortened, [source], sourceOutfile, false ) })
it("returns a string array of the doclet's types", function() { var doc = new doclet.Doclet('/** @const {number|Array.<boolean>} ASDF */', {}), types = helper.getSignatureTypes(doc); expect(types.length).toBe(2); expect(types).toContain('number'); expect(types).toContain(helper.htmlsafe('Array.<boolean>')); // should be HTML safe });
function link(item, linkText, linkClass, fragmentId) { let htmlLink; let regExp; if (linkText) { linkText = templateHelper.htmlsafe(linkText); regExp = new RegExp(util.format('(>(%s)<\\/)', escape(linkText))); } htmlLink = templateHelper.linkto(item, linkText, linkClass, fragmentId); if (regExp) { htmlLink = htmlLink.replace(regExp, (match, p1, p2) => p1.replace(p2, softBreak(p2))); } return htmlLink; }
function( file ) { var source; // links are keyed to the shortened path in each doclet's `meta.shortpath` property var sourceOutfile = helper.getUniqueFilename( sourceFiles[file].shortened ); helper.registerLink( sourceFiles[file].shortened, sourceOutfile ); try { source = { kind : 'source', code : helper.htmlsafe( fs.readFileSync( sourceFiles[file].resolved, encoding ) ) }; } catch( e ) { logger.error( 'Error while generating source file %s: %s', file, e.message ); } generate( 'Source', sourceFiles[file].shortened, [source], sourceOutfile, false ); }
Object.keys(sourceFiles).forEach(function (file) { var source; // links are keyed to the shortened path in each doclet's `meta.shortpath` property var sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened); helper.registerLink(sourceFiles[file].shortened, sourceOutfile); try { source = { kind: 'source', code: helper.htmlsafe(fs.readFileSync(sourceFiles[file].resolved, 'utf8')) }; } catch (e) { handle(e); } generate('source', 'Source: ' + sourceFiles[file].shortened, [source], sourceOutfile, false); });
Object.keys(pathMap).forEach(function(file) { var data = { docs: null, pageCategory: CATEGORIES.SOURCES, pageTitle: pathMap[file], pageTitlePrefix: this.pageTitlePrefix }; // links are keyed to the shortened path url = helper.getUniqueFilename(pathMap[file]); helper.registerLink(pathMap[file], url); try { data.docs = helper.htmlsafe(fs.readFileSync(file, encoding)); } catch (e) { logger.error('Unable to generate output for source file %s: %s', file, e.message); return; } self.generate('source', data, url); }, this);
item.type.names.forEach(function(name) { types.push( helper.linkto(name, helper.htmlsafe(name)) ); });
it('should convert all occurences of < to <', function() { var inp = '<h1>Potentially dangerous.</h1>', out = helper.htmlsafe(inp); expect(out).toBe('<h1>Potentially dangerous.</h1>'); });
it('should simply return the input string, HTML-safe, if no email is detected', function() { var str = 'John Doe <dummy>', out = helper.resolveAuthorLinks(str); expect(out).toBe(helper.htmlsafe(str)); });
it('should HTML-safe author names', function() { var str = ' John<Doe <*****@*****.**> ', out = helper.resolveAuthorLinks(str); expect(out).toBe('<a href="mailto:asdf.fdsa-2@gmail.com">' + helper.htmlsafe('John<Doe') + '</a>'); });