@riebeckite/plugin-webmention 0.0.16 → 0.0.17
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.js +18 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
// index.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
appendContentBodySlot,
|
|
4
|
+
createStyleAsset,
|
|
5
|
+
definePlugin
|
|
6
|
+
} from "@riebeckite/core";
|
|
3
7
|
|
|
4
8
|
// src/provider.ts
|
|
5
9
|
var WEBMENTION_CAPABILITIES = ["store", "query"];
|
|
@@ -107,6 +111,7 @@ function entryPublicUrl(entry, config) {
|
|
|
107
111
|
function findTargetEntry(manifest, config, target) {
|
|
108
112
|
const key = urlComparisonKey(target);
|
|
109
113
|
for (const entry of manifest.entries) {
|
|
114
|
+
if (!entry.publishing.routable) continue;
|
|
110
115
|
const publicUrl = entryPublicUrl(entry, config);
|
|
111
116
|
if (publicUrl !== null && urlComparisonKey(publicUrl) === key) return entry;
|
|
112
117
|
}
|
|
@@ -1012,6 +1017,7 @@ function groupMentionsBySlug(manifest, config, mentions) {
|
|
|
1012
1017
|
}
|
|
1013
1018
|
const grouped = /* @__PURE__ */ new Map();
|
|
1014
1019
|
for (const entry of manifest.entries) {
|
|
1020
|
+
if (!entry.publishing.routable) continue;
|
|
1015
1021
|
const target = entryPublicUrl(entry, config);
|
|
1016
1022
|
if (target === null) continue;
|
|
1017
1023
|
const list = byTarget.get(urlComparisonKey(target));
|
|
@@ -1077,13 +1083,15 @@ function webmention(options = {}) {
|
|
|
1077
1083
|
);
|
|
1078
1084
|
for (const [slug, list] of grouped) {
|
|
1079
1085
|
const entry = context.manifest.bySlug.get(slug);
|
|
1080
|
-
if (!entry
|
|
1086
|
+
if (!entry) continue;
|
|
1081
1087
|
const section = renderWebmentionSection(
|
|
1082
1088
|
list.slice(0, resolved.limit),
|
|
1083
1089
|
resolved
|
|
1084
1090
|
);
|
|
1085
1091
|
if (section === "") continue;
|
|
1086
|
-
entry.
|
|
1092
|
+
if (!hasSlotFragment(entry.bodySlots?.["article.footer"], section)) {
|
|
1093
|
+
appendContentBodySlot(entry, "article.footer", section);
|
|
1094
|
+
}
|
|
1087
1095
|
}
|
|
1088
1096
|
const unmatched = countUnmatchedMentions(
|
|
1089
1097
|
context.manifest,
|
|
@@ -1104,6 +1112,13 @@ function webmention(options = {}) {
|
|
|
1104
1112
|
addDiagnostics: () => buildWebmentionDiagnostics(provider, resolved)
|
|
1105
1113
|
});
|
|
1106
1114
|
}
|
|
1115
|
+
function hasSlotFragment(slot, fragment) {
|
|
1116
|
+
return slot === fragment || slot?.startsWith(`${fragment}
|
|
1117
|
+
`) || slot?.endsWith(`
|
|
1118
|
+
${fragment}`) || slot?.includes(`
|
|
1119
|
+
${fragment}
|
|
1120
|
+
`) || false;
|
|
1121
|
+
}
|
|
1107
1122
|
export {
|
|
1108
1123
|
DEFAULT_WEBMENTION_CLASS_NAME,
|
|
1109
1124
|
DEFAULT_WEBMENTION_ENDPOINT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-webmention",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"./style.css": "./style.css"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@riebeckite/core": "0.0.
|
|
18
|
+
"@riebeckite/core": "0.0.17"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tsx": "^4.22.4"
|