@adobe/helix-html-pipeline 6.28.2 → 6.28.4
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/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/html-pipe.js +1 -1
- package/src/steps/extract-section-metadata.js +32 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [6.28.4](https://github.com/adobe/helix-html-pipeline/compare/v6.28.3...v6.28.4) (2026-04-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* treat section metadata style values like block options ([#1071](https://github.com/adobe/helix-html-pipeline/issues/1071)) ([#1072](https://github.com/adobe/helix-html-pipeline/issues/1072)) ([f6594bc](https://github.com/adobe/helix-html-pipeline/commit/f6594bcc7eca53e3416f085c6599428122d281ca))
|
|
7
|
+
|
|
8
|
+
## [6.28.3](https://github.com/adobe/helix-html-pipeline/compare/v6.28.2...v6.28.3) (2026-04-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* support mixed and comma-separated section metadata values ([#1068](https://github.com/adobe/helix-html-pipeline/issues/1068)) ([f18796b](https://github.com/adobe/helix-html-pipeline/commit/f18796b6a6fc03eda3ac9b0a9df86c0b8e590ea1))
|
|
14
|
+
|
|
1
15
|
## [6.28.2](https://github.com/adobe/helix-html-pipeline/compare/v6.28.1...v6.28.2) (2026-04-09)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "6.28.
|
|
3
|
+
"version": "6.28.4",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"esmock": "2.7.3",
|
|
85
85
|
"husky": "9.1.7",
|
|
86
86
|
"js-yaml": "4.1.1",
|
|
87
|
-
"jsdom": "
|
|
87
|
+
"jsdom": "29.0.1",
|
|
88
88
|
"junit-report-builder": "5.1.1",
|
|
89
89
|
"lint-staged": "16.4.0",
|
|
90
90
|
"mocha": "11.7.5",
|
package/src/html-pipe.js
CHANGED
|
@@ -168,8 +168,8 @@ export async function htmlPipe(state, req) {
|
|
|
168
168
|
await rewriteUrls(state);
|
|
169
169
|
await fixSections(state);
|
|
170
170
|
await createPageBlocks(state);
|
|
171
|
-
await extractSectionMetadata(state);
|
|
172
171
|
await createPictures(state);
|
|
172
|
+
await extractSectionMetadata(state);
|
|
173
173
|
await extractMetaData(state, req);
|
|
174
174
|
await rewriteIcons(state);
|
|
175
175
|
await addHeadingIds(state);
|
|
@@ -30,28 +30,49 @@ function isSectionMetadataEnabled(config) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Extracts a value from a HAST node by
|
|
34
|
-
*
|
|
33
|
+
* Extracts a value from a HAST node by collecting image srcs, link hrefs,
|
|
34
|
+
* and text tokens (split by comma/whitespace).
|
|
35
35
|
* @param {object} $value the HAST value node
|
|
36
36
|
* @returns {string} the extracted value
|
|
37
37
|
*/
|
|
38
38
|
function getValueFromNode($value) {
|
|
39
|
-
const
|
|
39
|
+
const items = [];
|
|
40
40
|
visit($value, (node) => {
|
|
41
41
|
if (node.tagName === 'img' && node.properties?.src) {
|
|
42
|
-
|
|
42
|
+
items.push(node.properties.src);
|
|
43
43
|
return SKIP;
|
|
44
44
|
}
|
|
45
45
|
if (node.tagName === 'a' && node.properties?.href) {
|
|
46
|
-
|
|
46
|
+
items.push(node.properties.href);
|
|
47
47
|
return SKIP;
|
|
48
48
|
}
|
|
49
|
+
if (node.type === 'text') {
|
|
50
|
+
items.push(...node.value.trim().split(/[,\s]+/).filter(Boolean));
|
|
51
|
+
}
|
|
49
52
|
return CONTINUE;
|
|
50
53
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
return items.join(',');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Extracts style class names from a HAST node.
|
|
59
|
+
* Treats {@code <br>} and {@code <p>} boundaries as comma separators,
|
|
60
|
+
* then converts each segment to CSS class names via {@link toBlockCSSClassNames}.
|
|
61
|
+
* @param {object} $node the HAST node
|
|
62
|
+
* @returns {string[]} the extracted class names
|
|
63
|
+
*/
|
|
64
|
+
function getStyleClassNames($node) {
|
|
65
|
+
const parts = [];
|
|
66
|
+
visit($node, (node) => {
|
|
67
|
+
if (node.tagName === 'br') {
|
|
68
|
+
return SKIP;
|
|
69
|
+
}
|
|
70
|
+
if (node.type === 'text') {
|
|
71
|
+
parts.push(...node.value.split(','));
|
|
72
|
+
}
|
|
73
|
+
return CONTINUE;
|
|
74
|
+
});
|
|
75
|
+
return parts.flatMap(toBlockCSSClassNames);
|
|
55
76
|
}
|
|
56
77
|
|
|
57
78
|
/**
|
|
@@ -78,15 +99,13 @@ export default function extractSectionMetadata(state) {
|
|
|
78
99
|
const [$name, $value] = $row.children;
|
|
79
100
|
const name = toMetaName(toString($name));
|
|
80
101
|
if (name) {
|
|
81
|
-
const value = getValueFromNode($value);
|
|
82
102
|
if (name === 'style') {
|
|
83
103
|
if (!parent.properties.className) {
|
|
84
104
|
parent.properties.className = [];
|
|
85
105
|
}
|
|
86
|
-
parent.properties.className.push(
|
|
87
|
-
...value.split(/[,\s]+/).filter(Boolean).flatMap(toBlockCSSClassNames),
|
|
88
|
-
);
|
|
106
|
+
parent.properties.className.push(...getStyleClassNames($value));
|
|
89
107
|
} else {
|
|
108
|
+
const value = getValueFromNode($value);
|
|
90
109
|
parent.properties[`data-${name}`] = value;
|
|
91
110
|
}
|
|
92
111
|
}
|