From 2d12a3a5a3311aa1ee4750905e6a178ce2fa2e95 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jun 04 2019 14:12:05 +0000 Subject: [PATCH 1/109] add fedora magazine docs --- diff --git a/site.yml b/site.yml index e0ae6c0..6da0c7d 100644 --- a/site.yml +++ b/site.yml @@ -73,6 +73,7 @@ content: - url: https://pagure.io/fedora-ci/docs.git - url: https://pagure.io/java-packaging-howto.git - url: https://pagure.io/fedora-docs/taiga-docs.git + - url: https://pagure.io/fedora-magazine.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From 43b4aa286a128433e7d41f466e8e15c1b9525391 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jun 17 2019 12:28:49 +0000 Subject: [PATCH 2/109] add minimization --- diff --git a/site.yml b/site.yml index 6da0c7d..689c2fa 100644 --- a/site.yml +++ b/site.yml @@ -74,6 +74,7 @@ content: - url: https://pagure.io/java-packaging-howto.git - url: https://pagure.io/fedora-docs/taiga-docs.git - url: https://pagure.io/fedora-magazine.git + - url: https://pagure.io/minimization.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From cba9aed70b7e3affc38d5e674f92401574ef2d25 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Jul 16 2019 14:40:55 +0000 Subject: [PATCH 3/109] Add CoreOS docs to the site --- diff --git a/site.yml b/site.yml index 689c2fa..350f1fd 100644 --- a/site.yml +++ b/site.yml @@ -75,6 +75,7 @@ content: - url: https://pagure.io/fedora-docs/taiga-docs.git - url: https://pagure.io/fedora-magazine.git - url: https://pagure.io/minimization.git + - url: https://github.com/coreos/fedora-coreos-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From 2790ff6d47d17f574072e320961e2e3693e18dcc Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Jul 23 2019 19:42:19 +0000 Subject: [PATCH 4/109] Add rawhide gating --- diff --git a/site.yml b/site.yml index 350f1fd..3fd22f2 100644 --- a/site.yml +++ b/site.yml @@ -76,6 +76,7 @@ content: - url: https://pagure.io/fedora-magazine.git - url: https://pagure.io/minimization.git - url: https://github.com/coreos/fedora-coreos-docs.git + - url: https://pagure.io/cpe/rawhide-gating-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From eb5c40907a05af69a90602d8293fab477b738bd4 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Jul 24 2019 19:50:04 +0000 Subject: [PATCH 5/109] Add Council/Edition/Objectives status reports Start building the weekly status reports --- diff --git a/site.yml b/site.yml index 3fd22f2..9b25de0 100644 --- a/site.yml +++ b/site.yml @@ -51,6 +51,7 @@ content: start_path: council - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project + - url: https://pagure.io/Fedora-Council/status_reports.git - url: https://pagure.io/fedora-docs/modularity.git - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-docs/documentation-contributors-guide.git From ce81b9e9349a3029f47da80a23e9ae3cec97b7a8 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Aug 02 2019 10:50:53 +0000 Subject: [PATCH 6/109] Add CPE docs --- diff --git a/site.yml b/site.yml index 9b25de0..3b80054 100644 --- a/site.yml +++ b/site.yml @@ -78,6 +78,7 @@ content: - url: https://pagure.io/minimization.git - url: https://github.com/coreos/fedora-coreos-docs.git - url: https://pagure.io/cpe/rawhide-gating-docs.git + - url: https://pagure.io/cpe/docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From 205512cba0322d331202b71d9093675ef30e6656 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Aug 14 2019 14:18:26 +0000 Subject: [PATCH 7/109] Add Fedora Websites --- diff --git a/site.yml b/site.yml index 3b80054..ad5289e 100644 --- a/site.yml +++ b/site.yml @@ -79,6 +79,7 @@ content: - url: https://github.com/coreos/fedora-coreos-docs.git - url: https://pagure.io/cpe/rawhide-gating-docs.git - url: https://pagure.io/cpe/docs.git + - url: https://pagure.io/fedora-docs/websites.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From e5579e1e1fc534ca2b35b19c993ec24b87a12f04 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 03 2019 10:40:13 +0000 Subject: [PATCH 8/109] add qa docs --- diff --git a/site.yml b/site.yml index ad5289e..581e615 100644 --- a/site.yml +++ b/site.yml @@ -80,6 +80,7 @@ content: - url: https://pagure.io/cpe/rawhide-gating-docs.git - url: https://pagure.io/cpe/docs.git - url: https://pagure.io/fedora-docs/websites.git + - url: https://pagure.io/fedora-qa/qa-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From ae2b19929ba14f3d59e39c8128b68ba788e4e284 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Oct 10 2019 18:32:07 +0000 Subject: [PATCH 9/109] Publish PgM docs to prod Now that we've figured out all the ways I can do it wrong in stage, let's start pushing to prod! --- diff --git a/site.yml b/site.yml index 581e615..6a061de 100644 --- a/site.yml +++ b/site.yml @@ -81,6 +81,7 @@ content: - url: https://pagure.io/cpe/docs.git - url: https://pagure.io/fedora-docs/websites.git - url: https://pagure.io/fedora-qa/qa-docs.git + - url: https://pagure.io/fedora-pgm/pgm_docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From 5a2a1d5134bdad808701f21a4b191c8caedca666 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Oct 29 2019 13:48:01 +0000 Subject: [PATCH 10/109] Add F31 docs --- diff --git a/site.yml b/site.yml index 6a061de..e1fb9a4 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f31 - f30 - f29 - f28 @@ -22,6 +23,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f31 - f30 - f29 - f28 @@ -30,6 +32,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f31 - f30 - f29 - f28 @@ -38,6 +41,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f31 - f30 - f29 - f28 From 7ebddd0ef67ee0fca62f3d667e607bd63c942f2c Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Nov 04 2019 17:27:30 +0000 Subject: [PATCH 11/109] update builder to f31 --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index 2f7cd80..78cfcc7 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:31 RUN dnf -y module install nodejs:10/default && \ dnf -y install git && \ From 2546966a5c8f719bf0a8c5e52312ac457aba20e8 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Nov 25 2019 14:46:21 +0000 Subject: [PATCH 12/109] Add AskFedora SOP docs to the site --- diff --git a/site.yml b/site.yml index e1fb9a4..474a482 100644 --- a/site.yml +++ b/site.yml @@ -86,6 +86,7 @@ content: - url: https://pagure.io/fedora-docs/websites.git - url: https://pagure.io/fedora-qa/qa-docs.git - url: https://pagure.io/fedora-pgm/pgm_docs.git + - url: https://pagure.io/Ask-Fedora-SOP-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From 2ed833863112fa0bf7332be2cf1aac690e69d14a Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Dec 19 2019 16:43:38 +0000 Subject: [PATCH 13/109] add Fedora Join SIG docs --- diff --git a/site.yml b/site.yml index 474a482..ad3c5d9 100644 --- a/site.yml +++ b/site.yml @@ -87,6 +87,7 @@ content: - url: https://pagure.io/fedora-qa/qa-docs.git - url: https://pagure.io/fedora-pgm/pgm_docs.git - url: https://pagure.io/Ask-Fedora-SOP-docs.git + - url: https://pagure.io/fedora-join/fedora-join-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From 34b7cd35d4f1896309ce6e0d3eb1e6beaa18e8b9 Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Mar 04 2020 08:26:21 +0000 Subject: [PATCH 14/109] Use Fedora 31 instead of 29 which is EOL Signed-off-by: Clement Verna --- diff --git a/Dockerfile b/Dockerfile index 8a10b9c..e51e4bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:31 RUN dnf -y module install nodejs:10 && \ dnf clean all From 50e76174eb541006081f57bd9b9c90361decf76d Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Apr 14 2020 20:39:34 +0000 Subject: [PATCH 15/109] Add F32 docs --- diff --git a/site.yml b/site.yml index ad3c5d9..88e92d8 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f32 - f31 - f30 - f29 @@ -23,6 +24,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f32 - f31 - f30 - f29 @@ -32,6 +34,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f32 - f31 - f30 - f29 @@ -41,6 +44,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f32 - f31 - f30 - f29 From 5c9bfe9179c136b2a9a6a476378b5fb4f8a1a742 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Apr 14 2020 20:40:07 +0000 Subject: [PATCH 16/109] Add l10n repos --- diff --git a/site.yml b/site.yml index 88e92d8..813123b 100644 --- a/site.yml +++ b/site.yml @@ -92,6 +92,8 @@ content: - url: https://pagure.io/fedora-pgm/pgm_docs.git - url: https://pagure.io/Ask-Fedora-SOP-docs.git - url: https://pagure.io/fedora-join/fedora-join-docs.git + - url: https://pagure.io/fedora-docs/localization.git + - url: https://pagure.io/fedora-l10n/docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From bd2bd61eeab7a5772693220422c051a7debc310a Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 22 2020 13:00:19 +0000 Subject: [PATCH 17/109] add ELN docs --- diff --git a/site.yml b/site.yml index 813123b..21716c2 100644 --- a/site.yml +++ b/site.yml @@ -94,6 +94,7 @@ content: - url: https://pagure.io/fedora-join/fedora-join-docs.git - url: https://pagure.io/fedora-docs/localization.git - url: https://pagure.io/fedora-l10n/docs.git + - url: https://pagure.io/fedora-ci/eln-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/ui-bundle.zip From 2de4a0affdbf36ef324c4452d92e98dd0fae5076 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: May 21 2020 07:56:20 +0000 Subject: [PATCH 18/109] add translations --- diff --git a/.gitignore b/.gitignore index 13d8eda..6abd12e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build public cache +build-scripts/output diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index 78cfcc7..a20ccc6 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,13 +1,13 @@ FROM fedora:31 RUN dnf -y module install nodejs:10/default && \ - dnf -y install git && \ + dnf -y install git python3-yaml && \ dnf clean all RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0 -ADD rebuild-site.sh /antora/rebuild-site.sh +ADD rebuild-site.py /antora/rebuild-site.py WORKDIR /antora -CMD /antora/rebuild-site.sh +CMD /antora/rebuild-site.py diff --git a/build-scripts/README.md b/build-scripts/README.md index f1d819c..949cc64 100644 --- a/build-scripts/README.md +++ b/build-scripts/README.md @@ -1,7 +1,46 @@ # Building the docs +This script is used in OpenShift to rebuild the whole site for Fedora. + + +## Local testing + +Test the build locally using podman. + +First, make sure your in the right directory — it's the same one that has this *README.md* file. Then build the container on your system: + +``` +$ podman build --no-cache -t fedora-docs-openshift-rebuild . +``` + +And then run it: + +``` +$ mkdir output +$ podman run --rm -it -e "BUILD_ENV=stg" -v $(pwd)/output:/antora/output fedora-docs-openshift-rebuild +``` + +The output will be saved in `./output/`. + +### Changing configuration + +You can also set different environment variables by setting `-e "VAR_NAME=value"` in the `podman run` command. +See a list of supported variables below. + ``` -docker run --rm -it -e "BUILD_ENV=stg" -v $(pwd)/output:/antora/output antora-openshift-rebuild +# The script requires the following environment variables to be set: +# +# Variable Values Effect +# -----------------|----------------------------------------------------------- +# BUILD_ENV prod Build the production version of the site +# using the "prod" branch. DEFAULT +# stg Build the staging version of the site +# using the "stg" branch. +# -----------------|----------------------------------------------------------- +# BUILD_LANGS english Build the "en-US" version only. DEFAULT +# translated Build only the translated versions. +# all Build the "en-US" and the translated versions. ``` -The output will be in `./output/`. +Please note that rebuilding all the languages locally will take many hours and results in gigabytes of output. + diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py new file mode 100755 index 0000000..7755326 --- /dev/null +++ b/build-scripts/rebuild-site.py @@ -0,0 +1,383 @@ +#!/usr/bin/python3 + + +# The script requires the following environment variables to be set: +# +# Variable Values Effect +# -----------------|----------------------------------------------------------- +# BUILD_ENV prod Build the production version of the site +# using the "prod" branch. DEFAULT +# stg Build the staging version of the site +# using the "stg" branch. +# -----------------|----------------------------------------------------------- +# BUILD_LANGS english Build the "en-US" version only. DEFAULT +# translated Build only the translated versions. +# all Build the "en-US" and the translated versions. +# +# + + +import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys + + +def get_config(): + config = {} + + config["docs_repo_branch"] = os.getenv( + "BUILD_ENV", + "prod") + + config["build_langs"] = os.getenv( + "BUILD_LANGS", + "english") + + config["docs_repo_url"] = os.getenv( + "DOCS_REPO_URL", + "https://pagure.io/fedora-docs/docs-fp-o.git") + + config["translated_sources_repo_url"] = os.getenv( + "TRANSLATED_SOURCES_REPO_URL", + "https://pagure.io/fedora-docs/translated-sources.git" + ) + + return config + + +def log(msg): + print(msg) + + +def get_languages(config): + languages_dict = {} + + with tempfile.TemporaryDirectory() as workdir: + translated_sources_repo = os.path.join(workdir, "translated_sources_repo") + subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_repo]) + + languages = [] + filename_blacklist = [".git"] + for filename in os.listdir(translated_sources_repo): + filepath = os.path.join(translated_sources_repo, filename) + if os.path.isdir(filepath) and filename not in filename_blacklist: + languages.append(filename) + + languages.sort() + + for lang in languages: + languages_dict[lang] = [] + + lang_dir = os.path.join(translated_sources_repo, lang) + for component in os.listdir(lang_dir): + version_dir = os.path.join(lang_dir, component) + for version in os.listdir(version_dir): + start_path = "{lang}/{component}/{version}".format( + lang=lang, component=component, version=version) + + # This is a workaround for cases when a component doesn't have + # the ROOT module that should contain the antora.yml. + # Without the ROOT module the translation scripts won't + # pick up the antora.yml causing the docs build to fail. + # So we're only including directories with the antora.yml file. + if "antora.yml" in os.listdir(os.path.join(version_dir, version)): + languages_dict[lang].append(start_path) + + return languages_dict + + +def generate_lang_switch_ui(languages): + template_start = """ +
+ +
+ """ + template_end = """ +
+
+ """ + + template_list = [] + template_list.append(template_start) + for language in languages: + link = '{language}'.format( + language=language) + template_list.append(link) + template_list.append(template_end) + + return "\n".join(template_list) + +def prepare_translated_sources(translated_sources, site_yml, languages, config): + with tempfile.TemporaryDirectory() as workdir: + # Location of the translated-sources repo + # (This repo only holds content that has some translations done, + # so it might be incomplete.) + translated_sources_original = os.path.join(workdir, "translated_sources_original") + + # Location of the English sources in the same structure + # as translated-sources, so: + # COMPONENT/VERSION/antora.yml + # COMPONENT/VERSION/modules/MODULE1 + # COMPONENT/VERSION/modules/MODULE2 + # COMPONENT/VERSION/modules/... + en_sources = os.path.join(workdir, "en_sources") + + # Clone the original translated-sources + subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_original]) + + # Get a list of the original English repos + repos = [] + for repo_data in site_yml["content"]["sources"]: + + if "branches" not in repo_data: + repo_data["branches"] = ["master"] + if "start_path" not in repo_data: + repo_data["start_path"] = "" + + for branch in repo_data["branches"]: + repo = {} + repo["url"] = repo_data["url"] + repo["branch"] = branch + repo["start_path"] = repo_data["start_path"] + + repos.append(repo) + + # Clome the original English sources and put them into the + # desired structure in en_sources (described above) + components = {} + for repo in repos: + with tempfile.TemporaryDirectory() as tmp_repo_root: + log("") + log("Cloning {url} {branch}".format(url=repo["url"], branch=repo["branch"])) + subprocess.run(["git", "clone", "--branch", repo["branch"], repo["url"], tmp_repo_root]) + + repo_dir = os.path.join(tmp_repo_root, repo["start_path"]) + antora_yml_file = os.path.join(repo_dir, "antora.yml") + with open(antora_yml_file, "r") as file: + antora_yml = yaml.safe_load(file) + + component = antora_yml["name"] + version = antora_yml["version"] + + # Saving components and all their versions + if component not in components: + components[component] = set() + components[component].add(version) + + for module in os.listdir(os.path.join(repo_dir, "modules")): + # Now this is looping over modules accross all components, + # so component, module, and version variables are available + + try: + os.makedirs(os.path.join(en_sources, component, version, "modules")) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + original_module_dir = os.path.join(repo_dir, "modules", module) + module_dir = os.path.join(en_sources, component, version, "modules", module) + + subprocess.run(["cp", "-r", original_module_dir, module_dir]) + + if module == "ROOT" or "nav" in antora_yml: + # if this is the main antora.yml file + subprocess.run(["cp", "-r", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")]) + log("----- copying antora.yml for {component} {module} {version}".format( + component=component, module=module, version=version)) + else: + log("----- skipping antora.yml for {component} {module} {version}".format( + component=component, module=module, version=version)) + + # Set up the language structure in translated_sources + for language in languages: + lang_dir = os.path.join(translated_sources, language) + try: + os.makedirs(lang_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + # Copy the English sources in the translated_sources + for language in languages: + lang_dir = os.path.join(translated_sources, language) + for component in components: + en_component_dir = os.path.join(en_sources, component) + subprocess.run(["cp", "-r", en_component_dir, lang_dir]) + + # And finally copy the original translated sources + # into translated_sources + for language in languages: + src = os.path.join(translated_sources_original, language) + subprocess.run(["cp", "-r", src, translated_sources + "/"]) + + return components + + +def init_git_repo(path): + try: + os.makedirs(path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + subprocess.run(["git", "init"], cwd=path) + subprocess.run(["git", "config", "user.name", "Your Name"], cwd=path) + subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) + subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) + + +def main(): + config = get_config() + + with tempfile.TemporaryDirectory() as workdir: + + #####--------------------------------------##### + ##### Preparation ##### + #####--------------------------------------##### + + # Location of the docs-fp-o repo + docs_repo = os.path.join(workdir, "docs_repo") + + # Location of the translated sources used for the build + # (That's the translated-sources repo with the missing files added + # from the English sources.) + translated_sources = os.path.join(workdir, "translated_sources") + init_git_repo(translated_sources) + + log("") + log("===== Getting the site definition (site.yml) =====") + subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], config["docs_repo_url"], docs_repo]) + + with open(os.path.join(docs_repo, "site.yml"), "r") as file: + original_site_yml = yaml.safe_load(file) + + log("") + log("===== Getting a list of languages =====") + languages = get_languages(config) + log(" Languages: {}".format(" ".join(languages))) + + log("") + log("===== Generating the language switch UI =====") + lang_switch_ui = generate_lang_switch_ui(["en-US"] + list(languages.keys())) + + ui_dir = os.path.join(docs_repo, "supplemental-ui", "partials") + try: + os.makedirs(ui_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + ui_file = os.path.join(ui_dir, "page-languages.hbs") + with open(ui_file, "w") as file: + file.write(lang_switch_ui) + + # Timestamp to be included in the footer of the docs + timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') + antora_env = copy.deepcopy(os.environ) + antora_env["ANTORA_DATE"] = timestamp + + + + #####--------------------------------------##### + ##### English site build ##### + #####--------------------------------------##### + + if config["build_langs"] == "english" or config["build_langs"] == "all": + + log("") + log("===== Building the en-US site =====") + antora_env["ANTORA_LANGUAGE"] = "en-US" + result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) + + if result.returncode != 0: + log("ERROR building the en-US site") + sys.exit(1) + + log("") + log("===== Copying the en-US site =====") + source_dir = os.path.join(docs_repo, "public") + target_dir_copying = "/antora/output/en-US.building" + target_dir_copied = "/antora/output/en-US.building/en-US" + target_dir_final = "/antora/output/en-US" + shutil.rmtree(target_dir_copying, ignore_errors=True) + subprocess.run(["cp", "-r", source_dir, target_dir_copying]) + shutil.rmtree(target_dir_final, ignore_errors=True) + shutil.move(target_dir_copied, target_dir_final) + shutil.rmtree(target_dir_copying, ignore_errors=True) + + log("") + log("===== Copying the index.html =====") + source_index_html = os.path.join(docs_repo, "static", "index.html") + target_index_html = "/antora/output/index.html" + shutil.copy(source_index_html, target_index_html) + + + + #####--------------------------------------##### + ##### Translated site build ##### + #####--------------------------------------##### + + if config["build_langs"] == "translated" or config["build_langs"] == "all": + + log("") + log("===== Preparing the translated sources =====") + components = prepare_translated_sources(translated_sources, original_site_yml, languages, config) + + log("") + log("===== Generating site.lang.yml files =====") + for lang in languages: + lang_site_yml = copy.deepcopy(original_site_yml) + + lang_site_yml["output"]["dir"] = "./public/{lang}".format(lang=lang) + + lang_site_yml["content"] = {} + # Branches are set to HEAD because the script uses a locally-generated + # content on top of the original translated-sources repo + lang_site_yml["content"]["branches"] = "HEAD" + lang_site_yml["content"]["sources"] = [] + + for component, versions in components.items(): + for version in versions: + source = {} + source["url"] = translated_sources + source["start_path"] = "{lang}/{component}/{version}".format( + lang=lang, component=component, version=version) + + lang_site_yml["content"]["sources"].append(source) + + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) + with open(filename, "w") as file: + file.write(yaml.dump(lang_site_yml)) + + log(" {lang} done".format(lang=lang)) + + # Building all the translated sites + for lang in languages: + log("") + log("===== Building the {lang} site =====".format(lang=lang)) + filename = "site-{lang}.yml".format(lang=lang) + antora_env["ANTORA_LANGUAGE"] = lang + result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, filename)], env=antora_env) + + if result.returncode != 0: + log("ERROR building the {lang} site".format(lang=lang)) + sys.exit(1) + + # Copying all the translated sites + for lang in languages: + log("") + log("===== Copying the {lang} site =====".format(lang=lang)) + source_dir = os.path.join(docs_repo, "public") + target_dir_copying = "/antora/output/{lang}.building".format(lang=lang) + target_dir_copied = "/antora/output/{lang}.building/{lang}".format(lang=lang) + target_dir_final = "/antora/output/{lang}".format(lang=lang) + shutil.rmtree(target_dir_copying, ignore_errors=True) + subprocess.run(["cp", "-r", source_dir, target_dir_copying]) + shutil.rmtree(target_dir_final, ignore_errors=True) + shutil.move(target_dir_copied, target_dir_final) + shutil.rmtree(target_dir_copying, ignore_errors=True) + + + +if __name__ == "__main__": + main() + diff --git a/build-scripts/rebuild-site.sh b/build-scripts/rebuild-site.sh deleted file mode 100755 index c49438b..0000000 --- a/build-scripts/rebuild-site.sh +++ /dev/null @@ -1,59 +0,0 @@ -#/bin/bash - -echo "" -echo "$(date +%G-%m-%d-%H%M%S): Building Fedora Docs..." -echo "" - -SOURCE_REPO="https://pagure.io/fedora-docs/docs-fp-o.git" -BUILD_CMD="antora --html-url-extension-style=indexify site.yml" - -target="/antora" - -if [ -z ${BUILD_ENV+x} ]; then - BUILD_ENV="master" -fi - - -if ! workdir=$(mktemp -d) ; then - echo "Error creating a tempdir. Exiting." - exit 1 -fi - -if ! git clone --single-branch --branch $BUILD_ENV $SOURCE_REPO "$workdir/source" ; then - echo "" - echo "Error cloning the source repo." - rm -rf "$workdir" - exit 1 -else - echo "OK cloned source repo" -fi - -if [ ! -f "$workdir/source/site.yml" ]; then - echo "" - echo "Error! There is no site.yml in the source." - rm -rf "$workdir" - exit 1 -fi - -pushd "$workdir/source/" > /dev/null - - -export ANTORA_DATE=$(date -u) - -if ! $BUILD_CMD ; then - echo "" - echo "Error building the site." - rm -rf "$workdir" - exit 1 -fi - -popd > /dev/null - -cp -r "$workdir/source/public/en-US" "$target/output/en-US.building" && rm -rf "$target/output/en-US" && mv "$target/output/en-US.building" "$target/output/en-US" || exit 1 -cp "$workdir/source/static/index.html" "$target/output/index.html" || exit 1 - -rm -rf "$workdir" - -echo "" -echo "$(date +%G-%m-%d-%H%M%S): Building of Fedora Docs has finished successfully!" -echo "" diff --git a/site.yml b/site.yml index 21716c2..c22e426 100644 --- a/site.yml +++ b/site.yml @@ -97,9 +97,10 @@ content: - url: https://pagure.io/fedora-ci/eln-docs.git ui: bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip snapshot: true default_layout: with_menu + supplemental_files: ./supplemental-ui output: clean: true dir: ./public/en-US diff --git a/supplemental-ui/partials/page-languages.hbs b/supplemental-ui/partials/page-languages.hbs new file mode 100644 index 0000000..b5858f3 --- /dev/null +++ b/supplemental-ui/partials/page-languages.hbs @@ -0,0 +1,6 @@ +
+ +
+ en-US +
+
From 93bbc3adb156faa59b37d55ba480eb74f1e4b81a Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: May 21 2020 07:57:05 +0000 Subject: [PATCH 19/109] bootstrapping translations --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 7755326..d07c503 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -266,9 +266,22 @@ def main(): if e.errno != errno.EEXIST: raise - ui_file = os.path.join(ui_dir, "page-languages.hbs") - with open(ui_file, "w") as file: - file.write(lang_switch_ui) + # FIXME: Bootstrapping production deployment + # To get this in production, I need to hide all the languages from the + # menu on the English site, because the link would be broken for the first + # few hours, as the translated content takes much longer to build. + # + # So, by commenting this out, it'll use the default file that only + # has "en-US" in it. And I copy this to the translated part, + # so those pages all get the right language menu. + # + # And I revert this when the translated site is built, and the + # link would no longer be broken. + # + # FIXME When reverting this, look for the other #FIXME below + #ui_file = os.path.join(ui_dir, "page-languages.hbs") + #with open(ui_file, "w") as file: + # file.write(lang_switch_ui) # Timestamp to be included in the footer of the docs timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') @@ -316,6 +329,14 @@ def main(): ##### Translated site build ##### #####--------------------------------------##### + # FIXME: Bootstrapping production deployment + # This is the second part of the temporary change. + # Look at the previous FIXME for more details + ui_file = os.path.join(ui_dir, "page-languages.hbs") + with open(ui_file, "w") as file: + file.write(lang_switch_ui) + + if config["build_langs"] == "translated" or config["build_langs"] == "all": log("") From d4c8fb628d1535adeddc008277cfac6c9e639a4c Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jun 04 2020 09:14:06 +0000 Subject: [PATCH 20/109] fix translated pages copying --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index d07c503..c478e40 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -384,18 +384,44 @@ def main(): sys.exit(1) # Copying all the translated sites + log("") + log("=== Copying translated sites ===") + + results_dir = os.path.join(docs_repo, "public") + publish_dir = "/antora/output" + copying_dir = os.path.join(publish_dir, "copying.tmp") + + # I have: + # docs_repo/public <- results_dir (local partition) + # /antora/output/copying.tmp <- copying_dir (mounted partition) + # /antora/output <- publish_dir (mounted partition) + # + # I need to: + # 1/ copy from local to mounted + # 2/ remove old in mounted + # 3/ move new within mounted + # 4/ remove the copying dir + + # Make sure copying_dir exists and is empty + shutil.rmtree(copying_dir, ignore_errors=True) + subprocess.run(["mkdir", copying_dir]) + + # Copy results from local partition to a mounted partition + log("Copying between partitions...") + subprocess.run(["cp", "-r", results_dir, "{}/".format(copying_dir)]) + + # Swap the old tree for the new one for each language + log("Moving languages to the final place:") for lang in languages: - log("") - log("===== Copying the {lang} site =====".format(lang=lang)) - source_dir = os.path.join(docs_repo, "public") - target_dir_copying = "/antora/output/{lang}.building".format(lang=lang) - target_dir_copied = "/antora/output/{lang}.building/{lang}".format(lang=lang) - target_dir_final = "/antora/output/{lang}".format(lang=lang) - shutil.rmtree(target_dir_copying, ignore_errors=True) - subprocess.run(["cp", "-r", source_dir, target_dir_copying]) - shutil.rmtree(target_dir_final, ignore_errors=True) - shutil.move(target_dir_copied, target_dir_final) - shutil.rmtree(target_dir_copying, ignore_errors=True) + log(" - {}".format(lang)) + shutil.rmtree(os.path.join(publish_dir, lang), ignore_errors=True) + subprocess.run(["mv", os.path.join(copying_dir, "public", lang), "{}/".format(publish_dir)]) + + # And finally remove the copying dir + log("Removing the copying dir...") + shutil.rmtree(copying_dir, ignore_errors=True) + + log("DONE!") From 8f6f30b14aa77ba0d8366f2985b4d3e03d637c3f Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jun 04 2020 13:02:28 +0000 Subject: [PATCH 21/109] Update build-scripts/README.md --- diff --git a/build-scripts/README.md b/build-scripts/README.md index 949cc64..99048ad 100644 --- a/build-scripts/README.md +++ b/build-scripts/README.md @@ -17,7 +17,7 @@ And then run it: ``` $ mkdir output -$ podman run --rm -it -e "BUILD_ENV=stg" -v $(pwd)/output:/antora/output fedora-docs-openshift-rebuild +$ podman run --rm -it -e "BUILD_ENV=stg" -v $(pwd)/output:/antora/output:Z fedora-docs-openshift-rebuild ``` The output will be saved in `./output/`. From 5b9830f465967972c7efeedeacb1e67e5647e0ce Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jun 04 2020 13:20:39 +0000 Subject: [PATCH 22/109] Update build-scripts/README.md --- diff --git a/build-scripts/README.md b/build-scripts/README.md index 99048ad..cdf094e 100644 --- a/build-scripts/README.md +++ b/build-scripts/README.md @@ -17,7 +17,7 @@ And then run it: ``` $ mkdir output -$ podman run --rm -it -e "BUILD_ENV=stg" -v $(pwd)/output:/antora/output:Z fedora-docs-openshift-rebuild +$ podman run --rm -it -e "BUILD_ENV=prod" -v $(pwd)/output:/antora/output:Z fedora-docs-openshift-rebuild ``` The output will be saved in `./output/`. From f478f77894cd8c8de383b8eeb1521822b2d22524 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Jun 15 2020 13:00:02 +0000 Subject: [PATCH 23/109] replace cp -r by cp -al limit the impact on filesystem for rsync, as asked by infra team --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index c478e40..529814a 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -177,11 +177,11 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): original_module_dir = os.path.join(repo_dir, "modules", module) module_dir = os.path.join(en_sources, component, version, "modules", module) - subprocess.run(["cp", "-r", original_module_dir, module_dir]) + subprocess.run(["cp", "-al", original_module_dir, module_dir]) if module == "ROOT" or "nav" in antora_yml: # if this is the main antora.yml file - subprocess.run(["cp", "-r", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")]) + subprocess.run(["cp", "-al", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")]) log("----- copying antora.yml for {component} {module} {version}".format( component=component, module=module, version=version)) else: @@ -202,13 +202,13 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): lang_dir = os.path.join(translated_sources, language) for component in components: en_component_dir = os.path.join(en_sources, component) - subprocess.run(["cp", "-r", en_component_dir, lang_dir]) + subprocess.run(["cp", "-al", en_component_dir, lang_dir]) # And finally copy the original translated sources # into translated_sources for language in languages: src = os.path.join(translated_sources_original, language) - subprocess.run(["cp", "-r", src, translated_sources + "/"]) + subprocess.run(["cp", "-al", src, translated_sources + "/"]) return components @@ -312,7 +312,7 @@ def main(): target_dir_copied = "/antora/output/en-US.building/en-US" target_dir_final = "/antora/output/en-US" shutil.rmtree(target_dir_copying, ignore_errors=True) - subprocess.run(["cp", "-r", source_dir, target_dir_copying]) + subprocess.run(["cp", "-al", source_dir, target_dir_copying]) shutil.rmtree(target_dir_final, ignore_errors=True) shutil.move(target_dir_copied, target_dir_final) shutil.rmtree(target_dir_copying, ignore_errors=True) @@ -408,7 +408,7 @@ def main(): # Copy results from local partition to a mounted partition log("Copying between partitions...") - subprocess.run(["cp", "-r", results_dir, "{}/".format(copying_dir)]) + subprocess.run(["cp", "-al", results_dir, "{}/".format(copying_dir)]) # Swap the old tree for the new one for each language log("Moving languages to the final place:") From 1555500076bac981454975ac2fd192612c6ace86 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Jun 21 2020 18:03:20 +0000 Subject: [PATCH 24/109] run hardlink at the end as asked in https://pagure.io/fedora-infrastructure/issue/8964 --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 529814a..aee99f1 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -177,11 +177,11 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): original_module_dir = os.path.join(repo_dir, "modules", module) module_dir = os.path.join(en_sources, component, version, "modules", module) - subprocess.run(["cp", "-al", original_module_dir, module_dir]) + subprocess.run(["cp", "-a", original_module_dir, module_dir]) if module == "ROOT" or "nav" in antora_yml: # if this is the main antora.yml file - subprocess.run(["cp", "-al", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")]) + subprocess.run(["cp", "-a", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")]) log("----- copying antora.yml for {component} {module} {version}".format( component=component, module=module, version=version)) else: @@ -202,13 +202,13 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): lang_dir = os.path.join(translated_sources, language) for component in components: en_component_dir = os.path.join(en_sources, component) - subprocess.run(["cp", "-al", en_component_dir, lang_dir]) + subprocess.run(["cp", "-a", en_component_dir, lang_dir]) # And finally copy the original translated sources # into translated_sources for language in languages: src = os.path.join(translated_sources_original, language) - subprocess.run(["cp", "-al", src, translated_sources + "/"]) + subprocess.run(["cp", "-a", src, translated_sources + "/"]) return components @@ -312,7 +312,7 @@ def main(): target_dir_copied = "/antora/output/en-US.building/en-US" target_dir_final = "/antora/output/en-US" shutil.rmtree(target_dir_copying, ignore_errors=True) - subprocess.run(["cp", "-al", source_dir, target_dir_copying]) + subprocess.run(["cp", "-a", source_dir, target_dir_copying]) shutil.rmtree(target_dir_final, ignore_errors=True) shutil.move(target_dir_copied, target_dir_final) shutil.rmtree(target_dir_copying, ignore_errors=True) @@ -408,7 +408,7 @@ def main(): # Copy results from local partition to a mounted partition log("Copying between partitions...") - subprocess.run(["cp", "-al", results_dir, "{}/".format(copying_dir)]) + subprocess.run(["cp", "-a", results_dir, "{}/".format(copying_dir)]) # Swap the old tree for the new one for each language log("Moving languages to the final place:") @@ -417,6 +417,10 @@ def main(): shutil.rmtree(os.path.join(publish_dir, lang), ignore_errors=True) subprocess.run(["mv", os.path.join(copying_dir, "public", lang), "{}/".format(publish_dir)]) + # https://pagure.io/fedora-infrastructure/issue/8964 + log("Consolidate files with hardlink...") + subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)]) + # And finally remove the copying dir log("Removing the copying dir...") shutil.rmtree(copying_dir, ignore_errors=True) From 3953576171b7663b23b88d901e5ebb41bf5c176c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Jul 05 2020 14:32:20 +0000 Subject: [PATCH 25/109] enable language switch button on english page --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index aee99f1..a2f1202 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -266,22 +266,9 @@ def main(): if e.errno != errno.EEXIST: raise - # FIXME: Bootstrapping production deployment - # To get this in production, I need to hide all the languages from the - # menu on the English site, because the link would be broken for the first - # few hours, as the translated content takes much longer to build. - # - # So, by commenting this out, it'll use the default file that only - # has "en-US" in it. And I copy this to the translated part, - # so those pages all get the right language menu. - # - # And I revert this when the translated site is built, and the - # link would no longer be broken. - # - # FIXME When reverting this, look for the other #FIXME below - #ui_file = os.path.join(ui_dir, "page-languages.hbs") - #with open(ui_file, "w") as file: - # file.write(lang_switch_ui) + ui_file = os.path.join(ui_dir, "page-languages.hbs") + with open(ui_file, "w") as file: + file.write(lang_switch_ui) # Timestamp to be included in the footer of the docs timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') @@ -329,13 +316,6 @@ def main(): ##### Translated site build ##### #####--------------------------------------##### - # FIXME: Bootstrapping production deployment - # This is the second part of the temporary change. - # Look at the previous FIXME for more details - ui_file = os.path.join(ui_dir, "page-languages.hbs") - with open(ui_file, "w") as file: - file.write(lang_switch_ui) - if config["build_langs"] == "translated" or config["build_langs"] == "all": From 3b6c929ebd00f51d1486aa8c85bf3fbe0399c12e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Jul 15 2020 11:10:50 +0000 Subject: [PATCH 26/109] fedora-badges docs moved the folder was just too big ;) --- diff --git a/site.yml b/site.yml index c22e426..4160988 100644 --- a/site.yml +++ b/site.yml @@ -72,8 +72,7 @@ content: - url: https://pagure.io/fesco/fesco-docs.git start_path: fesco - url: https://pagure.io/fedora-iot/iot-docs.git - - url: https://pagure.io/fedora-badges.git - start_path: docs + - url: https://pagure.io/fedora-badges/docs.git - url: https://pagure.io/fedora-docs/remix-building.git - url: https://github.com/containers/docs.git - url: https://pagure.io/neuro-sig/documentation.git From da065e8304d12a9fb853807f5f176ff1ffb69e5a Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Aug 07 2020 17:02:45 +0000 Subject: [PATCH 27/109] Add i3 SIG docs --- diff --git a/site.yml b/site.yml index 4160988..9a93945 100644 --- a/site.yml +++ b/site.yml @@ -94,6 +94,7 @@ content: - url: https://pagure.io/fedora-docs/localization.git - url: https://pagure.io/fedora-l10n/docs.git - url: https://pagure.io/fedora-ci/eln-docs.git + - url: https://pagure.io/i3-sig/docs.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 357af084876a89695c041026b01271720e984ef1 Mon Sep 17 00:00:00 2001 From: Aleksandra Fedorova Date: Aug 25 2020 16:50:45 +0000 Subject: [PATCH 28/109] Move eln-docs to GitHub --- diff --git a/site.yml b/site.yml index 9a93945..e654ebf 100644 --- a/site.yml +++ b/site.yml @@ -93,7 +93,7 @@ content: - url: https://pagure.io/fedora-join/fedora-join-docs.git - url: https://pagure.io/fedora-docs/localization.git - url: https://pagure.io/fedora-l10n/docs.git - - url: https://pagure.io/fedora-ci/eln-docs.git + - url: https://github.com/fedora-eln/eln-docs.git - url: https://pagure.io/i3-sig/docs.git ui: bundle: From 54f3e95dd3ff2c842c624f3504127243a34673bc Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Oct 27 2020 13:22:40 +0000 Subject: [PATCH 29/109] Add F33 docs --- diff --git a/site.yml b/site.yml index e654ebf..ddb9c1c 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f33 - f32 - f31 - f30 @@ -24,6 +25,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f33 - f32 - f31 - f30 @@ -34,6 +36,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f33 - f32 - f31 - f30 @@ -44,6 +47,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f33 - f32 - f31 - f30 From 81bafdb973f1299e718fd9458a184ed412c692f6 Mon Sep 17 00:00:00 2001 From: Justin W. Flory (he/him) Date: Nov 13 2020 23:07:15 +0000 Subject: [PATCH 30/109] Change default council-docs repository branch to main This commit corresponds to Fedora-Council/council-docs#93: https://pagure.io/Fedora-Council/council-docs/pull-request/93 The default git branch is renamed from `master` to `main` for the council-docs repo. This closes a long-standing issue on the council-docs repo. This commit should be merged in close coordination with council-docs#93. Signed-off-by: Justin W. Flory (he/him) --- diff --git a/site.yml b/site.yml index ddb9c1c..3987c24 100644 --- a/site.yml +++ b/site.yml @@ -61,6 +61,8 @@ content: start_path: docs - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council + branches: + - main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git From ebc8c74c0e381184afe5770ac86f62ecab331918 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 17 2020 14:56:24 +0000 Subject: [PATCH 31/109] Revert "Change default council-docs repository branch to main" This reverts commit 81bafdb973f1299e718fd9458a184ed412c692f6. Antora doesn't seem to like this repo having a different default branch and it breaks in funny ways. Putting this on hold until Adam is back to help. --- diff --git a/site.yml b/site.yml index 3987c24..ddb9c1c 100644 --- a/site.yml +++ b/site.yml @@ -61,8 +61,6 @@ content: start_path: docs - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council - branches: - - main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git From 98f9cc3ac7c66747c2e3933f7e1851483b4dafbb Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 30 2020 16:59:58 +0000 Subject: [PATCH 32/109] Move council-docs to main as default branch --- diff --git a/site.yml b/site.yml index ddb9c1c..e781c40 100644 --- a/site.yml +++ b/site.yml @@ -61,6 +61,7 @@ content: start_path: docs - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council + branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git From f5c43532faf8d4f862b94753384c6d203fff763d Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 30 2020 17:04:40 +0000 Subject: [PATCH 33/109] Move status dashboard to use main branch --- diff --git a/site.yml b/site.yml index e781c40..4165db5 100644 --- a/site.yml +++ b/site.yml @@ -65,6 +65,7 @@ content: - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git + branches: main - url: https://pagure.io/fedora-docs/modularity.git - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-docs/documentation-contributors-guide.git From 8670f10d8a58f738ea3af9774a21aacb7281ed68 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 30 2020 17:13:12 +0000 Subject: [PATCH 34/109] Move FPgM docs to use main branch --- diff --git a/site.yml b/site.yml index 4165db5..f9bce2d 100644 --- a/site.yml +++ b/site.yml @@ -95,6 +95,7 @@ content: - url: https://pagure.io/fedora-docs/websites.git - url: https://pagure.io/fedora-qa/qa-docs.git - url: https://pagure.io/fedora-pgm/pgm_docs.git + branches: main - url: https://pagure.io/Ask-Fedora-SOP-docs.git - url: https://pagure.io/fedora-join/fedora-join-docs.git - url: https://pagure.io/fedora-docs/localization.git From dfc1e0338116f094c29f9fc570852ab0087560c7 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Dec 01 2020 16:37:41 +0000 Subject: [PATCH 35/109] Fix the branch for the /project docs too --- diff --git a/site.yml b/site.yml index f9bce2d..d9f2110 100644 --- a/site.yml +++ b/site.yml @@ -64,6 +64,7 @@ content: branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project + branches: main - url: https://pagure.io/Fedora-Council/status_reports.git branches: main - url: https://pagure.io/fedora-docs/modularity.git From 86e6995fb23da46d2181759111e7f0eef632a8e6 Mon Sep 17 00:00:00 2001 From: Justin W. Flory (he/him) Date: Dec 08 2020 12:35:25 +0000 Subject: [PATCH 36/109] Remove "Site" from site title I finally figured out where this info is stored. This is been a mild bother for some time. It makes the title shorter, and it doesn't appear in file names or other things if I take screenshots of a docs.fp.o page. Purely cosmetic, using this change as an excuse to make my first change to the production docs.fp.o builder. Signed-off-by: Justin W. Flory (he/him) --- diff --git a/site.yml b/site.yml index d9f2110..dceae96 100644 --- a/site.yml +++ b/site.yml @@ -1,5 +1,5 @@ site: - title: Fedora Docs Site + title: Fedora Docs url: https://docs.fedoraproject.org/en-US/ start_page: docs::index.adoc content: From 6e8094c702d18d205c5756aecfd1f502204f03e3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Dec 16 2020 12:46:24 +0000 Subject: [PATCH 37/109] allow single branch and detect default branch --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index a2f1202..7801898 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -127,18 +127,23 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): # Get a list of the original English repos repos = [] + default_branch = site_yml["content"].get("branches", ["master"]) + if type(default_branch) is str: + default_branch = [default_branch] + for repo_data in site_yml["content"]["sources"]: - if "branches" not in repo_data: - repo_data["branches"] = ["master"] - if "start_path" not in repo_data: - repo_data["start_path"] = "" + branches = repo_data.get("branches", default_branch) + if type(branches) is str: + branches = [branches] + + start_path = repo_data.get("start_path", "") - for branch in repo_data["branches"]: + for branch in branches: repo = {} repo["url"] = repo_data["url"] repo["branch"] = branch - repo["start_path"] = repo_data["start_path"] + repo["start_path"] = start_path repos.append(repo) From c30c3483f5d3b1de4397aafea1d880cccccc96c0 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Jan 28 2021 09:41:08 +0000 Subject: [PATCH 38/109] Add Fedora Accounts docs --- diff --git a/site.yml b/site.yml index dceae96..4c83d30 100644 --- a/site.yml +++ b/site.yml @@ -103,6 +103,7 @@ content: - url: https://pagure.io/fedora-l10n/docs.git - url: https://github.com/fedora-eln/eln-docs.git - url: https://pagure.io/i3-sig/docs.git + - url: https://github.com/fedora-infra/fedora-accounts-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 5e0bfa7e0a6438716d9ddfd6e146a836382ea5d6 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Jan 28 2021 11:08:40 +0000 Subject: [PATCH 39/109] Add Fedora Gaming docs to Engineering --- diff --git a/site.yml b/site.yml index 4c83d30..1113221 100644 --- a/site.yml +++ b/site.yml @@ -104,6 +104,7 @@ content: - url: https://github.com/fedora-eln/eln-docs.git - url: https://pagure.io/i3-sig/docs.git - url: https://github.com/fedora-infra/fedora-accounts-docs.git + - url: https://pagure.io/gaming/documentation.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From e0f35e965dd43327e9fceac01181cba7d6370c72 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Feb 23 2021 13:51:44 +0000 Subject: [PATCH 40/109] Gaming switched default branch to main Signed-off-by: Ben Cotton --- diff --git a/site.yml b/site.yml index 1113221..7771247 100644 --- a/site.yml +++ b/site.yml @@ -105,6 +105,7 @@ content: - url: https://pagure.io/i3-sig/docs.git - url: https://github.com/fedora-infra/fedora-accounts-docs.git - url: https://pagure.io/gaming/documentation.git + branches: main ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 463a33c030fb43caafe85d139b8aedd6d5391442 Mon Sep 17 00:00:00 2001 From: Timothée Ravier Date: Feb 24 2021 13:38:28 +0000 Subject: [PATCH 41/109] site.yaml: Add Fedora Kinoite docs --- diff --git a/site.yml b/site.yml index 7771247..644973d 100644 --- a/site.yml +++ b/site.yml @@ -69,6 +69,8 @@ content: branches: main - url: https://pagure.io/fedora-docs/modularity.git - url: https://github.com/fedora-silverblue/silverblue-docs.git + - url: https://pagure.io/fedora-kde/kinoite-docs + branches: main - url: https://pagure.io/fedora-docs/documentation-contributors-guide.git - url: https://pagure.io/fedora-docs/flatpak.git - url: https://pagure.io/fedora-diversity.git From 320d7bf302437b45c51768a03b41fb280cb16ab0 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Mar 17 2021 13:47:00 +0000 Subject: [PATCH 42/109] Add the Server docs to prod No links yet, since they're still working on the docs and stg is broken Signed-off-by: Ben Cotton --- diff --git a/site.yml b/site.yml index 644973d..675c120 100644 --- a/site.yml +++ b/site.yml @@ -108,6 +108,9 @@ content: - url: https://github.com/fedora-infra/fedora-accounts-docs.git - url: https://pagure.io/gaming/documentation.git branches: main + - url: https://pagure.io/fedora-server.git + branches: main + start_path: docs ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 796fa13bc2cc5d386c8a1fd16cd17031d0c9b3c2 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Apr 08 2021 07:14:58 +0000 Subject: [PATCH 43/109] Change Accounts branch to main --- diff --git a/site.yml b/site.yml index 675c120..c3f84f2 100644 --- a/site.yml +++ b/site.yml @@ -106,6 +106,7 @@ content: - url: https://github.com/fedora-eln/eln-docs.git - url: https://pagure.io/i3-sig/docs.git - url: https://github.com/fedora-infra/fedora-accounts-docs.git + branches: main - url: https://pagure.io/gaming/documentation.git branches: main - url: https://pagure.io/fedora-server.git From a2ba3713c481cd4515e93af399f977ca6b11f855 Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Apr 10 2021 15:55:40 +0000 Subject: [PATCH 44/109] feat(neuro): switch primary branch to main --- diff --git a/site.yml b/site.yml index c3f84f2..b2d4cef 100644 --- a/site.yml +++ b/site.yml @@ -85,6 +85,7 @@ content: - url: https://pagure.io/fedora-docs/remix-building.git - url: https://github.com/containers/docs.git - url: https://pagure.io/neuro-sig/documentation.git + branches: main - url: https://pagure.io/sig-teleirc/infrastructure.git start_path: docs - url: https://pagure.io/fedora-ci/docs.git From 1f9c9c7ae37d317ac6273e1b87224870c03def5e Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Apr 27 2021 12:55:57 +0000 Subject: [PATCH 45/109] Publish F34 docs --- diff --git a/site.yml b/site.yml index b2d4cef..6e2e0a7 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f34 - f33 - f32 - f31 @@ -25,6 +26,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f34 - f33 - f32 - f31 @@ -36,6 +38,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f34 - f33 - f32 - f31 @@ -47,6 +50,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f34 - f33 - f32 - f31 From b6472f954126f7f18d0c5d6cd5b31299a93bde9c Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: May 10 2021 15:59:34 +0000 Subject: [PATCH 46/109] Update UI with new license info --- diff --git a/supplemental-ui/partials/footer-content.hbs b/supplemental-ui/partials/footer-content.hbs new file mode 100644 index 0000000..8488b7b --- /dev/null +++ b/supplemental-ui/partials/footer-content.hbs @@ -0,0 +1,4 @@ +
+

All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.

+

Last build: {{{env.ANTORA_DATE}}}

+
From 43a9dad20f07b3b824bbd9442a77fc24a27edac5 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: May 11 2021 16:21:31 +0000 Subject: [PATCH 47/109] Switch Fedora CoreOS docs build to main branch --- diff --git a/site.yml b/site.yml index 6e2e0a7..05c2030 100644 --- a/site.yml +++ b/site.yml @@ -98,6 +98,7 @@ content: - url: https://pagure.io/fedora-magazine.git - url: https://pagure.io/minimization.git - url: https://github.com/coreos/fedora-coreos-docs.git + branches: main - url: https://pagure.io/cpe/rawhide-gating-docs.git - url: https://pagure.io/cpe/docs.git - url: https://pagure.io/fedora-docs/websites.git From dc55302b64d1513c9de5eee92bcfbc71e05e50eb Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jun 02 2021 10:36:03 +0000 Subject: [PATCH 48/109] support an easy way to add an announcement to the top of every page --- diff --git a/supplemental-ui/layouts/homepage.hbs b/supplemental-ui/layouts/homepage.hbs new file mode 100644 index 0000000..bd2c4d7 --- /dev/null +++ b/supplemental-ui/layouts/homepage.hbs @@ -0,0 +1,59 @@ + + + + + + {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} + {{#if page.canonicalUrl}} + + {{/if}} + {{#if page.description}} + + {{/if}} + {{#if page.keywords}} + + {{/if}} + {{#if (or antoraVersion site.antoraVersion)}} + + {{/if}} + +{{> head}} + + +{{> announcement}} +{{> header}} + + + +
+
+ +
+{{#if (eq page.layout '404')}} +
+

The page you're looking for does not exist. It may have been moved.

+
+
+

If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken. +If you typed the URL of this page manually, please double check that you entered the address correctly.

+
+{{else}} + +{{{page.contents}}} +{{/if}} +
+
+
+ + +{{> footer}} + + diff --git a/supplemental-ui/layouts/with_menu.hbs b/supplemental-ui/layouts/with_menu.hbs new file mode 100644 index 0000000..316c7c6 --- /dev/null +++ b/supplemental-ui/layouts/with_menu.hbs @@ -0,0 +1,28 @@ + + + + + + {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} + {{#if page.canonicalUrl}} + + {{/if}} + {{#if page.description}} + + {{/if}} + {{#if page.keywords}} + + {{/if}} + {{#if (or antoraVersion site.antoraVersion)}} + + {{/if}} + +{{> head}} + + +{{> announcement}} +{{> header}} +{{> main}} +{{> footer}} + + diff --git a/supplemental-ui/layouts/without_menu.hbs b/supplemental-ui/layouts/without_menu.hbs new file mode 100644 index 0000000..910fb6c --- /dev/null +++ b/supplemental-ui/layouts/without_menu.hbs @@ -0,0 +1,35 @@ + + + + + + {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} + {{#if page.canonicalUrl}} + + {{/if}} + {{#if page.description}} + + {{/if}} + {{#if page.keywords}} + + {{/if}} + {{#if (or antoraVersion site.antoraVersion)}} + + {{/if}} + +{{> head}} + + +{{> announcement}} +{{> header}} +
+ +
+{{> toolbar}} +{{> article}} +
+
+ +{{> footer}} + + diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs new file mode 100644 index 0000000..ca86c4b --- /dev/null +++ b/supplemental-ui/partials/announcement.hbs @@ -0,0 +1 @@ + \ No newline at end of file From 00abfe5e0524ea04c8efa45f12e86299fef3b575 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Jun 02 2021 10:43:50 +0000 Subject: [PATCH 49/109] add a fedora survey banner --- diff --git a/supplemental-ui/img/fedora-survey.png b/supplemental-ui/img/fedora-survey.png new file mode 100644 index 0000000..cd4350b Binary files /dev/null and b/supplemental-ui/img/fedora-survey.png differ diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs index ca86c4b..5654a25 100644 --- a/supplemental-ui/partials/announcement.hbs +++ b/supplemental-ui/partials/announcement.hbs @@ -1 +1,5 @@ - \ No newline at end of file + + +
+ +
\ No newline at end of file From 3d58db40665b23e2fcfb141b009deef98b54cff2 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Jun 23 2021 09:53:42 +0000 Subject: [PATCH 50/109] Fix the Containers doc branch --- diff --git a/site.yml b/site.yml index 05c2030..f75d04f 100644 --- a/site.yml +++ b/site.yml @@ -88,6 +88,7 @@ content: - url: https://pagure.io/fedora-badges/docs.git - url: https://pagure.io/fedora-docs/remix-building.git - url: https://github.com/containers/docs.git + branches: main - url: https://pagure.io/neuro-sig/documentation.git branches: main - url: https://pagure.io/sig-teleirc/infrastructure.git From c2c5f46282b8544c10b31042ace5368d204c3186 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jun 23 2021 10:14:07 +0000 Subject: [PATCH 51/109] Bump to F34 & antora 2.3 & node 14 --- diff --git a/Dockerfile b/Dockerfile index e51e4bc..455cdda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM fedora:31 +FROM fedora:34 -RUN dnf -y module install nodejs:10 && \ +RUN dnf -y module install nodejs:14 && \ dnf clean all -RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0 +RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 WORKDIR /antora ENTRYPOINT [ "antora" ] diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index a20ccc6..4fa459f 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,10 +1,10 @@ -FROM fedora:31 +FROM fedora:34 -RUN dnf -y module install nodejs:10/default && \ +RUN dnf -y module install nodejs:14/default && \ dnf -y install git python3-yaml && \ dnf clean all -RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0 +RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 ADD rebuild-site.py /antora/rebuild-site.py From 55b5c96e0627fd19f14f45460e63e72b3cc742c2 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jun 23 2021 10:14:07 +0000 Subject: [PATCH 52/109] disable the edit link for translated pages --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 7801898..5a91a18 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -339,6 +339,8 @@ def main(): # Branches are set to HEAD because the script uses a locally-generated # content on top of the original translated-sources repo lang_site_yml["content"]["branches"] = "HEAD" + # disable the "Edit this Page" + lang_site_yml["content"]["edit_url"] = False lang_site_yml["content"]["sources"] = [] for component, versions in components.items(): From 17d227bebed7c4507324d7ef0dd3a465ca7eefd1 Mon Sep 17 00:00:00 2001 From: Ashlyn Knox Date: Jun 30 2021 16:28:56 +0000 Subject: [PATCH 53/109] removed contributor survey banner --- diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs index 5654a25..ca86c4b 100644 --- a/supplemental-ui/partials/announcement.hbs +++ b/supplemental-ui/partials/announcement.hbs @@ -1,5 +1 @@ - - -
- -
\ No newline at end of file + \ No newline at end of file From 538c38eccafc49cc1dc802821c1ec2cccf869555 Mon Sep 17 00:00:00 2001 From: lilyx Date: Jun 30 2021 17:01:39 +0000 Subject: [PATCH 54/109] removed survey banner image --- diff --git a/supplemental-ui/img/fedora-survey.png b/supplemental-ui/img/fedora-survey.png deleted file mode 100644 index cd4350b..0000000 Binary files a/supplemental-ui/img/fedora-survey.png and /dev/null differ From fb62f81ab74d2b1735d97d85955140625e22dc0a Mon Sep 17 00:00:00 2001 From: lilyx Date: Jul 15 2021 20:35:00 +0000 Subject: [PATCH 55/109] added svg nest banner to top of docs page --- diff --git a/static/nest2021-banner.svg b/static/nest2021-banner.svg new file mode 100644 index 0000000..2dfdb42 --- /dev/null +++ b/static/nest2021-banner.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nest + + + + + + August 5th-7th, register now! + + + Nest with Fedora Join us for this year's contributor conference + + + + + + + + + + + + + + + diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs index ca86c4b..bfe5b69 100644 --- a/supplemental-ui/partials/announcement.hbs +++ b/supplemental-ui/partials/announcement.hbs @@ -1 +1,70 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nest + + + + + + August 5th-7th, register now! + + + Nest with Fedora Join us for this year's contributor conference + + + + + + + + + + + + + + + + \ No newline at end of file From 314195716f9edc4a80f7f2c95b26a16abceb74fb Mon Sep 17 00:00:00 2001 From: lilyx Date: Jul 15 2021 22:09:47 +0000 Subject: [PATCH 56/109] jpg nest banner added to page --- diff --git a/supplemental-ui/img/nest-banner.jpg b/supplemental-ui/img/nest-banner.jpg new file mode 100644 index 0000000..8765fa3 Binary files /dev/null and b/supplemental-ui/img/nest-banner.jpg differ diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs index bfe5b69..cf76ff3 100644 --- a/supplemental-ui/partials/announcement.hbs +++ b/supplemental-ui/partials/announcement.hbs @@ -1,70 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nest - - - - - - August 5th-7th, register now! - - - Nest with Fedora Join us for this year's contributor conference - - - - - - - - - - - - - - - +Fedora Nest Banner \ No newline at end of file From f1294a6a7f4524c0ea72cd806f4e96f5f52664d4 Mon Sep 17 00:00:00 2001 From: lilyx Date: Jul 15 2021 22:35:46 +0000 Subject: [PATCH 57/109] nest banner with styling and proper path --- diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs index cf76ff3..f4834b0 100644 --- a/supplemental-ui/partials/announcement.hbs +++ b/supplemental-ui/partials/announcement.hbs @@ -1,4 +1,6 @@ +
-Fedora Nest Banner - \ No newline at end of file +Fedora Nest Banner + +
\ No newline at end of file From d503c7900f3a5c4bb880b5a436dacb2bc0c3691c Mon Sep 17 00:00:00 2001 From: lilyx Date: Jul 15 2021 22:38:58 +0000 Subject: [PATCH 58/109] removed svg from static files --- diff --git a/static/nest2021-banner.svg b/static/nest2021-banner.svg deleted file mode 100644 index 2dfdb42..0000000 --- a/static/nest2021-banner.svg +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nest - - - - - - August 5th-7th, register now! - - - Nest with Fedora Join us for this year's contributor conference - - - - - - - - - - - - - - - From 23c372240ee09e56702f6c54e719f98a7ef8fadc Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Aug 06 2021 14:36:12 +0000 Subject: [PATCH 59/109] use the 'main' branch for commops --- diff --git a/site.yml b/site.yml index f75d04f..deefe8a 100644 --- a/site.yml +++ b/site.yml @@ -63,6 +63,7 @@ content: - url: https://pagure.io/mentored-projects.git - url: https://pagure.io/fedora-commops.git start_path: docs + branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council branches: main From e13f3c52461dbd1b58d11f7592b68b55bbf9f799 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Aug 23 2021 14:43:17 +0000 Subject: [PATCH 60/109] Add EPEL --- diff --git a/site.yml b/site.yml index deefe8a..2300117 100644 --- a/site.yml +++ b/site.yml @@ -120,6 +120,7 @@ content: - url: https://pagure.io/fedora-server.git branches: main start_path: docs + - url: https://pagure.io/epel.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 3c298a5fd4e6fbb9d5b90bb4eaa15c32a6a3a1ea Mon Sep 17 00:00:00 2001 From: Otto Urpelainen Date: Aug 24 2021 14:54:48 +0000 Subject: [PATCH 61/109] Add package maintainers --- diff --git a/site.yml b/site.yml index 2300117..915f78c 100644 --- a/site.yml +++ b/site.yml @@ -73,6 +73,7 @@ content: - url: https://pagure.io/Fedora-Council/status_reports.git branches: main - url: https://pagure.io/fedora-docs/modularity.git + - url: https://pagure.io/fedora-docs/package-maintainer-docs.git - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-kde/kinoite-docs branches: main From 4d1bea017908088e7874522253b54cbf3ab53ccb Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Aug 26 2021 18:52:07 +0000 Subject: [PATCH 62/109] Remove the Nest banner. Nest is over --- diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs index f4834b0..0237325 100644 --- a/supplemental-ui/partials/announcement.hbs +++ b/supplemental-ui/partials/announcement.hbs @@ -1,6 +1 @@ -
- -Fedora Nest Banner - -
\ No newline at end of file From c3966a086ca229cfac2b9765bf6843d80cd11382 Mon Sep 17 00:00:00 2001 From: Gaurav Tewari Date: Aug 27 2021 02:23:03 +0000 Subject: [PATCH 63/109] nest banner image removed --- diff --git a/supplemental-ui/img/nest-banner.jpg b/supplemental-ui/img/nest-banner.jpg deleted file mode 100644 index 8765fa3..0000000 Binary files a/supplemental-ui/img/nest-banner.jpg and /dev/null differ From 699e27a2fcf55b90d30852b4e7581090bcf655e1 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Aug 27 2021 05:34:04 +0000 Subject: [PATCH 64/109] Update logo --- diff --git a/supplemental-ui/img/docs_logo.png b/supplemental-ui/img/docs_logo.png new file mode 100644 index 0000000..ea87697 Binary files /dev/null and b/supplemental-ui/img/docs_logo.png differ From 9e68d903f90466f64a671895529f2d8468705f47 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Sep 17 2021 14:43:18 +0000 Subject: [PATCH 65/109] Add Infra docs --- diff --git a/site.yml b/site.yml index 915f78c..a95c614 100644 --- a/site.yml +++ b/site.yml @@ -122,6 +122,7 @@ content: branches: main start_path: docs - url: https://pagure.io/epel.git + - url: https://pagure.io/infra-docs-fpo.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 912510336f6e6329c731910233b69dae896e1f4f Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Sep 24 2021 13:02:10 +0000 Subject: [PATCH 66/109] Add Workstation SIG docs --- diff --git a/site.yml b/site.yml index a95c614..07761a6 100644 --- a/site.yml +++ b/site.yml @@ -123,6 +123,7 @@ content: start_path: docs - url: https://pagure.io/epel.git - url: https://pagure.io/infra-docs-fpo.git + - url: https://pagure.io/fedora-workstation/workstation-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From b11673803d3df505e418a55378c7cc3356784f85 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Sep 24 2021 13:04:00 +0000 Subject: [PATCH 67/109] Update WS SIG branch --- diff --git a/site.yml b/site.yml index 07761a6..4369251 100644 --- a/site.yml +++ b/site.yml @@ -124,6 +124,7 @@ content: - url: https://pagure.io/epel.git - url: https://pagure.io/infra-docs-fpo.git - url: https://pagure.io/fedora-workstation/workstation-docs.git + branches: main ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 27b1a795c4cc31006a055d62887bcbfb1f60dfba Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Sep 24 2021 13:31:03 +0000 Subject: [PATCH 68/109] Start publishing releases docs from the PgM repo as a test --- diff --git a/site.yml b/site.yml index 4369251..180be27 100644 --- a/site.yml +++ b/site.yml @@ -108,6 +108,9 @@ content: - url: https://pagure.io/fedora-qa/qa-docs.git - url: https://pagure.io/fedora-pgm/pgm_docs.git branches: main + - url: https://pagure.io/fedora-pgm/pgm_docs.git + branches: main + start_path: releases - url: https://pagure.io/Ask-Fedora-SOP-docs.git - url: https://pagure.io/fedora-join/fedora-join-docs.git - url: https://pagure.io/fedora-docs/localization.git From 06eb9ced1dbba1aaaed1c27b4423bbbd0138ab25 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 04 2021 14:40:44 +0000 Subject: [PATCH 69/109] Switch EPEL from master to main --- diff --git a/site.yml b/site.yml index 180be27..89e487e 100644 --- a/site.yml +++ b/site.yml @@ -125,6 +125,7 @@ content: branches: main start_path: docs - url: https://pagure.io/epel.git + branches: main - url: https://pagure.io/infra-docs-fpo.git - url: https://pagure.io/fedora-workstation/workstation-docs.git branches: main From 37f6fda290aabd2c84421e391f93eb81e5791934 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Nov 02 2021 15:17:18 +0000 Subject: [PATCH 70/109] F35 docs --- diff --git a/site.yml b/site.yml index 89e487e..eeabd9c 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f35 - f34 - f33 - f32 @@ -26,6 +27,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f35 - f34 - f33 - f32 @@ -38,6 +40,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f35 - f34 - f33 - f32 @@ -50,6 +53,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f35 - f34 - f33 - f32 From 890129a0d5ad7c949af9b3ebc73db6f2cf7ea5bb Mon Sep 17 00:00:00 2001 From: Justin W. Flory (he/him) [Fedora Project] Date: Nov 03 2021 16:44:54 +0000 Subject: [PATCH 71/109] Fedora Websites: Swap git repositories used for source content This commit corresponds with the following Fedora W&A docs Pull Request: > https://pagure.io/fedora-websites/pull-request/1113 Once the above Pull Request is merged, the updated content for the Fedora Websites & Apps team can be sourced from that repository, and the old repository may be retired. This Pull Request makes the change to Fedora's Antora config so the documentation will be served from the expected place. Do **NOT** merge this Pull Request/commit before the above Pull Request is merged. Signed-off-by: Justin W. Flory (he/him) [Fedora Project] --- diff --git a/site.yml b/site.yml index eeabd9c..338c0f1 100644 --- a/site.yml +++ b/site.yml @@ -68,6 +68,9 @@ content: - url: https://pagure.io/fedora-commops.git start_path: docs branches: main + - url: https://pagure.io/fedora-websites.git + start_path: docs + branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council branches: main @@ -108,7 +111,6 @@ content: branches: main - url: https://pagure.io/cpe/rawhide-gating-docs.git - url: https://pagure.io/cpe/docs.git - - url: https://pagure.io/fedora-docs/websites.git - url: https://pagure.io/fedora-qa/qa-docs.git - url: https://pagure.io/fedora-pgm/pgm_docs.git branches: main From 5b1d981097fb2d89bd468d8e9346cf0fe6f52ed7 Mon Sep 17 00:00:00 2001 From: Otto Urpelainen Date: Nov 03 2021 16:46:27 +0000 Subject: [PATCH 72/109] Use branch main for Package Maintainer Docs The Package Maintainer Docs have set the Git default branch to 'main' as that seems to be the standard for Fedora repositories. Therefore, it should be used also in the docs-fp-o config. --- diff --git a/site.yml b/site.yml index 338c0f1..79ea0d7 100644 --- a/site.yml +++ b/site.yml @@ -81,6 +81,7 @@ content: branches: main - url: https://pagure.io/fedora-docs/modularity.git - url: https://pagure.io/fedora-docs/package-maintainer-docs.git + branches: main - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-kde/kinoite-docs branches: main From 6ab76f7fb2fb76078b8be438dd8a5060cc006796 Mon Sep 17 00:00:00 2001 From: Justin W. Flory (he/him) [Fedora Project] Date: Nov 03 2021 19:50:31 +0000 Subject: [PATCH 73/109] websites: Change default git branch from master to main (fixes #182) The git repository default branch is `master` and not `main`. `main` does not exist. Fixes #182. Signed-off-by: Justin W. Flory (he/him) [Fedora Project] --- diff --git a/site.yml b/site.yml index 79ea0d7..c96b9ee 100644 --- a/site.yml +++ b/site.yml @@ -70,7 +70,7 @@ content: branches: main - url: https://pagure.io/fedora-websites.git start_path: docs - branches: main + branches: master - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council branches: main From 877a220aaac6d14a536c60f678f8a0b62c73876a Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 26 2021 00:44:48 +0000 Subject: [PATCH 74/109] Add Server WG docs --- diff --git a/site.yml b/site.yml index c96b9ee..74fde5a 100644 --- a/site.yml +++ b/site.yml @@ -131,6 +131,9 @@ content: - url: https://pagure.io/fedora-server.git branches: main start_path: docs + - url: https://pagure.io/fedora-server.git + branches: main + start_path: wg - url: https://pagure.io/epel.git branches: main - url: https://pagure.io/infra-docs-fpo.git From dbc7571db79742133948e9d93c87795a5e410e3b Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Dec 05 2021 18:35:53 +0000 Subject: [PATCH 75/109] Revert "websites: Change default git branch from master to main (fixes #182)" main branch has been created on websites repository and it now the default branch. This reverts commit 6ab76f7fb2fb76078b8be438dd8a5060cc006796. --- diff --git a/site.yml b/site.yml index 74fde5a..4f113f1 100644 --- a/site.yml +++ b/site.yml @@ -70,7 +70,7 @@ content: branches: main - url: https://pagure.io/fedora-websites.git start_path: docs - branches: master + branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council branches: main From dd9cb4f56847eb9a6373be39b27fedb81e0ecd57 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Jan 12 2022 20:17:19 +0000 Subject: [PATCH 76/109] Add Marketing docs --- diff --git a/site.yml b/site.yml index 4f113f1..fc1f3a0 100644 --- a/site.yml +++ b/site.yml @@ -139,6 +139,8 @@ content: - url: https://pagure.io/infra-docs-fpo.git - url: https://pagure.io/fedora-workstation/workstation-docs.git branches: main + - url: https://gitlab.com/fedora/marketing/marketing-docs.git + branches: main ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From a466fc74963fc26ee2c4eb7385123852218bd4e0 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Jan 13 2022 20:52:17 +0000 Subject: [PATCH 77/109] Add the Defensive Coding Guide --- diff --git a/site.yml b/site.yml index fc1f3a0..9cc6b9c 100644 --- a/site.yml +++ b/site.yml @@ -141,6 +141,7 @@ content: branches: main - url: https://gitlab.com/fedora/marketing/marketing-docs.git branches: main + - url: https://pagure.io/defensive-coding-guide.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 63ca895eea094e730c4f5078ee88dd0483716069 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 26 2022 11:41:19 +0000 Subject: [PATCH 78/109] Update ui-bundle to 1.01 --- diff --git a/site.yml b/site.yml index 9cc6b9c..f201169 100644 --- a/site.yml +++ b/site.yml @@ -144,7 +144,7 @@ content: - url: https://pagure.io/defensive-coding-guide.git ui: bundle: - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.01.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 510feba6fc11130d0b3723c0903f601012160a09 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 04 2022 17:37:09 +0000 Subject: [PATCH 79/109] Upgrade to Antora 3.0.0 & node 16 --- diff --git a/Dockerfile b/Dockerfile index 455cdda..dbc89f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM fedora:34 -RUN dnf -y module install nodejs:14 && \ +RUN dnf -y module install nodejs:16 && \ dnf clean all -RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator-default@3.0.0 WORKDIR /antora ENTRYPOINT [ "antora" ] diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index 4fa459f..bc1cfea 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,10 +1,10 @@ FROM fedora:34 -RUN dnf -y module install nodejs:14/default && \ +RUN dnf -y module install nodejs:16/default && \ dnf -y install git python3-yaml && \ dnf clean all -RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator-default@3.0.0 ADD rebuild-site.py /antora/rebuild-site.py diff --git a/site.yml b/site.yml index f201169..cecb488 100644 --- a/site.yml +++ b/site.yml @@ -154,7 +154,7 @@ output: destinations: - provider: archive runtime: - pull: true + fetch: true cache_dir: ./cache asciidoc: extensions: From e40aeb2a9f16a30d3b25a68c006120f25d537c75 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 04 2022 17:37:09 +0000 Subject: [PATCH 80/109] Use fixed antora version for local build --- diff --git a/build.sh b/build.sh index a527e3d..7d1a215 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -image="docker.io/antora/antora" +image="docker.io/antora/antora:3.0.0" cmd="--html-url-extension-style=indexify site.yml" if [ "$(uname)" == "Darwin" ]; then From 75533123661504d0c347e8ebb4468e5992f04e7f Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 04 2022 17:37:09 +0000 Subject: [PATCH 81/109] antora 3.0 require site-generator --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index bc1cfea..d5458ec 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -4,7 +4,7 @@ RUN dnf -y module install nodejs:16/default && \ dnf -y install git python3-yaml && \ dnf clean all -RUN npm i -g @antora/cli@3.0.0 @antora/site-generator-default@3.0.0 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator@3.0.0 ADD rebuild-site.py /antora/rebuild-site.py From 97e5e1a2ec49f459f933239e0d96ef5093908378 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 04 2022 17:37:09 +0000 Subject: [PATCH 82/109] build: optimize temp space --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 5a91a18..bb2ae8b 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -44,7 +44,7 @@ def get_config(): def log(msg): - print(msg) + print(msg, flush=True) def get_languages(config): @@ -370,39 +370,42 @@ def main(): log("ERROR building the {lang} site".format(lang=lang)) sys.exit(1) - # Copying all the translated sites - log("") - log("=== Copying translated sites ===") - - results_dir = os.path.join(docs_repo, "public") - publish_dir = "/antora/output" - copying_dir = os.path.join(publish_dir, "copying.tmp") - - # I have: - # docs_repo/public <- results_dir (local partition) - # /antora/output/copying.tmp <- copying_dir (mounted partition) - # /antora/output <- publish_dir (mounted partition) - # - # I need to: - # 1/ copy from local to mounted - # 2/ remove old in mounted - # 3/ move new within mounted - # 4/ remove the copying dir - - # Make sure copying_dir exists and is empty - shutil.rmtree(copying_dir, ignore_errors=True) - subprocess.run(["mkdir", copying_dir]) - - # Copy results from local partition to a mounted partition - log("Copying between partitions...") - subprocess.run(["cp", "-a", results_dir, "{}/".format(copying_dir)]) - - # Swap the old tree for the new one for each language - log("Moving languages to the final place:") - for lang in languages: - log(" - {}".format(lang)) - shutil.rmtree(os.path.join(publish_dir, lang), ignore_errors=True) - subprocess.run(["mv", os.path.join(copying_dir, "public", lang), "{}/".format(publish_dir)]) + # Copying the translated site + log("") + log(f"=== Copying the {lang} site ===") + + results_dir = os.path.join(docs_repo, "public", lang) + publish_dir = f"/antora/output/{lang}" + copying_dir = f"/antora/output/{lang}.tmp" + + # I have: + # docs_repo/public/xx <- results_dir (local partition) + # /antora/output/xx.tmp <- copying_dir (mounted partition) + # /antora/output/xx <- publish_dir (mounted partition) + # + # I need to: + # 1/ copy from local to mounted + # 2/ remove old in mounted + # 3/ move new within mounted + # 4/ remove the copying dir + + # Make sure copying_dir doesn't exist + shutil.rmtree(copying_dir, ignore_errors=True) + + # Copy results from local partition to a mounted partition + log(f"Copying from {results_dir} to {copying_dir}") + subprocess.run(["cp", "-a", results_dir, copying_dir]) + + # Swap the old tree for the new one for each language + log("Moving language to the final place:") + log(f" - {copying_dir} to {publish_dir}") + shutil.rmtree(publish_dir, ignore_errors=True) + subprocess.run(["mv", copying_dir, publish_dir]) + + # Remove local build + shutil.rmtree(results_dir, ignore_errors=True) + + # End Building all the translated sites # https://pagure.io/fedora-infrastructure/issue/8964 log("Consolidate files with hardlink...") From a4bf3ce849d5dfadd935423ea6a24500ebcd3773 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Feb 04 2022 17:37:09 +0000 Subject: [PATCH 83/109] add localization support for asciidoc attributes --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index bb2ae8b..19bc0e7 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -17,7 +17,7 @@ # -import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys +import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys, glob def get_config(): @@ -39,6 +39,10 @@ def get_config(): "TRANSLATED_SOURCES_REPO_URL", "https://pagure.io/fedora-docs/translated-sources.git" ) + + config["translated_adockeywords_repo_url"] = os.getenv( + "TRANSLATED_ADOCKEYWORDS_REPO_URL", + "https://pagure.io/fedora-docs-l10n/asciidoc-keywords.git") return config @@ -218,6 +222,30 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): return components +def prepare_localized_admonitions(languages, config): + """ Asciidoc use keywords for admonitions and others items """ + keywords = {} + + with tempfile.TemporaryDirectory() as workdir: + translated_keywords_repo = os.path.join(workdir, "asciidoc-keywords") + subprocess.run(["git", "clone", config["translated_adockeywords_repo_url"], translated_keywords_repo]) + + languages = [] + log(translated_keywords_repo + "/langs/*/asciidoc-attributes.yml") + for filename in glob.glob(translated_keywords_repo + "/langs/*/asciidoc-attributes.yml"): + languages.append(filename.rsplit("/")[::-1][1]) + + for lang in languages: + file = translated_keywords_repo + "/langs/" + lang + "/asciidoc-attributes.yml" + with open(file, 'r') as stream: + try: + keywords[lang] = yaml.load(stream) + except yaml.YAMLError as exc: + print(exc) + + return keywords + + def init_git_repo(path): try: os.makedirs(path) @@ -329,6 +357,10 @@ def main(): components = prepare_translated_sources(translated_sources, original_site_yml, languages, config) log("") + log("===== Preparing the translated ascidoc keywords =====") + keywords = prepare_localized_admonitions(languages, config) + + log("") log("===== Generating site.lang.yml files =====") for lang in languages: lang_site_yml = copy.deepcopy(original_site_yml) @@ -352,6 +384,12 @@ def main(): lang_site_yml["content"]["sources"].append(source) + if lang in keywords: + if "attributes" in lang_site_yml["asciidoc"]: + lang_site_yml["asciidoc"]["attributes"].append(keywords[lang]) + else: + lang_site_yml["asciidoc"]["attributes"] = keywords[lang] + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) with open(filename, "w") as file: file.write(yaml.dump(lang_site_yml)) From de7c9ee0358f135c2654864a9eecb267c39c1e82 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 04 2022 17:37:09 +0000 Subject: [PATCH 84/109] remove duplicate elements from fedora-docs-ui --- diff --git a/supplemental-ui/img/docs_logo.png b/supplemental-ui/img/docs_logo.png deleted file mode 100644 index ea87697..0000000 Binary files a/supplemental-ui/img/docs_logo.png and /dev/null differ diff --git a/supplemental-ui/layouts/homepage.hbs b/supplemental-ui/layouts/homepage.hbs deleted file mode 100644 index bd2c4d7..0000000 --- a/supplemental-ui/layouts/homepage.hbs +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} - {{#if page.canonicalUrl}} - - {{/if}} - {{#if page.description}} - - {{/if}} - {{#if page.keywords}} - - {{/if}} - {{#if (or antoraVersion site.antoraVersion)}} - - {{/if}} - -{{> head}} - - -{{> announcement}} -{{> header}} - - - -
-
- -
-{{#if (eq page.layout '404')}} -
-

The page you're looking for does not exist. It may have been moved.

-
-
-

If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken. -If you typed the URL of this page manually, please double check that you entered the address correctly.

-
-{{else}} - -{{{page.contents}}} -{{/if}} -
-
-
- - -{{> footer}} - - diff --git a/supplemental-ui/layouts/with_menu.hbs b/supplemental-ui/layouts/with_menu.hbs deleted file mode 100644 index 316c7c6..0000000 --- a/supplemental-ui/layouts/with_menu.hbs +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} - {{#if page.canonicalUrl}} - - {{/if}} - {{#if page.description}} - - {{/if}} - {{#if page.keywords}} - - {{/if}} - {{#if (or antoraVersion site.antoraVersion)}} - - {{/if}} - -{{> head}} - - -{{> announcement}} -{{> header}} -{{> main}} -{{> footer}} - - diff --git a/supplemental-ui/layouts/without_menu.hbs b/supplemental-ui/layouts/without_menu.hbs deleted file mode 100644 index 910fb6c..0000000 --- a/supplemental-ui/layouts/without_menu.hbs +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} - {{#if page.canonicalUrl}} - - {{/if}} - {{#if page.description}} - - {{/if}} - {{#if page.keywords}} - - {{/if}} - {{#if (or antoraVersion site.antoraVersion)}} - - {{/if}} - -{{> head}} - - -{{> announcement}} -{{> header}} -
- -
-{{> toolbar}} -{{> article}} -
-
- -{{> footer}} - - diff --git a/supplemental-ui/partials/footer-content.hbs b/supplemental-ui/partials/footer-content.hbs deleted file mode 100644 index 8488b7b..0000000 --- a/supplemental-ui/partials/footer-content.hbs +++ /dev/null @@ -1,4 +0,0 @@ -
-

All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.

-

Last build: {{{env.ANTORA_DATE}}}

-
diff --git a/supplemental-ui/partials/page-languages.hbs b/supplemental-ui/partials/page-languages.hbs deleted file mode 100644 index b5858f3..0000000 --- a/supplemental-ui/partials/page-languages.hbs +++ /dev/null @@ -1,6 +0,0 @@ -
- -
- en-US -
-
From 687cf7e302cbe70d6361356cf42b390da7e1e546 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 04 2022 17:37:09 +0000 Subject: [PATCH 85/109] fix component version if set to null --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 19bc0e7..628626f 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -167,6 +167,9 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): component = antora_yml["name"] version = antora_yml["version"] + # if component version is null (~), fallback to "master" + if not version: + version = "master" # Saving components and all their versions if component not in components: From 1bb77a1cf73d58f9cb453d177ba219dd4ff541a6 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 05 2022 02:54:24 +0000 Subject: [PATCH 86/109] hardlink after each lang built --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 628626f..10b47c7 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -446,11 +446,14 @@ def main(): # Remove local build shutil.rmtree(results_dir, ignore_errors=True) + # https://pagure.io/fedora-infrastructure/issue/8964 + # We do that at each iteration as proxies sync may happen before + # the end of the entire loop + log("Consolidate files with hardlink...") + subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)]) + # End Building all the translated sites - # https://pagure.io/fedora-infrastructure/issue/8964 - log("Consolidate files with hardlink...") - subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)]) # And finally remove the copying dir log("Removing the copying dir...") From b9b74d3a54f78ca67355c75b47aaf54da834ad26 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 05 2022 04:08:22 +0000 Subject: [PATCH 87/109] Revert "hardlink after each lang built" This reverts commit 1bb77a1cf73d58f9cb453d177ba219dd4ff541a6. --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 10b47c7..628626f 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -446,14 +446,11 @@ def main(): # Remove local build shutil.rmtree(results_dir, ignore_errors=True) - # https://pagure.io/fedora-infrastructure/issue/8964 - # We do that at each iteration as proxies sync may happen before - # the end of the entire loop - log("Consolidate files with hardlink...") - subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)]) - # End Building all the translated sites + # https://pagure.io/fedora-infrastructure/issue/8964 + log("Consolidate files with hardlink...") + subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)]) # And finally remove the copying dir log("Removing the copying dir...") From 4dd6ceeb2fbcc9cac205f77b2e6c7a28bde08954 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 05 2022 04:08:27 +0000 Subject: [PATCH 88/109] Revert "build: optimize temp space" This reverts commit 97e5e1a2ec49f459f933239e0d96ef5093908378. --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 628626f..861b794 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -48,7 +48,7 @@ def get_config(): def log(msg): - print(msg, flush=True) + print(msg) def get_languages(config): @@ -411,42 +411,39 @@ def main(): log("ERROR building the {lang} site".format(lang=lang)) sys.exit(1) - # Copying the translated site - log("") - log(f"=== Copying the {lang} site ===") - - results_dir = os.path.join(docs_repo, "public", lang) - publish_dir = f"/antora/output/{lang}" - copying_dir = f"/antora/output/{lang}.tmp" - - # I have: - # docs_repo/public/xx <- results_dir (local partition) - # /antora/output/xx.tmp <- copying_dir (mounted partition) - # /antora/output/xx <- publish_dir (mounted partition) - # - # I need to: - # 1/ copy from local to mounted - # 2/ remove old in mounted - # 3/ move new within mounted - # 4/ remove the copying dir - - # Make sure copying_dir doesn't exist - shutil.rmtree(copying_dir, ignore_errors=True) - - # Copy results from local partition to a mounted partition - log(f"Copying from {results_dir} to {copying_dir}") - subprocess.run(["cp", "-a", results_dir, copying_dir]) - - # Swap the old tree for the new one for each language - log("Moving language to the final place:") - log(f" - {copying_dir} to {publish_dir}") - shutil.rmtree(publish_dir, ignore_errors=True) - subprocess.run(["mv", copying_dir, publish_dir]) - - # Remove local build - shutil.rmtree(results_dir, ignore_errors=True) - - # End Building all the translated sites + # Copying all the translated sites + log("") + log("=== Copying translated sites ===") + + results_dir = os.path.join(docs_repo, "public") + publish_dir = "/antora/output" + copying_dir = os.path.join(publish_dir, "copying.tmp") + + # I have: + # docs_repo/public <- results_dir (local partition) + # /antora/output/copying.tmp <- copying_dir (mounted partition) + # /antora/output <- publish_dir (mounted partition) + # + # I need to: + # 1/ copy from local to mounted + # 2/ remove old in mounted + # 3/ move new within mounted + # 4/ remove the copying dir + + # Make sure copying_dir exists and is empty + shutil.rmtree(copying_dir, ignore_errors=True) + subprocess.run(["mkdir", copying_dir]) + + # Copy results from local partition to a mounted partition + log("Copying between partitions...") + subprocess.run(["cp", "-a", results_dir, "{}/".format(copying_dir)]) + + # Swap the old tree for the new one for each language + log("Moving languages to the final place:") + for lang in languages: + log(" - {}".format(lang)) + shutil.rmtree(os.path.join(publish_dir, lang), ignore_errors=True) + subprocess.run(["mv", os.path.join(copying_dir, "public", lang), "{}/".format(publish_dir)]) # https://pagure.io/fedora-infrastructure/issue/8964 log("Consolidate files with hardlink...") From 7e75078a8b04abb1046c97b6c4521c2b0e252048 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 09 2022 07:55:08 +0000 Subject: [PATCH 89/109] hardlinking each lang: take 2 --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 861b794..fde6c07 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -48,7 +48,7 @@ def get_config(): def log(msg): - print(msg) + print(msg, flush=True) def get_languages(config): @@ -400,6 +400,7 @@ def main(): log(" {lang} done".format(lang=lang)) # Building all the translated sites + lastlang = list(languages)[-1] for lang in languages: log("") log("===== Building the {lang} site =====".format(lang=lang)) @@ -411,47 +412,52 @@ def main(): log("ERROR building the {lang} site".format(lang=lang)) sys.exit(1) - # Copying all the translated sites - log("") - log("=== Copying translated sites ===") - - results_dir = os.path.join(docs_repo, "public") - publish_dir = "/antora/output" - copying_dir = os.path.join(publish_dir, "copying.tmp") - - # I have: - # docs_repo/public <- results_dir (local partition) - # /antora/output/copying.tmp <- copying_dir (mounted partition) - # /antora/output <- publish_dir (mounted partition) - # - # I need to: - # 1/ copy from local to mounted - # 2/ remove old in mounted - # 3/ move new within mounted - # 4/ remove the copying dir - - # Make sure copying_dir exists and is empty - shutil.rmtree(copying_dir, ignore_errors=True) - subprocess.run(["mkdir", copying_dir]) - - # Copy results from local partition to a mounted partition - log("Copying between partitions...") - subprocess.run(["cp", "-a", results_dir, "{}/".format(copying_dir)]) - - # Swap the old tree for the new one for each language - log("Moving languages to the final place:") - for lang in languages: - log(" - {}".format(lang)) - shutil.rmtree(os.path.join(publish_dir, lang), ignore_errors=True) - subprocess.run(["mv", os.path.join(copying_dir, "public", lang), "{}/".format(publish_dir)]) + # Copying the translated site + log("") + log(f"=== Copying the {lang} site ===") + + results_dir = os.path.join(docs_repo, "public", lang) + publish_dir = f"/antora/output/{lang}" + copying_dir = f"/antora/output/{lang}.tmp" + lastlang_dir = f"/antora/output/{lastlang}" + + # I have: + # docs_repo/public/xx <- results_dir (local partition) + # /antora/output/xx.tmp <- copying_dir (mounted partition) + # /antora/output/xx <- publish_dir (mounted partition) + # + # I need to: + # 1/ copy from local to mounted + # 2/ remove old in mounted + # 3/ move new within mounted + # 4/ remove the copying dir + + # Make sure copying_dir doesn't exist + shutil.rmtree(copying_dir, ignore_errors=True) + + # Copy results from local partition to a mounted partition + log(f"Copying from {results_dir} to {copying_dir}") + subprocess.run(["cp", "-a", results_dir, copying_dir]) + + # Swap the old tree for the new one for each language + log(f"Moving language to the final place: {copying_dir} to {publish_dir}") + shutil.rmtree(publish_dir, ignore_errors=True) + subprocess.run(["mv", copying_dir, publish_dir]) + + # Recreate hardlinks as we go, in case the rsync job + # start while we are still building + if (lang != lastlang): + log(f"hardlinking files: {publish_dir} - {lastlang_dir}") + subprocess.run(["hardlink", "-cv", publish_dir, lastlang_dir]) + + # Remove local build + shutil.rmtree(results_dir, ignore_errors=True) + + # End Building all the translated sites # https://pagure.io/fedora-infrastructure/issue/8964 log("Consolidate files with hardlink...") - subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)]) - - # And finally remove the copying dir - log("Removing the copying dir...") - shutil.rmtree(copying_dir, ignore_errors=True) + subprocess.run(["hardlink", "-cv", "/antora/output/"]) log("DONE!") From 66b33088ff002cc1839d7efcfb900ee2ce593b74 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 09 2022 07:56:00 +0000 Subject: [PATCH 90/109] lower log level --- diff --git a/site.yml b/site.yml index cecb488..f09cfd3 100644 --- a/site.yml +++ b/site.yml @@ -156,6 +156,9 @@ output: runtime: fetch: true cache_dir: ./cache + log: + format: pretty + level: fatal asciidoc: extensions: - ./lib/extensions/package-inline-macro.js From dcf2377c2e59cd0f04d62cda9b61429156ff9067 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 09 2022 07:56:04 +0000 Subject: [PATCH 91/109] use shallow clone everywhere we can --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index fde6c07..96c54f0 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -56,7 +56,7 @@ def get_languages(config): with tempfile.TemporaryDirectory() as workdir: translated_sources_repo = os.path.join(workdir, "translated_sources_repo") - subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_repo]) + subprocess.run(["git", "clone", "--depth=1", config["translated_sources_repo_url"], translated_sources_repo]) languages = [] filename_blacklist = [".git"] @@ -127,7 +127,7 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): en_sources = os.path.join(workdir, "en_sources") # Clone the original translated-sources - subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_original]) + subprocess.run(["git", "clone", "--depth=1", config["translated_sources_repo_url"], translated_sources_original]) # Get a list of the original English repos repos = [] @@ -158,7 +158,7 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): with tempfile.TemporaryDirectory() as tmp_repo_root: log("") log("Cloning {url} {branch}".format(url=repo["url"], branch=repo["branch"])) - subprocess.run(["git", "clone", "--branch", repo["branch"], repo["url"], tmp_repo_root]) + subprocess.run(["git", "clone", "--branch", repo["branch"], "--depth=1", repo["url"], tmp_repo_root]) repo_dir = os.path.join(tmp_repo_root, repo["start_path"]) antora_yml_file = os.path.join(repo_dir, "antora.yml") @@ -231,7 +231,7 @@ def prepare_localized_admonitions(languages, config): with tempfile.TemporaryDirectory() as workdir: translated_keywords_repo = os.path.join(workdir, "asciidoc-keywords") - subprocess.run(["git", "clone", config["translated_adockeywords_repo_url"], translated_keywords_repo]) + subprocess.run(["git", "clone", "--depth=1", config["translated_adockeywords_repo_url"], translated_keywords_repo]) languages = [] log(translated_keywords_repo + "/langs/*/asciidoc-attributes.yml") @@ -281,7 +281,7 @@ def main(): log("") log("===== Getting the site definition (site.yml) =====") - subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], config["docs_repo_url"], docs_repo]) + subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], "--depth=1", config["docs_repo_url"], docs_repo]) with open(os.path.join(docs_repo, "site.yml"), "r") as file: original_site_yml = yaml.safe_load(file) From adb5549e3b8a961bedca502fd1005627ea144169 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 10 2022 21:17:20 +0000 Subject: [PATCH 92/109] Update ui-bundle to 1.02 --- diff --git a/site.yml b/site.yml index f09cfd3..a484e40 100644 --- a/site.yml +++ b/site.yml @@ -144,7 +144,7 @@ content: - url: https://pagure.io/defensive-coding-guide.git ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.01.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.02.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 23d6111f22c59501b9e8e42e431941724a4314e8 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 18 2022 17:12:45 +0000 Subject: [PATCH 93/109] Remove Taiga docs --- diff --git a/site.yml b/site.yml index a484e40..fa10d6a 100644 --- a/site.yml +++ b/site.yml @@ -105,7 +105,6 @@ content: start_path: docs - url: https://pagure.io/fedora-ci/docs.git - url: https://pagure.io/java-packaging-howto.git - - url: https://pagure.io/fedora-docs/taiga-docs.git - url: https://pagure.io/fedora-magazine.git - url: https://pagure.io/minimization.git - url: https://github.com/coreos/fedora-coreos-docs.git From 23ade7fc6fdc80757e7f81e40cc7333676334660 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 23 2022 16:47:39 +0000 Subject: [PATCH 94/109] Fix profile name for nodejs dnf module --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index d5458ec..acbf5e7 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,6 +1,6 @@ FROM fedora:34 -RUN dnf -y module install nodejs:16/default && \ +RUN dnf -y module install nodejs:16 && \ dnf -y install git python3-yaml && \ dnf clean all From 612805807e72fdc5abf419a73abfa7d524c8f6e0 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 23 2022 16:51:53 +0000 Subject: [PATCH 95/109] update UI to 1.04 --- diff --git a/site.yml b/site.yml index fa10d6a..06c226d 100644 --- a/site.yml +++ b/site.yml @@ -143,7 +143,7 @@ content: - url: https://pagure.io/defensive-coding-guide.git ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.02.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.04.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 0c653487b4d7f3e932b0c69dc0f5cf89b67a2002 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:06:44 +0000 Subject: [PATCH 96/109] extension to retrieve last-update information from git --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 96c54f0..f4d71eb 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -111,6 +111,20 @@ def generate_lang_switch_ui(languages): return "\n".join(template_list) +def prefetch_sources(original_sources, site_yml, config): + if not os.path.isdir(original_sources): + os.mkdir(original_sources) + + for repo_data in site_yml["content"]["sources"]: + gitdir = tempfile.TemporaryDirectory(dir=original_sources) + dirname = gitdir.name + gitdir.cleanup() + log(f"Fetching {repo_data['url']}...") + subprocess.run(["git", "clone", repo_data['url'], dirname]) + repo_data['url'] = dirname + + return site_yml + def prepare_translated_sources(translated_sources, site_yml, languages, config): with tempfile.TemporaryDirectory() as workdir: # Location of the translated-sources repo @@ -320,9 +334,23 @@ def main(): if config["build_langs"] == "english" or config["build_langs"] == "all": log("") + log("===== Prefetching all components =====") + original_sources = os.path.join(workdir, "orginal_sources") + site_local = prefetch_sources(original_sources, original_site_yml, config) + log(original_site_yml["content"]["sources"][0]['url']) + log(site_local["content"]["sources"][0]['url']) + + filename = os.path.join(docs_repo, "site-local.yml") + with open(filename, "w") as file: + file.write(yaml.dump(site_local)) + + + + log("") log("===== Building the en-US site =====") antora_env["ANTORA_LANGUAGE"] = "en-US" - result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) + # result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) + result = subprocess.run(["antora", "--html-url-extension-style=indexify", filename], env=antora_env) if result.returncode != 0: log("ERROR building the en-US site") diff --git a/lib/extensions/page-last-update.js b/lib/extensions/page-last-update.js new file mode 100644 index 0000000..a2bfaf2 --- /dev/null +++ b/lib/extensions/page-last-update.js @@ -0,0 +1,29 @@ + +module.exports.register = function () { + this.on('contentClassified', async ({ contentCatalog }) => { + const logger = this.require('@antora/logger').get('page-last-update') + const git = this.require('@antora/content-aggregator/lib/git') + const path = this.require('path') + const fs = this.require('fs') + // logger.warn(contentCatalog) + + const pages = contentCatalog.findBy({ family: 'page' }) + for (const module of pages) { + const relpath = path.join(module.src.origin.startPath, module.src.path) + logger.warn(relpath) + // logger.warn(module.src) + const contents = module.contents.toString('utf-8') + + // logger.warn(module.contents) + const commits = await git.log({ fs, gitdir: module.src.origin.gitdir, filepath: relpath, ref: "origin/"+module.src.origin.refname, follow: true, depth: 1 }) + const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] + const last_author = commits[0].commit.author.name + // logger.warn(commits) + // logger.warn({ name: relpath, created_at: created_at, last_update: last_update, by: last_author }) + const patchedContents = ":page-last-updated: " + last_update + "\n" + contents + module.contents = Buffer.from(patchedContents) + + } + this.updateVariables({ contentCatalog }) + }) +} diff --git a/site.yml b/site.yml index 06c226d..01812ea 100644 --- a/site.yml +++ b/site.yml @@ -161,3 +161,9 @@ runtime: asciidoc: extensions: - ./lib/extensions/package-inline-macro.js +antora: + extensions: + - ./lib/extensions/page-last-update.js +urls: + latest_version_segment: latest + From ef413fa1fc9746e9b6f3535655076d22d0ea7b13 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:06:56 +0000 Subject: [PATCH 97/109] generate htaccess for redirect --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index f4d71eb..3319566 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -274,6 +274,15 @@ def init_git_repo(path): subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) +def gen_redirect(lang, results_dir): + htaccess = os.path.join(results_dir, ".htaccess") + latest = "f35" + htaccess_content = f""" + ErrorDocument 404 /{lang}/404.html + Redirect 302 /{lang}/fedora/{latest} /{lang}/fedora/latest + """ + with open(htaccess, "w") as file: + file.write(htaccess_content) def main(): config = get_config() @@ -362,6 +371,10 @@ def main(): target_dir_copying = "/antora/output/en-US.building" target_dir_copied = "/antora/output/en-US.building/en-US" target_dir_final = "/antora/output/en-US" + + # Generate htaccess for redirect + gen_redirect("en-US", os.path.join(source_dir, "en-US")) + shutil.rmtree(target_dir_copying, ignore_errors=True) subprocess.run(["cp", "-a", source_dir, target_dir_copying]) shutil.rmtree(target_dir_final, ignore_errors=True) @@ -460,6 +473,9 @@ def main(): # 3/ move new within mounted # 4/ remove the copying dir + # Generate htaccess for redirect + gen_redirect(lang, results_dir) + # Make sure copying_dir doesn't exist shutil.rmtree(copying_dir, ignore_errors=True) From 78826440ad4946524037142aa3472be77fbd04c6 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:07:29 +0000 Subject: [PATCH 98/109] catch git error --- diff --git a/lib/extensions/page-last-update.js b/lib/extensions/page-last-update.js index a2bfaf2..e0a1ae5 100644 --- a/lib/extensions/page-last-update.js +++ b/lib/extensions/page-last-update.js @@ -1,29 +1,35 @@ module.exports.register = function () { this.on('contentClassified', async ({ contentCatalog }) => { - const logger = this.require('@antora/logger').get('page-last-update') - const git = this.require('@antora/content-aggregator/lib/git') - const path = this.require('path') - const fs = this.require('fs') - // logger.warn(contentCatalog) + const logger = this.require('@antora/logger').get('page-last-update') + const git = this.require('@antora/content-aggregator/lib/git') + const path = this.require('path') + const fs = this.require('fs') + // logger.warn(contentCatalog) - const pages = contentCatalog.findBy({ family: 'page' }) - for (const module of pages) { - const relpath = path.join(module.src.origin.startPath, module.src.path) - logger.warn(relpath) - // logger.warn(module.src) - const contents = module.contents.toString('utf-8') + const pages = contentCatalog.findBy({ family: 'page' }) + for (const page of pages) { + const relpath = path.join(page.src.origin.startPath, page.src.path) + logger.warn(relpath) + const contents = page.contents.toString('utf-8') - // logger.warn(module.contents) - const commits = await git.log({ fs, gitdir: module.src.origin.gitdir, filepath: relpath, ref: "origin/"+module.src.origin.refname, follow: true, depth: 1 }) - const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] - const last_author = commits[0].commit.author.name - // logger.warn(commits) - // logger.warn({ name: relpath, created_at: created_at, last_update: last_update, by: last_author }) - const patchedContents = ":page-last-updated: " + last_update + "\n" + contents - module.contents = Buffer.from(patchedContents) + // Get git history + try { + const commits = await git.log({ fs, gitdir: page.src.origin.gitdir, filepath: relpath, ref: "origin/"+page.src.origin.refname, follow: true, depth: 1 }) + // Get last commit date & author + const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] + const last_author = commits[0].commit.author.name + + // Inject attribute in page content + const patchedContents = ":page-last-updated: " + last_update + "\n" + contents + page.contents = Buffer.from(patchedContents) + } catch (gitErr) { + logger.error("no history found") + continue } - this.updateVariables({ contentCatalog }) - }) + + } + this.updateVariables({ contentCatalog }) + }) } From fd362edf05f72775f4e71389fc78febd9a26aa96 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:17:48 +0000 Subject: [PATCH 99/109] disable page-last-update ext for translated docs --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 3319566..c11307d 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -434,6 +434,12 @@ def main(): else: lang_site_yml["asciidoc"]["attributes"] = keywords[lang] + # disable page-last-update extension + if "antora" in lang_site_yml and "extensions" in lang_site_yml["antora"]: + for ext in lang_site_yml["antora"]["extensions"]: + if ext['id'] == "page-last-update": + ext['enabled'] = False + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) with open(filename, "w") as file: file.write(yaml.dump(lang_site_yml)) diff --git a/site.yml b/site.yml index 01812ea..2b108c2 100644 --- a/site.yml +++ b/site.yml @@ -163,7 +163,9 @@ asciidoc: - ./lib/extensions/package-inline-macro.js antora: extensions: - - ./lib/extensions/page-last-update.js + - id: page-last-update + require: ./lib/extensions/page-last-update.js + enabled: true urls: latest_version_segment: latest From 5438c7f01aa804825a2ee8a3c526b0a5374fa26b Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:17:50 +0000 Subject: [PATCH 100/109] detect latest fedora version and build redirect from it --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index c11307d..fb07937 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -17,7 +17,17 @@ # -import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys, glob +import tempfile +import yaml +import os +import errno +import subprocess +import copy +import datetime +import shutil +import sys +import glob +import re def get_config(): @@ -274,15 +284,28 @@ def init_git_repo(path): subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) +def get_version_from_file(index_file): + latest = None + if os.path.isfile(index_file): + with open(index_file, 'r') as f: + for l in f: + m = re.search(r'data-version="(f\d+)"', l) + if m: + latest = m[1] + break + return latest + + def gen_redirect(lang, results_dir): htaccess = os.path.join(results_dir, ".htaccess") - latest = "f35" - htaccess_content = f""" - ErrorDocument 404 /{lang}/404.html - Redirect 302 /{lang}/fedora/{latest} /{lang}/fedora/latest - """ - with open(htaccess, "w") as file: - file.write(htaccess_content) + latest = get_version_from_file(f"{results_dir}/fedora/latest/index.html") + if latest: + htaccess_content = f""" + ErrorDocument 404 /{lang}/404.html + Redirect 302 /{lang}/fedora/{latest} /{lang}/fedora/latest + """ + with open(htaccess, "w") as file: + file.write(htaccess_content) def main(): config = get_config() From 6e968a3b3fded860f4bd26e666f16cb3bed74130 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:17:50 +0000 Subject: [PATCH 101/109] use pregenerated metadata from git in last-update extension --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index fb07937..efd0752 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -121,10 +121,24 @@ def generate_lang_switch_ui(languages): return "\n".join(template_list) +def get_metadata_from_branch(branch, repodir): + cmd = f""" + for file in $(git ls-tree -r --name-only origin/{branch}|grep -E "adoc$"); do + git log -1 --format="'$file':%n refs: %S%n hash: %h%n date: %as" origin/{branch} -- $file; + done""" + s = subprocess.run(cmd, shell=True, cwd=repodir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + return yaml.safe_load(s.stdout) + def prefetch_sources(original_sources, site_yml, config): if not os.path.isdir(original_sources): os.mkdir(original_sources) + default_branch = site_yml["content"].get("branches", ["master"]) + if type(default_branch) is str: + default_branch = [default_branch] + + metadata = {} + for repo_data in site_yml["content"]["sources"]: gitdir = tempfile.TemporaryDirectory(dir=original_sources) dirname = gitdir.name @@ -133,6 +147,21 @@ def prefetch_sources(original_sources, site_yml, config): subprocess.run(["git", "clone", repo_data['url'], dirname]) repo_data['url'] = dirname + branches = repo_data.get("branches", default_branch) + if type(branches) is str: + branches = [branches] + + for branch in branches: + y = get_metadata_from_branch(branch, repo_data['url']) + if dirname in metadata: + metadata[dirname][branch] = y + else: + metadata[dirname] = { branch: y } + + if metadata: + with open("/tmp/metadata.yml", "w") as f: + yaml.dump(metadata, f) + return site_yml def prepare_translated_sources(translated_sources, site_yml, languages, config): diff --git a/lib/extensions/page-last-update.js b/lib/extensions/page-last-update.js index e0a1ae5..c60629f 100644 --- a/lib/extensions/page-last-update.js +++ b/lib/extensions/page-last-update.js @@ -2,33 +2,36 @@ module.exports.register = function () { this.on('contentClassified', async ({ contentCatalog }) => { const logger = this.require('@antora/logger').get('page-last-update') - const git = this.require('@antora/content-aggregator/lib/git') + const yaml = this.require('js-yaml') const path = this.require('path') const fs = this.require('fs') - // logger.warn(contentCatalog) - const pages = contentCatalog.findBy({ family: 'page' }) - for (const page of pages) { - const relpath = path.join(page.src.origin.startPath, page.src.path) - logger.warn(relpath) - const contents = page.contents.toString('utf-8') - - // Get git history - try { - const commits = await git.log({ fs, gitdir: page.src.origin.gitdir, filepath: relpath, ref: "origin/"+page.src.origin.refname, follow: true, depth: 1 }) - - // Get last commit date & author - const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] - const last_author = commits[0].commit.author.name + const pageRx = new RegExp('modules/[^/]+/pages/(?:.+/)*[^.].*\.adoc$') - // Inject attribute in page content - const patchedContents = ":page-last-updated: " + last_update + "\n" + contents - page.contents = Buffer.from(patchedContents) - } catch (gitErr) { - logger.error("no history found") - continue + if (fs.existsSync("/tmp/metadata.yml")) { + let data = fs.readFileSync("/tmp/metadata.yml", "utf-8") + let y = yaml.loadAll(data) + + for (const page of pages) { + if (page.src.origin.type == "git" && pageRx.test(page.src.path)) { + const relpath = path.join(page.src.origin.startPath, page.src.path) + const abspath = page.src.origin.gitdir.replace(/\/\.git$/, "") + // logger.warn(abspath) + const contents = page.contents.toString('utf-8') + const branch = page.src.origin.branch + if (abspath in y[0] && branch in y[0][abspath] && relpath in y[0][abspath][branch]) { + let last_update = y[0][abspath][branch][relpath]["date"].toISOString().split('T')[0] + logger.warn({name: relpath, rev: branch, update: last_update}) + + // Inject attribute in page content + const patchedContents = ":page-last-updated: " + last_update + "\n" + contents + page.contents = Buffer.from(patchedContents) + } + } } + } else { + logger.warn("no git metadata found, skipping...") } this.updateVariables({ contentCatalog }) }) From 2feaa1946099585cb2a657e72f8b6fb30c60d4d0 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:17:50 +0000 Subject: [PATCH 102/109] update UI to 1.08 --- diff --git a/site.yml b/site.yml index 2b108c2..1497166 100644 --- a/site.yml +++ b/site.yml @@ -143,7 +143,7 @@ content: - url: https://pagure.io/defensive-coding-guide.git ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.04.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.08.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From b2ab1d8ec1ef2fac5a14fbe0baec264e380dea59 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:17:50 +0000 Subject: [PATCH 103/109] fix edit_url links --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index efd0752..5caa357 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -54,6 +54,8 @@ def get_config(): "TRANSLATED_ADOCKEYWORDS_REPO_URL", "https://pagure.io/fedora-docs-l10n/asciidoc-keywords.git") + os.environ['CI'] = "true" + return config From 57297ceff7c30f1489f758e8c415e7e550e074c0 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 03 2022 20:17:50 +0000 Subject: [PATCH 104/109] fix build with extension without id --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 5caa357..a29e815 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -491,7 +491,7 @@ def main(): # disable page-last-update extension if "antora" in lang_site_yml and "extensions" in lang_site_yml["antora"]: for ext in lang_site_yml["antora"]["extensions"]: - if ext['id'] == "page-last-update": + if 'id' in ext and ext['id'] == "page-last-update": ext['enabled'] = False filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) From 349ddc690fec55a9728e1ff85906690630154095 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 13 2022 19:50:30 +0000 Subject: [PATCH 105/109] move documentation-contributors-guide to gitlab --- diff --git a/site.yml b/site.yml index 1497166..f47dcc3 100644 --- a/site.yml +++ b/site.yml @@ -85,7 +85,8 @@ content: - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-kde/kinoite-docs branches: main - - url: https://pagure.io/fedora-docs/documentation-contributors-guide.git + - url: https://gitlab.com/fedora/docs/community-tools/documentation-contributors-guide.git + branches: main - url: https://pagure.io/fedora-docs/flatpak.git - url: https://pagure.io/fedora-diversity.git - url: https://pagure.io/packaging-committee.git From 3c621ea4cb77417215e6cdbb25220206a4599612 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 13 2022 19:51:49 +0000 Subject: [PATCH 106/109] use UI bundle from gitlab --- diff --git a/site.yml b/site.yml index f47dcc3..4faa4e1 100644 --- a/site.yml +++ b/site.yml @@ -144,7 +144,7 @@ content: - url: https://pagure.io/defensive-coding-guide.git ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.08.zip + url: https://gitlab.com/fedora/docs/docs-website/ui-bundle/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 4b7021833da64fd651feffeaf6de1401a89531b0 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 13 2022 19:55:21 +0000 Subject: [PATCH 107/109] try lunr search engine --- diff --git a/Dockerfile b/Dockerfile index dbc89f1..17ff424 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM fedora:34 RUN dnf -y module install nodejs:16 && \ dnf clean all -RUN npm i -g @antora/cli@3.0.0 @antora/site-generator-default@3.0.0 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator@3.0.0 @antora/lunr-extension@1.0.0-alpha.6 WORKDIR /antora ENTRYPOINT [ "antora" ] diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index acbf5e7..a522c73 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -4,7 +4,7 @@ RUN dnf -y module install nodejs:16 && \ dnf -y install git python3-yaml && \ dnf clean all -RUN npm i -g @antora/cli@3.0.0 @antora/site-generator@3.0.0 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator@3.0.0 @antora/lunr-extension@1.0.0-alpha.6 ADD rebuild-site.py /antora/rebuild-site.py diff --git a/site.yml b/site.yml index 4faa4e1..1739c28 100644 --- a/site.yml +++ b/site.yml @@ -151,8 +151,6 @@ ui: output: clean: true dir: ./public/en-US - destinations: - - provider: archive runtime: fetch: true cache_dir: ./cache @@ -167,6 +165,8 @@ antora: - id: page-last-update require: ./lib/extensions/page-last-update.js enabled: true + - require: '@antora/lunr-extension' + index_latest_only: true urls: latest_version_segment: latest diff --git a/supplemental-ui/css/search.css b/supplemental-ui/css/search.css new file mode 100644 index 0000000..f02f997 --- /dev/null +++ b/supplemental-ui/css/search.css @@ -0,0 +1,75 @@ +.search-result-dropdown-menu { + position: absolute; + z-index: 100; + display: block; + right: 0; + left: inherit; + top: 100%; + border-radius: 4px; + margin: 6px 0 0; + padding: 0; + text-align: left; + height: auto; + background: transparent; + border: none; + max-width: 600px; + min-width: 500px; + box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.2), 0 2px 3px 0 rgba(0, 0, 0, 0.1); +} + +@media screen and (max-width: 768px) { + .search-result-dropdown-menu { + min-width: calc(100vw - 3.75rem); + } +} + +.search-result-dataset { + position: relative; + border: 1px solid #d9d9d9; + background: #fff; + border-radius: 4px; + overflow: auto; + padding: 0 8px; + max-height: calc(100vh - 5.25rem); + line-height: 1.5; +} + +.search-result-item { + display: flex; + margin: 0.5rem 0; +} + +.search-result-document-title { + width: 33%; + border-right: 1px solid #ddd; + color: #02060c; + font-weight: 500; + font-size: 0.8rem; + padding: 0.5rem 0.5rem 0.5rem 0; + text-align: right; + position: relative; + word-wrap: break-word; +} + +.search-result-document-hit { + flex: 1; + font-size: 0.75rem; + color: #63676d; +} + +.search-result-document-hit > a { + color: inherit; + display: block; + padding: 0.55rem 0.25rem 0.55rem 0.75rem; +} + +.search-result-document-hit > a:hover { + background-color: rgba(69, 142, 225, 0.05); +} + +.search-result-highlight { + color: #174d8c; + background: rgba(143, 187, 237, 0.1); + padding: 0.1em 0.05em; + font-weight: 500; +} diff --git a/supplemental-ui/js/search-ui.js b/supplemental-ui/js/search-ui.js new file mode 100644 index 0000000..d295658 --- /dev/null +++ b/supplemental-ui/js/search-ui.js @@ -0,0 +1,248 @@ +/* global CustomEvent */ +;(function (globalScope) { + /* eslint-disable no-var */ + var config = document.getElementById('search-ui-script').dataset + var snippetLength = parseInt(config.snippetLength || 100, 10) + var siteRootPath = config.siteRootPath || '' + appendStylesheet(config.stylesheet) + var searchInput = document.getElementById('search-input') + var searchResult = document.createElement('div') + searchResult.classList.add('search-result-dropdown-menu') + searchInput.parentNode.appendChild(searchResult) + + function appendStylesheet (href) { + if (!href) return + document.head.appendChild(Object.assign(document.createElement('link'), { rel: 'stylesheet', href: href })) + } + + function highlightText (doc, position) { + var hits = [] + var start = position[0] + var length = position[1] + + var text = doc.text + var highlightSpan = document.createElement('span') + highlightSpan.classList.add('search-result-highlight') + highlightSpan.innerText = text.substr(start, length) + + var end = start + length + var textEnd = text.length - 1 + var contextAfter = end + snippetLength > textEnd ? textEnd : end + snippetLength + var contextBefore = start - snippetLength < 0 ? 0 : start - snippetLength + if (start === 0 && end === textEnd) { + hits.push(highlightSpan) + } else if (start === 0) { + hits.push(highlightSpan) + hits.push(document.createTextNode(text.substr(end, contextAfter))) + } else if (end === textEnd) { + hits.push(document.createTextNode(text.substr(0, start))) + hits.push(highlightSpan) + } else { + hits.push(document.createTextNode('...' + text.substr(contextBefore, start - contextBefore))) + hits.push(highlightSpan) + hits.push(document.createTextNode(text.substr(end, contextAfter - end) + '...')) + } + return hits + } + + function highlightTitle (sectionTitle, doc, position) { + var hits = [] + var start = position[0] + var length = position[1] + + var highlightSpan = document.createElement('span') + highlightSpan.classList.add('search-result-highlight') + var title + if (sectionTitle) { + title = sectionTitle.text + } else { + title = doc.title + } + highlightSpan.innerText = title.substr(start, length) + + var end = start + length + var titleEnd = title.length - 1 + if (start === 0 && end === titleEnd) { + hits.push(highlightSpan) + } else if (start === 0) { + hits.push(highlightSpan) + hits.push(document.createTextNode(title.substr(length, titleEnd))) + } else if (end === titleEnd) { + hits.push(document.createTextNode(title.substr(0, start))) + hits.push(highlightSpan) + } else { + hits.push(document.createTextNode(title.substr(0, start))) + hits.push(highlightSpan) + hits.push(document.createTextNode(title.substr(end, titleEnd))) + } + return hits + } + + function highlightHit (metadata, sectionTitle, doc) { + var hits = [] + for (var token in metadata) { + var fields = metadata[token] + for (var field in fields) { + var positions = fields[field] + if (positions.position) { + var position = positions.position[0] // only higlight the first match + if (field === 'title') { + hits = highlightTitle(sectionTitle, doc, position) + } else if (field === 'text') { + hits = highlightText(doc, position) + } + } + } + } + return hits + } + + function createSearchResult (result, store, searchResultDataset) { + result.forEach(function (item) { + var ids = item.ref.split('-') + var docId = ids[0] + var doc = store[docId] + var sectionTitle + if (ids.length > 1) { + var titleId = ids[1] + sectionTitle = doc.titles.filter(function (item) { + return String(item.id) === titleId + })[0] + } + var metadata = item.matchData.metadata + var hits = highlightHit(metadata, sectionTitle, doc) + searchResultDataset.appendChild(createSearchResultItem(doc, sectionTitle, item, hits)) + }) + } + + function createSearchResultItem (doc, sectionTitle, item, hits) { + var documentTitle = document.createElement('div') + documentTitle.classList.add('search-result-document-title') + documentTitle.innerText = doc.title + var documentHit = document.createElement('div') + documentHit.classList.add('search-result-document-hit') + var documentHitLink = document.createElement('a') + documentHitLink.href = siteRootPath + doc.url + (sectionTitle ? '#' + sectionTitle.hash : '') + documentHit.appendChild(documentHitLink) + hits.forEach(function (hit) { + documentHitLink.appendChild(hit) + }) + var searchResultItem = document.createElement('div') + searchResultItem.classList.add('search-result-item') + searchResultItem.appendChild(documentTitle) + searchResultItem.appendChild(documentHit) + searchResultItem.addEventListener('mousedown', function (e) { + e.preventDefault() + }) + return searchResultItem + } + + function createNoResult (text) { + var searchResultItem = document.createElement('div') + searchResultItem.classList.add('search-result-item') + var documentHit = document.createElement('div') + documentHit.classList.add('search-result-document-hit') + var message = document.createElement('strong') + message.innerText = 'No results found for query "' + text + '"' + documentHit.appendChild(message) + searchResultItem.appendChild(documentHit) + return searchResultItem + } + + function clearSearchResults (reset) { + if (reset === true) searchInput.value = '' + searchResult.innerHTML = '' + } + + function search (index, text) { + // execute an exact match search + var result = index.search(text) + if (result.length > 0) { + return result + } + // no result, use a begins with search + result = index.search(text + '*') + if (result.length > 0) { + return result + } + // no result, use a contains search + result = index.search('*' + text + '*') + return result + } + + function searchIndex (index, store, text) { + clearSearchResults(false) + if (text.trim() === '') { + return + } + var result = search(index, text) + var searchResultDataset = document.createElement('div') + searchResultDataset.classList.add('search-result-dataset') + searchResult.appendChild(searchResultDataset) + if (result.length > 0) { + createSearchResult(result, store, searchResultDataset) + } else { + searchResultDataset.appendChild(createNoResult(text)) + } + } + + function confineEvent (e) { + e.stopPropagation() + } + + function debounce (func, wait, immediate) { + var timeout + return function () { + var context = this + var args = arguments + var later = function () { + timeout = null + if (!immediate) func.apply(context, args) + } + var callNow = immediate && !timeout + clearTimeout(timeout) + timeout = setTimeout(later, wait) + if (callNow) func.apply(context, args) + } + } + + function enableSearchInput (enabled) { + searchInput.disabled = !enabled + searchInput.title = enabled ? '' : 'Loading index...' + } + + function initSearch (lunr, data) { + var start = performance.now() + var index = Object.assign({ index: lunr.Index.load(data.index), store: data.store }) + enableSearchInput(true) + searchInput.dispatchEvent( + new CustomEvent('loadedindex', { + detail: { + took: performance.now() - start, + }, + }) + ) + var debug = 'URLSearchParams' in globalScope && new URLSearchParams(globalScope.location.search).has('lunr-debug') + searchInput.addEventListener( + 'keydown', + debounce(function (e) { + if (e.key === 'Escape' || e.key === 'Esc') return clearSearchResults(true) + try { + var query = searchInput.value + if (!query) return clearSearchResults() + searchIndex(index.index, index.store, searchInput.value) + } catch (err) { + if (debug) console.debug('Invalid search query: ' + query + ' (' + err.message + ')') + } + }, 100) + ) + searchInput.addEventListener('click', confineEvent) + searchResult.addEventListener('click', confineEvent) + document.documentElement.addEventListener('click', clearSearchResults) + } + + // disable the search input until the index is loaded + enableSearchInput(false) + + globalScope.initSearch = initSearch +})(typeof globalThis !== 'undefined' ? globalThis : window) From 1fa986dc36d9825b4706d096519c001f3e260158 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Apr 17 2022 23:20:21 +0000 Subject: [PATCH 108/109] build: cache ui-bundle for translated build --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index a29e815..5df3eec 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -494,6 +494,9 @@ def main(): if 'id' in ext and ext['id'] == "page-last-update": ext['enabled'] = False + # don't pull ui-bundle (use cache) + lang_site_yml["runtime"]["fetch"] = False + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) with open(filename, "w") as file: file.write(yaml.dump(lang_site_yml)) From 976437d2da331b8b83d9ac5280653ee9e29b606b Mon Sep 17 00:00:00 2001 From: Prakash Date: Apr 21 2022 03:16:47 +0000 Subject: [PATCH 109/109] build and previewed --- diff --git a/build.sh b/build.sh index 7d1a215..b9b22c1 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ image="docker.io/antora/antora:3.0.0" cmd="--html-url-extension-style=indexify site.yml" -if [ "$(uname)" == "Darwin" ]; then + if [ "$(uname)" = "Darwin" ]; then # Running on macOS. # Let's assume that the user has the Docker CE installed # which doesn't require a root password. @@ -12,7 +12,7 @@ if [ "$(uname)" == "Darwin" ]; then echo "" docker run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora $image $cmd -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then +elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then # Running on Linux. # Check whether podman is available, else faill back to docker # which requires root. diff --git a/preview.sh b/preview.sh index acc52af..5b4a8ed 100755 --- a/preview.sh +++ b/preview.sh @@ -1,13 +1,13 @@ #!/bin/sh -if [ "$(uname)" == "Darwin" ]; then +if [ "$(uname)" = "Darwin" ]; then # Running on macOS. # Let's assume that the user has the Docker CE installed # which doesn't require a root password. echo "The preview will be available at http://localhost:8080/" docker run --rm -v $(pwd):/antora:ro -v $(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf:ro -p 8080:80 nginx -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then +elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then # Running on Linux. # Fedora Workstation has python3 installed as a default, so using that echo "" diff --git a/site.yml b/site.yml index 1739c28..71f1fa3 100644 --- a/site.yml +++ b/site.yml @@ -167,6 +167,7 @@ antora: enabled: true - require: '@antora/lunr-extension' index_latest_only: true + enabled: false urls: latest_version_segment: latest