in functions/src/content.ts [232:281]
name: $(el).text(),
content: $sibchils.html()
});
});
return {
header,
sections
};
}
/**
* Get the base URL for a project on FirebaseOpenSource
* Ex: /projects/foo/bar/
*/
private getProjectBaseUrl(id: string) {
const idObj = Util.parseProjectId(id);
return `/projects/${idObj.owner}/${idObj.repo}/`;
}
/**
* Get the base github URL for a project.
*/
private getRenderedContentBaseUrl(id: string, branch: string) {
// Parse the ID into pieces
const idObj = Util.parseProjectId(id);
// Get the URL to the root folder
const pathPrefix = idObj.path ? idObj.path + "/" : "";
const url = `https://github.com/${idObj.owner}/${
idObj.repo
}/tree/${branch}/${pathPrefix}`;
return url;
}
/**
* Sanitize relative links to be absolute.
*/
private sanitizeRelativeLink(
el: CheerioElement,
attrName: string,
base: string
) {
const val = el.attribs[attrName];
if (val) {
const valUrl = url.parse(val);
if (this._isRelativeLink(val)) {