use a new replacement method for dynamic resource URLs

update tests
fixes #41