You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/05/17 09:07:42 UTC

[GitHub] [airflow] ashb commented on a change in pull request #15737: Update installation page

ashb commented on a change in pull request #15737:
URL: https://github.com/apache/airflow/pull/15737#discussion_r633359846



##########
File path: docs/exts/extra_files_with_substitutions.py
##########
@@ -25,19 +25,28 @@ def copy_docker_compose(app, exception):
     if exception or not isinstance(app.builder, builders.StandaloneHTMLBuilder):
         return
 
-    # Replace `|version|` in the docker-compose.yaml that we produce in the built docs
-    for path in app.config.html_extra_with_substituions:
+    # Replace `|version|` in the docker-compose.yaml that requires manual substitutions
+    for path in app.config.html_extra_with_substitutions:
         with open(path) as file:
-            with open(os.path.join(app.outdir, os.path.basename(path)), "w") as output:
+            with open(os.path.join(app.outdir, os.path.basename(path)), "w") as output_file:
                 for line in file:
-                    output.write(line.replace('|version|', app.config.version))
+                    output_file.write(line.replace('|version|', app.config.version))
+
+    # Replace `|version|` in the installation.html that requires manual substitutions (in links)
+    for path in app.config.manual_substitutions_in_generated_html:
+        with open(os.path.join(app.outdir, os.path.basename(path))) as input_file:
+            content = input_file.readlines()
+        with open(os.path.join(app.outdir, os.path.basename(path)), "wt") as output_file:
+            for line in content:
+                output_file.write(line.replace('|version|', app.config.version))

Review comment:
       This is coming from install.rst right? If so then Sphinx's native replacement should already handle this!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org