@c-rex/utils 0.3.0-build.32 → 0.3.0-build.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1745,20 +1745,21 @@ var parseHtmlContent = (html) => {
|
|
|
1745
1745
|
const content = $(el).attr("content");
|
|
1746
1746
|
return name && content ? { name, content } : null;
|
|
1747
1747
|
}).get().filter((tag) => tag !== null);
|
|
1748
|
-
const articleHtml = $("main").html() || "";
|
|
1748
|
+
const articleHtml = $("main").html() || $("article").html() || $("body").html() || $.root().html() || "";
|
|
1749
1749
|
return {
|
|
1750
1750
|
articleHtml,
|
|
1751
1751
|
metaTags
|
|
1752
1752
|
};
|
|
1753
1753
|
};
|
|
1754
1754
|
var getHtmlRenditionViewUrl = (renditions, htmlFormats = ["application/xhtml+xml", "application/html", "text/html"]) => {
|
|
1755
|
-
|
|
1756
|
-
const htmlRendition = renditions.find((rendition) => {
|
|
1757
|
-
return !!rendition.format && htmlFormats.includes(rendition.format);
|
|
1758
|
-
});
|
|
1755
|
+
const htmlRendition = getHtmlRendition(renditions, htmlFormats);
|
|
1759
1756
|
const href = htmlRendition?.links?.find((link) => link.rel === "view")?.href;
|
|
1760
1757
|
return href ?? void 0;
|
|
1761
1758
|
};
|
|
1759
|
+
var getHtmlRendition = (renditions, htmlFormats = ["application/xhtml+xml", "application/html", "text/html"]) => {
|
|
1760
|
+
if (!renditions || renditions.length === 0) return void 0;
|
|
1761
|
+
return renditions.find((rendition) => !!rendition.format && htmlFormats.includes(rendition.format));
|
|
1762
|
+
};
|
|
1762
1763
|
var metaTagsToMetadata = (metaTags) => {
|
|
1763
1764
|
const description = metaTags.find((metaTag) => metaTag.name === "description")?.content;
|
|
1764
1765
|
const keywordsRaw = metaTags.find((metaTag) => metaTag.name === "keywords")?.content;
|
|
@@ -1812,6 +1813,7 @@ export {
|
|
|
1812
1813
|
getCountryCodeByLang,
|
|
1813
1814
|
getFileRenditionGroups,
|
|
1814
1815
|
getFileRenditions,
|
|
1816
|
+
getHtmlRendition,
|
|
1815
1817
|
getHtmlRenditionViewUrl,
|
|
1816
1818
|
getLabelByLang,
|
|
1817
1819
|
getLanguage,
|