diff --git a/gen_redirects.py b/gen_redirects.py index f3fc8602..b9f8c534 100644 --- a/gen_redirects.py +++ b/gen_redirects.py @@ -21,21 +21,38 @@ def main(args: list[str]) -> int: dirs = dict[str, list[str]]() for key, value in data.items(): dir = posixpath.dirname(key) + ext = posixpath.splitext(key)[1] if dir in dirs: dirs[dir].append(key) else: dirs[dir] = [key] - content: list[Any] = config["build"]["content"] - content.append({"files": posixpath.relpath(key, "content"), "src": "content"}) os.makedirs(dir, exist_ok=True) - with open(key, mode="w", encoding="utf-8") as f: - f.write(f"""--- + if ext == ".md": + content: list[Any] = config["build"]["content"] + content.append({"files": posixpath.relpath(key, "content"), "src": "content"}) + with open(key, mode="w", encoding="utf-8") as f: + f.write(f"""--- redirect_url: {value} --- """) + elif ext == ".html": + resource: list[Any] = config["build"]["resource"] + resource.append({"files": posixpath.relpath(key, "content"), "src": "content"}) + with open(key, mode="w", encoding="utf-8") as f: + f.write(f""" + +
+ + + + +""") + else: + print("Unknown file type:", key, file=sys.stderr) for dir, files in dirs.items(): - with open(posixpath.join(dir, ".gitignore"), "w") as f: + with open(posixpath.join(dir, ".gitignore"), "a") as f: + f.write("\n") f.writelines("/" + posixpath.basename(file) + "\n" for file in files) f.write("/.gitignore\n") diff --git a/redirects.json b/redirects.json index e577f647..97dfb5af 100644 --- a/redirects.json +++ b/redirects.json @@ -29,13 +29,17 @@ "content/common/Semantic Model/direct-lake-sql-model.md": "/features/Semantic Model/direct-lake-sql-model.html", "content/common/Semantic Model/direct-query-over-as.md": "/features/Semantic Model/direct-query-over-as.html", "content/common/Semantic Model/semantic-model-types.md": "/features/Semantic Model/semantic-model-types.html", + "content/common/common-features.md": "/getting-started/Getting-Started-te2.html", "content/common/desktop-limitations.md": "/getting-started/desktop-limitations.html", "content/common/policies.md": "/references/policies.html", "content/common/save-to-folder.md": "/features/save-to-folder.html", "content/common/script-helper-methods.md": "/features/script-helper-methods.html", + "content/common/tmdl-common.md": "/features/tmdl.html", + "content/common/toc.html": "/index.html", "content/common/using-bpa-sample-rules-expressions.md": "/features/using-bpa-sample-rules-expressions.html", + "content/common/using-bpa.md": "/features/using-bpa.html", "content/common/xmla-as-connectivity.md": "/how-tos/xmla-as-connectivity.html", - "content/onboarding/as-cicd.md": "/todo/as-cicd.html", + "content/onboarding/as-cicd.md": "/getting-started/as-cicd.html", "content/onboarding/boosting-productivity-te3.md": "/getting-started/boosting-productivity-te3.html", "content/onboarding/bpa.md": "/getting-started/bpa.html", "content/onboarding/creating-and-testing-dax.md": "/getting-started/creating-and-testing-dax.html", @@ -48,31 +52,40 @@ "content/onboarding/migrate-from-desktop.md": "/getting-started/migrate-from-desktop.html", "content/onboarding/migrate-from-te2.md": "/getting-started/migrate-from-te2.html", "content/onboarding/migrate-from-vs.md": "/getting-started/migrate-from-vs.html", + "content/onboarding/optimizing-workflow-workspace-mode.md": "/getting-started/optimizing-workflow-workspace-mode.html", "content/onboarding/parallel-development.md": "/getting-started/parallel-development.html", "content/onboarding/personalizing-te3.md": "/getting-started/personalizing-te3.html", - "content/onboarding/powerbi-cicd.md": "/todo/powerbi-cicd.html", + "content/onboarding/powerbi-cicd.md": "/getting-started/powerbi-cicd.html", "content/onboarding/refresh-preview-query.md": "/getting-started/refresh-preview-query.html", + "content/onboarding/toc.html": "/getting-started/toc.html", "content/te2/Advanced-Filtering-of-the-Explorer-Tree.md": "/how-tos/Advanced-Filtering-of-the-Explorer-Tree.html", "content/te2/Advanced-Scripting.md": "/how-tos/Advanced-Scripting.html", + "content/te2/Advanced-features.md": "/getting-started/Getting-Started-te2.html", "content/te2/Best-Practice-Analyzer-Improvements.md": "/features/Best-Practice-Analyzer.html", + "content/te2/Best-Practice-Analyzer.md": "/features/Best-Practice-Analyzer.html", "content/te2/Command-line-Options.md": "/features/Command-line-Options.html", "content/te2/Custom-Actions.md": "/features/Custom-Actions-hidden.html", "content/te2/FAQ.md": "/references/FAQ.html", + "content/te2/Features-at-a-glance.md": "/getting-started/Getting-Started-te2.html", "content/te2/FormatDax.md": "/references/FormatDax.html", "content/te2/Getting-Started.md": "/getting-started/Getting-Started-te2.html", "content/te2/Importing-Tables.md": "/how-tos/Importing-Tables.html", "content/te2/Keyboard-Shortcuts.md": "/references/Keyboard-Shortcuts2.html", - "content/te2/Maintaining-Calculations-using-Scripting.md": "/todo/Maintaining-Calculations-using-Scripting.html", "content/te2/Master-model-pattern.md": "/how-tos/Master-model-pattern.html", + "content/te2/Power-BI-Desktop-Integration.md": "/getting-started/Power-BI-Desktop-Integration.html", "content/te2/Roadmap.md": "/references/Roadmap2-h.html", "content/te2/SQL-Server-2017-support.md": "/references/SQL-Server-2017-support-h.html", "content/te2/TabularEditor.TOMWrapper.md": "/references/TabularEditor.TOMWrapper-h.html", + "content/te2/Training-Webinar-for-Tabular-Editor.md": "/getting-started/Training-Webinar-for-Tabular-Editor.html", "content/te2/Useful-script-snippets.md": "/features/Useful-script-snippets.html", "content/te2/Workspace-Database.md": "/features/Workspace-Database.html", "content/te2/gdpr-delete.md": "/security/gdpr-delete.html", "content/te2/importing-tables-from-excel.md": "/how-tos/importing-tables-from-excel.html", "content/te2/incremental-refresh.md": "/how-tos/incremental-refresh2-h.html", + "content/te2/privacy-policy.md": "/security/privacy-policy.html", + "content/te2/toc.html": "/getting-started/Getting-Started-te2.html", "content/te3/azure-marketplace.md": "/getting-started/azure-marketplace.html", + "content/te3/desktop-limitations.md": "/getting-started/desktop-limitations.html", "content/te3/editions.md": "/getting-started/editions.html", "content/te3/features/code-actions.md": "/features/code-actions.html", "content/te3/features/csharp-scripts.md": "/features/csharp-scripts.html", @@ -174,10 +187,12 @@ "content/te3/other/release-notes/beta-18_4.md": "/references/release-notes/beta-18_4.html", "content/te3/other/release-notes/beta-18_5.md": "/references/release-notes/beta-18_5.html", "content/te3/other/roadmap.md": "/references/roadmap.html", + "content/te3/other/te3-eula.md": "/security/te3-eula.html", "content/te3/other/third-party-notices.md": "/security/third-party-notices.html", "content/te3/powerbi-xmla-pbix-workaround.md": "/how-tos/powerbi-xmla-pbix-workaround.html", "content/te3/powerbi-xmla.md": "/tutorials/powerbi-xmla.html", "content/te3/proxy-settings.md": "/troubleshooting/proxy-settings.html", + "content/te3/toc.html": "/index.html", "content/te3/troubleshooting/calendar-blank-value.md": "/troubleshooting/calendar-blank-value.html", "content/te3/troubleshooting/direct-lake-entity-updates-reverting.md": "/troubleshooting/direct-lake-entity-updates-reverting.html", "content/te3/troubleshooting/locale-not-supported.md": "/troubleshooting/locale-not-supported.html", @@ -189,6 +204,7 @@ "content/te3/tutorials/data-security/data-security-setup-rls.md": "/tutorials/data-security/data-security-setup-rls.html", "content/te3/tutorials/data-security/data-security-testing.md": "/tutorials/data-security/data-security-testing.html", "content/te3/tutorials/direct-lake-guidance.md": "/tutorials/direct-lake-guidance.html", + "content/te3/tutorials/importing-tables.md": "/tutorials/importing-tables.html", "content/te3/tutorials/incremental-refresh/incremental-refresh-about.md": "/tutorials/incremental-refresh/incremental-refresh-about.html", "content/te3/tutorials/incremental-refresh/incremental-refresh-modify.md": "/tutorials/incremental-refresh/incremental-refresh-modify.html", "content/te3/tutorials/incremental-refresh/incremental-refresh-schema.md": "/tutorials/incremental-refresh/incremental-refresh-schema.html", @@ -197,6 +213,8 @@ "content/te3/tutorials/new-as-model.md": "/tutorials/new-as-model.html", "content/te3/tutorials/new-pbi-model.md": "/tutorials/new-pbi-model.html", "content/te3/tutorials/udfs.md": "/tutorials/udfs.html", + "content/te3/tutorials/workspace-mode.md": "/tutorials/workspace-mode.html", + "content/te3/views/bpa-view.md": "/features/views/bpa-view.html", "content/te3/views/data-refresh-view.md": "/features/views/data-refresh-view.html", "content/te3/views/find-replace.md": "/features/views/find-replace.html", "content/te3/views/macros-view.md": "/features/views/macros-view.html",