LeaVerou / brep

Write batch find & replace scripts that transform files with a simple human-readable syntax
12 stars 0 forks source link

Second stab at #6 #7

Closed DmitrySharabin closed 2 months ago

DmitrySharabin commented 2 months ago

Tests

files: "papers/foo/bar.tex"
path: ".." # Resolves to papers/bar.tex
replace:
- ["{figure*}", "{figure}"]
files: "papers/foo/bar.tex"
path: "../../src" # Resolves to src/bar.tex
replace:
- ["{figure*}", "{figure}"]
files: "papers/foo/bar.tex"
path: "baz" # Resolves to papers/foo/baz/bar.tex
replace:
- ["{figure*}", "{figure}"]
files: "papers/foo/bar.tex"
path: "/baz" # Resolves to /baz/bar.tex
replace:
- ["{figure*}", "{figure}"]
LeaVerou commented 2 months ago

Can you turn these into actual tests? You can do that by converting the code that resolves the path to a util function.

DmitrySharabin commented 2 months ago

Can you turn these into actual tests? You can do that by converting the code that resolves the path to a util function.

Thank you for the idea! Done.