Repository navigation
feat(converter): hand-port export files, add CodeBlock rule, and strip export const - #8445
Conversation
…p export const Part of #8304 Signed-off-by: PARTH-TUSSLE <parthgartan26feb@gmail.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
miacycle
left a comment
There was a problem hiding this comment.
Nice work on this hand-port, the scope is clear and the new coverage is solid. I ran the converter suites at this head and all 67 tests pass (56 migrate-mdx, 8 bench-time, 3 verify-urls). The YAML keys line up with the new partials: badges has activity/projects/specials with name, image and description, faq has question/answer, and mentorship programs has name, description, buttonLink, image and imagePosition. Two things need attention before this lands, both called out inline below.
First, hugo/data/handbook/repository_overview.yaml does not parse: eight unquoted accessRequired: *... values are read as YAML aliases with no matching anchor, so the whole file fails to load and site.Data.handbook.repository_overview is unavailable. Quoting the values fixes it.
Second, the new logo shortcodes point at SVGs that are not under hugo/static: lfx-white.svg, Linux_Foundation_logo.svg, sca-dark.svg and sca.svg live only under src/collections/programs/..., and long-arrow.svg only under src/sections/Community/Newcomers-guide/. With relURL those will 404 unless the assets are copied into hugo/static or the converter copies them. Is that copy part of a follow-up PR, or should it ride along here?
One more note: the accessRequired field is not rendered by the new repository-overview partial, so dropping it is also an option if the source data does not need it preserved.
On tests and docs: the converter change ships with tests and they pass, so the test side of the gate is covered. No separate docs update looks needed for this website-side change.
| - "https://layer5.io/community/members/aabid-sofi" | ||
| description: A collaborative, visual topology to design and operate cloud native infrastructure. | ||
| repository: "https://github.com/layer5labs/meshery-extensions" | ||
| accessRequired: *program participation required |
There was a problem hiding this comment.
This value breaks the whole data file: *program parses as a YAML alias with no matching anchor, so repository_overview.yaml fails to load and site.Data.handbook.repository_overview is unavailable. The same unquoted *... value appears on lines 108, 269, 306, 506, 516, 526, and 536. Quoting fixes it:
| accessRequired: *program participation required | |
| accessRequired: "*program participation required" |
| let j = m.index + m[0].length; | ||
| let depth = 0, q = null, inLineComment = false, inBlockComment = false; | ||
| while (j < text.length) { | ||
| const c = text[j], next = text[j + 1]; | ||
| if (inLineComment) { if (c === '\n') inLineComment = false; j++; continue; } | ||
| if (inBlockComment) { if (c === '*' && next === '/') { inBlockComment = false; j += 2; continue; } j++; continue; } | ||
| if (q) { if (c === '\\') { j += 2; continue; } if (c === q) { q = null; } j++; continue; } | ||
| if (c === '/' && next === '/') { inLineComment = true; j += 2; continue; } | ||
| if (c === '/' && next === '*') { inBlockComment = true; j += 2; continue; } | ||
| if (c === '"' || c === "'" || c === '`') { q = c; j++; continue; } | ||
| if (c === '{' || c === '[' || c === '(') { depth++; j++; continue; } | ||
| if (c === '}' || c === ']' || c === ')') { if (depth > 0) depth--; j++; continue; } | ||
| if (c === ';' && depth === 0) { | ||
| j++; | ||
| while (j < text.length && (text[j] === ' ' || text[j] === '\t')) j++; | ||
| if (j < text.length && text[j] === '\r') j++; | ||
| if (j < text.length && text[j] === '\n') j++; | ||
| break; | ||
| } | ||
| j++; | ||
| } | ||
| if (ctx?.count) ctx.count('exportsRemoved'); | ||
| i = j; |
There was a problem hiding this comment.
Verified locally: when an export const has no terminating ;, the scan runs to end of text and everything after the export is silently dropped (stripExportConst('export const data = programs_data\n\nContent...') returns ''). Guard the strip so an unterminated statement is left in place; convertBody already warns on leftover exports:
| let j = m.index + m[0].length; | |
| let depth = 0, q = null, inLineComment = false, inBlockComment = false; | |
| while (j < text.length) { | |
| const c = text[j], next = text[j + 1]; | |
| if (inLineComment) { if (c === '\n') inLineComment = false; j++; continue; } | |
| if (inBlockComment) { if (c === '*' && next === '/') { inBlockComment = false; j += 2; continue; } j++; continue; } | |
| if (q) { if (c === '\\') { j += 2; continue; } if (c === q) { q = null; } j++; continue; } | |
| if (c === '/' && next === '/') { inLineComment = true; j += 2; continue; } | |
| if (c === '/' && next === '*') { inBlockComment = true; j += 2; continue; } | |
| if (c === '"' || c === "'" || c === '`') { q = c; j++; continue; } | |
| if (c === '{' || c === '[' || c === '(') { depth++; j++; continue; } | |
| if (c === '}' || c === ']' || c === ')') { if (depth > 0) depth--; j++; continue; } | |
| if (c === ';' && depth === 0) { | |
| j++; | |
| while (j < text.length && (text[j] === ' ' || text[j] === '\t')) j++; | |
| if (j < text.length && text[j] === '\r') j++; | |
| if (j < text.length && text[j] === '\n') j++; | |
| break; | |
| } | |
| j++; | |
| } | |
| if (ctx?.count) ctx.count('exportsRemoved'); | |
| i = j; | |
| let j = m.index + m[0].length; | |
| let depth = 0, q = null, inLineComment = false, inBlockComment = false; | |
| let terminated = false; | |
| while (j < text.length) { | |
| const c = text[j], next = text[j + 1]; | |
| if (inLineComment) { if (c === '\n') inLineComment = false; j++; continue; } | |
| if (inBlockComment) { if (c === '*' && next === '/') { inBlockComment = false; j += 2; continue; } j++; continue; } | |
| if (q) { if (c === '\\') { j += 2; continue; } if (c === q) { q = null; } j++; continue; } | |
| if (c === '/' && next === '/') { inLineComment = true; j += 2; continue; } | |
| if (c === '/' && next === '*') { inBlockComment = true; j += 2; continue; } | |
| if (c === '"' || c === "'" || c === '`') { q = c; j++; continue; } | |
| if (c === '{' || c === '[' || c === '(') { depth++; j++; continue; } | |
| if (c === '}' || c === ']' || c === ')') { if (depth > 0) depth--; j++; continue; } | |
| if (c === ';' && depth === 0) { | |
| j++; | |
| while (j < text.length && (text[j] === ' ' || text[j] === '\t')) j++; | |
| if (j < text.length && text[j] === '\r') j++; | |
| if (j < text.length && text[j] === '\n') j++; | |
| break; | |
| } | |
| j++; | |
| } | |
| if (!terminated) { | |
| // No terminator found: leave the statement in place instead of | |
| // dropping the rest of the file; convertBody already warns on | |
| // leftover `export` statements. | |
| out += text.slice(m.index); | |
| break; | |
| } | |
| if (ctx?.count) ctx.count('exportsRemoved'); | |
| i = j; |
|
This is a good item to add to the weekly Websites meeting agenda (meet.meshery.io/websites-minutes). You can add this item in the doc, attend, and present it. Meeting details can be found at https://meshery.io/calendar. |
…esolve shortcode svgs Part of #8304 Signed-off-by: PARTH-TUSSLE <parthgartan26feb@gmail.com>
|
Hugo preview removed because the pull request was closed. |
miacycle
left a comment
There was a problem hiding this comment.
Thanks, both items are fixed and verified: the eight unquoted accessRequired values in repository_overview.yaml are quoted now, and I confirmed the file parses; the logo SVGs live under hugo/static now and the shortcodes point at those paths, with a page-resource override kept. The unterminated export const guard is in place too, with a new test, and I ran the converter suites at this head: 68/68 pass. Checks are green.
I am leaving the merge for Mia's explicit call on this PR.
Description
This PR addresses PR A of issue #8304:
Part of #8304