Something went wrong. Try again.
A projectional editor that uses textual code as its source of truth. puredit.korz.dev
svelte dsl
Something went wrong. Try again.
872 B · 25 lines
TypeScript
at main
1234567891011121314151617181920212223242526import { arg, contextVariable } from "@puredit/parser";import { svelteProjection } from "@puredit/projections/svelte";import type { Projection } from "@puredit/projections/types";import { pythonParser } from "./parser";import ReplaceProjection from "./ReplaceProjection.svelte";
const table = contextVariable("table");const column = arg("column", "string");const target = arg("target", "string");const replacement = arg("replacement", "string");
export const [pattern, draft] = pythonParser.statementPattern`${table}.column(${column}).replace(${target}, ${replacement})`;
export const widget = svelteProjection(ReplaceProjection);
export const replaceProjection: Projection = { name: "replace text in column", description: "Replaces all occurences of a text in a column", pattern, draft, requiredContextVariables: ["table"], widgets: [widget],};