diff --git a/.github/workflows/build_offline_docs.yml b/.github/workflows/build_offline_docs.yml index fc47519c9eb..6fff01ce2b6 100644 --- a/.github/workflows/build_offline_docs.yml +++ b/.github/workflows/build_offline_docs.yml @@ -28,7 +28,7 @@ jobs: - name: Migrate to Redot run: | - python migrate.py . _migrated False + python migrate.py . _migrated - name: Sphinx - Build HTML run: make SPHINXOPTS='--color -j 4' SPHINXSOURCEDIR='./_migrated' html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e3ecbf9571..347815490da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: - name: Migrate to Redot run: | - python migrate.py . _migrated True + python migrate.py . _migrated # Use dummy builder to improve performance as we don't need the generated HTML in this workflow. - name: Sphinx build diff --git a/.github/workflows/sync_class_ref.yml b/.github/workflows/sync_class_ref.yml index 0bf4002fafc..5d7748f14ed 100644 --- a/.github/workflows/sync_class_ref.yml +++ b/.github/workflows/sync_class_ref.yml @@ -19,7 +19,10 @@ jobs: runs-on: ubuntu-latest env: engine_rev: 'master' - + permissions: + contents: write + pull-requests: write + steps: - name: Checkout the documentation repository uses: actions/checkout@v4 diff --git a/_extensions/gdscript.py b/_extensions/gdscript.py index 5da987c462f..6377683cbf7 100644 --- a/_extensions/gdscript.py +++ b/_extensions/gdscript.py @@ -5,7 +5,7 @@ Lexer for GDScript. - :copyright: Copyright 2xxx by The Godot Engine Community + :copyright: Copyright 2xxx by the Redot community, modified from an original work by the G-dot Engine Community :license: MIT. modified by Daniel J. Ramirez based on the original python.py pygment diff --git a/_extensions/godot_descriptions.py b/_extensions/godot_descriptions.py index a59cf3321b5..68f29e4c9ed 100644 --- a/_extensions/godot_descriptions.py +++ b/_extensions/godot_descriptions.py @@ -6,7 +6,7 @@ Sphinx extension to automatically generate HTML meta description tags for all pages. Also comes with some special support for Godot class docs. - :copyright: Copyright 2021 by The Godot Engine Community + :copyright: Copyright 2021 by the Redot community, modified from an original work by the G-dot Engine Community :license: MIT. based on the work of Takayuki Shimizukawa on OpenGraph support for Sphinx, diff --git a/_templates/versions.html b/_templates/versions.html index e46ca819a95..7adccecf2a0 100644 --- a/_templates/versions.html +++ b/_templates/versions.html @@ -34,24 +34,10 @@
{{ slug }}
{% endfor %} -
- {# Translators: The phrase "Read the Docs" is not translated #} -
{{ _('On Read the Docs') }}
-
- {{ _('Project Home') }} -
-
- {{ _('Builds') }} -
-
- {{ _('Downloads') }} -
-

Hosted by Read the Docs - ยท Privacy Policy diff --git a/about/complying_with_licenses.rst b/about/complying_with_licenses.rst index a3a51350ef8..57b3b0bb9be 100644 --- a/about/complying_with_licenses.rst +++ b/about/complying_with_licenses.rst @@ -46,7 +46,7 @@ This text reads as follows:: This game uses Godot Engine, available under the following license: - Copyright (c) 2014-present Godot Engine contributors. + Copyright (c) 2014-present the Redot community, modified from an original work by G-dot Engine contributors. Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/about/introduction.rst b/about/introduction.rst index f6db6b665cc..f11d871fe8a 100644 --- a/about/introduction.rst +++ b/about/introduction.rst @@ -37,8 +37,7 @@ is a great starting point. In case you have trouble with one of the tutorials or your project, you can find help on the various `Community channels `_, -especially the Godot `Discord `_ community and -`Forum `_. +especially the Godot `Discord `_ community. About Godot Engine ------------------ diff --git a/conf.py b/conf.py index 66acf3f531c..4ac076976d4 100644 --- a/conf.py +++ b/conf.py @@ -82,9 +82,9 @@ # General information about the project project = "Godot Engine" copyright = ( - "2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0)" + "2024-present by the Redot community, modified from an original work by Juan Linietsky, Ariel Manzur and the G-dot community (CC BY 3.0)" ) -author = "Juan Linietsky, Ariel Manzur and the Godot community" +author = "the Redot community, modified from an original work by Juan Linietsky, Ariel Manzur and the G-dot community" # Version info for the project, acts as replacement for |version| and |release| # The short X.Y version diff --git a/contributing/development/code_style_guidelines.rst b/contributing/development/code_style_guidelines.rst index 9b475cbbff6..210dd8c7b15 100644 --- a/contributing/development/code_style_guidelines.rst +++ b/contributing/development/code_style_guidelines.rst @@ -177,7 +177,8 @@ Example: /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ - /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ + /* Copyright (c) 2014-present the Redot community, modified from an */ + /* original work by G-dot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ @@ -222,7 +223,8 @@ Example: /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ - /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ + /* Copyright (c) 2014-present the Redot community, modified from an */ + /* original work by Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ diff --git a/contributing/development/handling_compatibility_breakages.rst b/contributing/development/handling_compatibility_breakages.rst index 3c2ed2e259f..da55a36d2e5 100644 --- a/contributing/development/handling_compatibility_breakages.rst +++ b/contributing/development/handling_compatibility_breakages.rst @@ -57,7 +57,8 @@ like ``core/math/a_star_grid_2d.compat.inc`` in this case: /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ - /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ + /* Copyright (c) 2014-present the Redot community, modified from an */ + /* original work by G-dot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 00000000000..919f365ee02 Binary files /dev/null and b/favicon.ico differ diff --git a/migrate.py b/migrate.py index aff9ff40979..6e8e348be5c 100644 --- a/migrate.py +++ b/migrate.py @@ -1,13 +1,21 @@ """ ## Migrate files from Godot to Redot -Usage (order is important): -py migrate.py [inputdir] [outputdir] [include unimplemented] +usage: Migrate [-h] [-e] [-t] [-v] input output -example: -py migrate.py . _migrated True +Simple file migrator. Uses str.replace to map from Godot to Redot. Also converts some filenames. -Will replace specific godot strings with redot. It tries to ignore external projects and other things that can't +positional arguments: + input Input directory relative to current + output Output directory relative to current + +options: + -h, --help show this help message and exit + -e, --extended Include unimplemented substitutions, don't use in production + -t, --tiny Exclude classes directory + -v, --verbose + +Will replace specific godot strings with redot. It tries to ignore external projects and other things that shouldn't change. A distinction is made between unimplemented instances of the godot keyword (for instance references to the main @@ -23,18 +31,23 @@ From there, the docs can be built in the normal way. """ +import argparse import fnmatch import os +import re from shutil import copyfile import shutil import sys import codecs from distutils.dir_util import copy_tree -encoding = 'utf-8' defaultInputDirectory = '.' defaultOutputDirectory = '_migrated' defaultIncludeUnimplemented = False +defaultIgnoreClasses = True +defaultVerbose = False + +encoding = 'utf-8' filename_masks = ['.rst', '.md'] # Mappings that will currently lead to nowhere. Can be treated as a todo list. @@ -49,11 +62,6 @@ ('https://hosted.weblate.org/projects/godot-engine/', 'https://hosted.weblate.org/projects/redot-engine/'), ('https://hosted.weblate.org/browse/godot-engine', 'https://hosted.weblate.org/browse/redot-engine'), ('https://repo1.maven.org/maven2/org/godotengine/godot/', 'https://repo1.maven.org/maven2/org/redot-engine/redot/'), - # Non existing internal urls - ('https://chat.godotengine.org/', 'https://chat.redotengine.org/'), - ('https://editor.godotengine.org', 'https://editor.redotengine.org'), - ('https://forum.godotengine.org/', 'https://forum.redotengine.org/'), - ('https://fund.godotengine.org', 'https://fund.redotengine.org'), # The following mappings probably require changes to the core engine ('GodotEngine.epub', 'RedotEngine.epub'), ('godotengine.org/license', 'redotengine.org/license'), @@ -72,7 +80,6 @@ ('Support/Godot/', 'Support/Redot/'), ('config/godot/', 'config/redot/'), ('share/godot/', 'share/redot/'), - (' godot_', ' redot_'), ('org.godotengine.Godot', 'org.redotengine.Redot'), ('godot-ios-plugins', 'redot-ios-plugins'), ('godot-syntax-themes', 'redot-syntax-themes'), @@ -124,13 +131,27 @@ # Mappings that should work on first migration mappings = [ + # These will have to change eventually. + ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-html-stable.zip', 'https://download.redotengine.org/docs/redot-docs-html-stable.zip'), + ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-html-master.zip', 'https://download.redotengine.org/docs/redot-docs-html-master.zip'), + ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-html-3.6.zip', 'https://download.redotengine.org/docs/redot-docs-html-3.6.zip'), + ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-epub-stable.zip', 'https://download.redotengine.org/docs/redot-docs-epub-stable.zip'), + ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-epub-master.zip', 'https://download.redotengine.org/docs/redot-docs-epub-master.zip'), + ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot-docs-epub-3.6.zip', 'https://download.redotengine.org/docs/redot-docs-epub-3.6.zip'), # Table breakers ('| ``"Please include this when reporting the bug on: https://github.com/godotengine/godot/issues"`` |', '| ``"Please include this when reporting the bug on: https://github.com/redot-engine/godot/issues"``|'), ('https://github.com/godotengine/godot/pull/40364>`_ for more. |', 'https://github.com/redot-engine/redot/pull/40364>`_ for more. |'), + # Non existing internal urls + ('https://chat.godotengine.org/', 'https://www.redotengine.org/'), + ('https://editor.godotengine.org', 'https://www.redotengine.org'), + ('https://forum.godotengine.org/', 'https://www.redotengine.org/'), + ('https://fund.godotengine.org', 'https://www.redotengine.org'), # Almost existing urls + ('https://docs.godotengine.org/', '/'), ('https://docs.godotengine.org', 'https://docs.redotengine.org'), ('https://godotengine.org', 'https://redotengine.org'), # Existing urls + ('https://godotengine.org/community', 'https://www.redot.org'), ('https://nightly.link/godotengine/godot-docs/workflows/build_offline_docs/master/godot', 'https://nightly.link/redot-engine/redot-docs/workflows/build_offline_docs/master/redot'), ('https://github.com/godotengine/godot-docs/issues', 'https://github.com/redot-engine/redot-docs/issues'), ('https://github.com/godotengine/godot/blob/master', 'https://github.com/redot-engine/redot/blob/master'), @@ -141,9 +162,10 @@ ('https://github.com/godotengine/godot-proposals', 'https://github.com/redot-engine/redot-proposals'), ('https://raw.githubusercontent.com/godotengine/godot-docs', 'https://raw.githubusercontent.com/redot-engine/redot-docs'), ('https://github.com/godotengine/', 'https://github.com/redot-engine/'), - ('https://chat.godotengine.org/', 'https://discord.gg/a53QyHJZ'), + ('https://chat.godotengine.org/', 'https://discord.gg/redot'), # Generic replacements ('GODOT_COPYRIGHT.txt', 'REDOT_COPYRIGHT.txt'), + ('godotengine.org', 'redotengine.org'), ('godot-docs', 'redot-docs'), ('GODOT ENGINE', 'REDOT ENGINE'), ('/bin/godot', '/bin/redot'), @@ -178,6 +200,16 @@ ('godot.html', 'redot.html'), ('by-godot', 'by-redot'), ('MadeWithGodot', 'MadeWithRedot'), + (' if on_rtd else "(DEV) "', ''), + (' Read the Docs', ' Versions'), + ("const homeUrl = baseUrl.split('/latest/')[0] + '/stable/';", "const homeUrl = 'https://docs-stable.redotengine.org/';"), + ('{% set listed_languages = ({"en":"#", "de":"#", "es":"#", "fr":"#"}).items() -%}', '{% set listed_languages = ({"en":"#"}).items() -%}'), + ('({"stable":"#", "latest":"#"})', '({"stable":"https://docs-stable.redotengine.org/", "latest":"https://docs-latest.redotengine.org/", "3.6":"https://docs-3-6.redotengine.org/"})'), + ('Hosted by Read the Docs', 'Hosted by CloudFlare'), + ('Privacy Policy', ''), + ('G-dot', 'Godot'), + (' godot_', ' redot_'), + ('class_godotsharp', 'class_redotsharp'), ] filename_mappings = [ @@ -214,6 +246,13 @@ def is_target(filename): return any(filename.lower().endswith(m) for m in filename_masks) +def ensureDirExists(outputName): + dirname = os.path.dirname(outputName) + try: + os.makedirs(dirname) + except FileExistsError: + pass + def generateOutputName(root, fileName, outputDirectory): on = os.path.join('.', outputDirectory, root, fileName) on = convertContent(on, filename_mappings) @@ -227,25 +266,18 @@ def convertContent(content, mappings): content = content.replace(search, replace) return content -def ensureDirExists(outputName): - dirname = os.path.dirname(outputName) - try: - os.makedirs(dirname) - except FileExistsError: - pass - -def copyFile(root, filename, outputDirectory): +def copyFile(root, filename, outputDirectory, verbose): inputName = os.path.join(root, filename) outputName = generateOutputName(root, inputName.replace('.\\', '').replace('./', ''), outputDirectory) - print(f'Copying "{inputName}" to "{outputName}"') + if verbose: print(f'Copying "{inputName}" to "{outputName}"') shutil.copyfile(inputName, outputName) -def convertFile(root, filename, outputDirectory, includeUnimplemented): +def convertFile(root, filename, outputDirectory, includeUnimplemented, verbose): inputName = os.path.join(root, filename) outputName = generateOutputName(root, filename, outputDirectory) - print(f'Converting "{inputName}" to "{outputName}"') + if verbose: print(f'Converting "{inputName}" to "{outputName}"') with open(inputName, mode = 'r', encoding = encoding) as input: data = input.read() @@ -256,63 +288,94 @@ def convertFile(root, filename, outputDirectory, includeUnimplemented): with open(outputName, mode = 'w', encoding = encoding) as output: output.write(data) -def copyGlobalDir(inputDirectory, inputMask, outputDirectory): +def copyGlobalDir(inputDirectory, inputMask, outputDirectory, verbose): for root, dirs, files in os.walk(inputDirectory): if (inputMask in root and outputDirectory not in root): for f in files: inputName = os.path.join(root, f) outputName = generateOutputName(root, f, outputDirectory) ensureDirExists(outputName) - print(f"Copying {inputName} to {outputName}") + if verbose: print(f"Copying {inputName} to {outputName}") copyfile(inputName, outputName) -def convertStaticDir(inputDirectory, outputDirectory): +def convertStaticDir(inputDirectory, outputDirectory, verbose): for root, dirs, files in os.walk(inputDirectory): if (outputDirectory not in root and '__' not in root): for f in files: if (f.split('.')[1] in alphanumeric): - convertFile(root, f, outputDirectory, True) + convertFile(root, f, outputDirectory, True, verbose) else: - copyFile(root, f, outputDirectory) + copyFile(root, f, outputDirectory, verbose) -def migrate(inputDirectory, outputDirectory, includeUnimplemented): +def migrate(inputDirectory, outputDirectory, includeUnimplemented, ignoreClasses, verbose): outputsig = os.path.join('.', outputDirectory) for root, dirs, files in os.walk(inputDirectory): # ignore output path if (root.startswith(outputsig)): continue + if (ignoreClasses and 'classes' in root): + continue + items = filter(is_target, files) for item in items: - convertFile(root, item, outputDirectory, includeUnimplemented) - -inputDir = defaultInputDirectory -outputDir = defaultOutputDirectory -includeUnimplemented = defaultIncludeUnimplemented -if (len(sys.argv) > 1): - inputDir = sys.argv[1] -if (len(sys.argv) > 2): - outputDir = sys.argv[2] -if (len(sys.argv) > 3): - includeUnimplemented = sys.argv[3] - -print(f"Simple rst migrator. Uses str.replace to map from Godot to Redot.") -print(f"Usage: py migrate.py [inputDir] [outputDir] [includeUnimplemented], example: py migrate.py . _mymigration True") -print(f"Author: @Craptain on X") -print(f"Input directory: {inputDir}, output directory: {outputDir}, include unimplemented: {includeUnimplemented}") - -migrate(inputDir, outputDir, includeUnimplemented) - -print("Copying config files...") -convertFile(inputDir, 'conf.py', outputDir, includeUnimplemented) -convertFile(inputDir, 'robots.txt', outputDir, includeUnimplemented) -print("Copying static directories...") - -for dir in static_dirs: - if ('**' in dir): - print(f"Copying dirs with mask {dir}") - copyGlobalDir(inputDir, dir.split('/')[1], outputDir) + convertFile(root, item, outputDirectory, includeUnimplemented, verbose) + +def main(): + inputDir = defaultInputDirectory + outputDir = defaultOutputDirectory + includeUnimplemented = defaultIncludeUnimplemented + ignoreClasses = defaultIgnoreClasses + verbose = defaultVerbose + + parser = argparse.ArgumentParser( + prog='Migrate', + description='Simple file migrator. Uses str.replace to map from Godot to Redot. Also converts some filenames.', + epilog='Done. Made by @Craptain') + + parser.add_argument('input', help='Input directory relative to current') + parser.add_argument('output', help='Output directory relative to current') + parser.add_argument('-e', '--extended', action='store_true', help='Include unimplemented substitutions, don\'t use in production') + parser.add_argument('-t', '--tiny', action='store_true', help='Exclude classes directory') + parser.add_argument('-v', '--verbose', action='store_true') + + args = parser.parse_args() + verbose = args.verbose + if (verbose): + print("arguments:") + print(args) + + inputDir = args.input + if (args.output != '.' and not args.output.startswith('/')): + outputDir = args.output else: - print(f"Converting dir {dir}") - convertStaticDir(dir, outputDir) -print("Done") + print("output can't be . or start with /") + exit(1) + includeUnimplemented = args.extended + ignoreClasses = args.tiny + + if (os.path.exists(outputDir)): + print(f"Deleting {outputDir}") + shutil.rmtree(outputDir) + + print("Migrating...") + migrate(inputDir, outputDir, includeUnimplemented, ignoreClasses, verbose) + + print("Copying config files...") + convertFile(inputDir, 'conf.py', outputDir, includeUnimplemented, verbose) + convertFile(inputDir, 'robots.txt', outputDir, includeUnimplemented, verbose) + copyFile(inputDir, 'favicon.ico', outputDir, verbose) + + print("Copying static directories...") + for dir in static_dirs: + if ('**' in dir): + if verbose: print(f"Copying dirs with mask {dir}") + copyGlobalDir(inputDir, dir.split('/')[1], outputDir, verbose) + else: + if verbose: print(f"Converting dir {dir}") + convertStaticDir(dir, outputDir, verbose) + + print(parser.epilog) + +if __name__ == "__main__": + main()