@codedoc/core
Version:
Create beautiful modern documentation websites.
40 lines • 1.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.guessTitle = void 0;
function guessTitle(content, base, connector) {
if (connector === void 0) { connector = ' | '; }
var _loop_1 = function (i) {
var target$ = content.children.item(i);
if (target$ instanceof HTMLHeadingElement) {
var text_1 = '';
if (target$.childElementCount > 0) {
target$.childNodes.forEach(function (child) {
if (!(child instanceof HTMLElement && child.hasAttribute('data-ignore-text')))
text_1 += child.textContent || '';
});
}
else
text_1 = target$.textContent || '';
text_1 = text_1.trim();
if (base) {
if (text_1.length > 0)
return { value: base + connector + text_1 };
else
return { value: base };
}
else
return { value: text_1 };
}
if (!(target$ === null || target$ === void 0 ? void 0 : target$.textContent) || target$.textContent.trim().length === 0)
return "continue";
return { value: base || '' };
};
for (var i = 0; i < content.children.length; i++) {
var state_1 = _loop_1(i);
if (typeof state_1 === "object")
return state_1.value;
}
return base || '';
}
exports.guessTitle = guessTitle;
//# sourceMappingURL=guess-title.js.map