fix: python scripts now work

This commit is contained in:
2026-02-23 21:22:15 +01:00
parent 7213b64913
commit e68e845e70
4 changed files with 159 additions and 4 deletions

View File

@@ -181,7 +181,16 @@ _entrypoint = __bds_transform_entrypoint
_transform_fn = globals().get(_entrypoint)
if _transform_fn is None or not callable(_transform_fn):
raise RuntimeError(f"Transform entrypoint '{_entrypoint}' is not callable")
_result = _transform_fn(_payload)
_post = _payload.get("post")
if not isinstance(_post, dict):
raise RuntimeError("Transform payload is missing a valid 'post' object")
_context = _payload.get("context")
try:
_result = _transform_fn(_post, _context)
except TypeError:
_result = _transform_fn(_post)
if _result is None:
_result = _post
json.dumps(_result)
`);

View File

@@ -88,6 +88,8 @@ export const DocumentationView: React.FC = () => {
const { t: tr } = useI18n();
const { picoTheme } = useAppStore();
const resolvedTheme = getRendererPicoTheme(picoTheme);
const CODE_COPY_DEFAULT_ICON = '\u29c9';
const CODE_COPY_SUCCESS_ICON = '\u2713';
const scrollContainerRef = useRef<HTMLElement | null>(null);
const articleRef = useRef<HTMLElement | null>(null);
const headingSlugCounts = new Map<string, number>();
@@ -217,9 +219,9 @@ export const DocumentationView: React.FC = () => {
wrapper?.classList.add('code-copy-success');
if (icon) {
icon.textContent = '✓';
icon.textContent = CODE_COPY_SUCCESS_ICON;
setTimeout(() => {
icon.textContent = '⧉';
icon.textContent = CODE_COPY_DEFAULT_ICON;
wrapper?.classList.remove('code-copy-success');
}, 1200);
}
@@ -234,7 +236,7 @@ export const DocumentationView: React.FC = () => {
});
}}
>
<span className="code-copy-icon"></span>
<span className="code-copy-icon">{CODE_COPY_DEFAULT_ICON}</span>
</button>
<pre>
<code