def test_get_files_by_pattern(self): build_info = BuildInfo(files={ "file1.html": "file1", "file2.css": "file2", }) assert list(build_info.get_files_by_pattern("*.css")) == [ ("file2.css", "file2"), ]
def build(self, build_info: BuildInfo): for file_name, file_info in build_info.get_files_by_pattern( self._match_pattern): try: permalink = self._permalink_selector(file_info) except Exception: continue if permalink.startswith("/"): permalink = permalink[1:] if permalink.endswith("/") or permalink == "": permalink += "index.html" build_info.rename_file(file_name, permalink)