Skip to content

Commit f3e926d

Browse files
authored
fix: redirect links to individual wf pages, minor update usage instructions (#40)
* fix: dynamic re-routing of old to new workflow pages * fix: updated deployment options: apptainer in favor of singularity * fix: change space to slash in workflow links and pages
1 parent 6cbf174 commit f3e926d

File tree

9 files changed

+37
-30
lines changed

9 files changed

+37
-30
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ In order to additionally appear in the "standardized usage" area, repositories a
4040

4141
Typical content of the `.snakemake-workflow-catalog.yml` file:
4242

43-
```bash
43+
```yaml
4444
usage:
45-
mandatory-flags: # optional definition of additional flags
46-
desc: # describe your flags here in a few sentences (they will be inserted below the example commands)
45+
mandatory-flags:
46+
desc: # describe your flags here in a few sentences
4747
flags: # put your flags here
48-
software-stack-deployment: # definition of software deployment method (at least one of conda, singularity, or singularity+conda)
49-
conda: true # whether pipeline works with --use-conda
50-
singularity: true # whether pipeline works with --use-singularity
51-
singularity+conda: true # whether pipeline works with --use-singularity --use-conda
52-
report: true # add this to confirm that the workflow allows to use 'snakemake --report report.zip' to generate a report containing all results and explanations
48+
software-stack-deployment:
49+
conda: true # whether pipeline works with '--sdm conda'
50+
apptainer: true # whether pipeline works with '--sdm apptainer/singularity'
51+
apptainer+conda: true # whether pipeline works with '--sdm conda apptainer/singularity'
52+
report: true # whether creation of reports using 'snakemake --report report.zip' is supported
5353
```
5454
55-
Once included in the standardized usage area you can link directly to the usage instructions for your repository via the URL `https://snakemake.github.io/snakemake-workflow-catalog?usage=<owner>/<repo>`.
55+
Once included in the standardized usage area you can link directly to the workflow page using the URL `https://snakemake.github.io/snakemake-workflow-catalog/docs/workflows/<owner>/<repo>`. Do not forget to replace the `<owner>` and `<repo>` tags at the end of the URL.
5656

5757
### Release handling
5858

source/_static/redirect.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
document.addEventListener("DOMContentLoaded", function () {
2+
const params = new URLSearchParams(window.location.search);
3+
const usage = params.get("usage");
4+
5+
if (usage) {
6+
// Dynamically construct the target URL
7+
const targetUrl = `docs/workflows/${usage}.html`;
8+
9+
// Redirect to the dynamically constructed URL
10+
window.location.href = targetUrl;
11+
} else {
12+
console.error("No usage parameter found in the URL.");
13+
}
14+
});

source/_templates/all_standardized_workflows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:widths: auto
1010
1111
{% for repo in input -%}
12-
[{{ repo["full_name"] }}](<workflows/{{ repo["md"] }}>){% raw %},{% endraw %}
12+
[{{ repo["full_name"] }}](<workflows/{{ repo["full_name"] }}>){% raw %},{% endraw %}
1313
"{{ repo["description"] }}"{% raw %},{% endraw %}
1414
{%- for t in repo["topics"] -%}{bdg-secondary}`{{ t }}` {% endfor %}{% raw %},{% endraw %}
1515
{bdg-muted}`last update {{ repo["last_update"] }}`

source/_templates/workflows_by.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{% for repo in input -%}
66

7-
:::{grid-item-card} [{{ repo["name"] }}](<workflows/{{ repo["md"] }}>)
7+
:::{grid-item-card} [{{ repo["name"] }}](<workflows/{{ repo["full_name"] }}>)
88

99
{{ repo["user"] }}
1010

@@ -40,6 +40,6 @@
4040
:hidden:
4141
4242
{% for repo in input -%}
43-
workflows/{{ repo["user"] }} {{ repo["name"] }}
43+
workflows/{{ repo["full_name"] }}
4444
{% endfor %}
4545
```

source/build_wf_pages.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def build_wf_pages():
6060
repo = repos[current_repo]
6161
wf_data = {}
6262
wf_data["full_name"] = current_repo
63-
md_filename = f"{current_repo.replace('/', ' ')}.md"
6463
# prepare title, description, reporting, qc stats, etc.
6564
wf_data["description"] = repo["description"]
6665
wf_data["topics"] = repo["topics"]
@@ -75,8 +74,10 @@ def build_wf_pages():
7574
wf_data["config_from_readme"] = check_readme(repo["config_readme"])
7675
# render and export
7776
md_rendered = template.render(wf=wf_data)
78-
output_dir = Path("docs/workflows")
79-
output_path = output_dir / md_filename
77+
output_dir = Path(f"docs/workflows/{current_repo.split('/')[0]}")
78+
if not output_dir.exists():
79+
output_dir.mkdir(parents=True, exist_ok=True)
80+
output_path = output_dir / f"{current_repo.split('/')[1]}.md"
8081
with open(output_path, "w", encoding="utf-8") as f:
8182
f.write(md_rendered)
8283

source/build_wf_tables.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def build_wf_tables():
7777
repos = {}
7878
for repo in json.loads(f.read()):
7979
repo = {k: repo[k] for k in selected_items if k in repo}
80-
repo["md"] = repo["full_name"].replace("/", " ")
8180
repo["user"] = repo["full_name"].split("/")[0]
8281
repo["name"] = repo["full_name"].split("/")[1]
8382
last_update = datetime.fromtimestamp(repo["updated_at"])

source/conf.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@
7171
}
7272

7373
# -- Manage redirection of old to new wf pages -------------------------------
74-
# these are simply static redirects without wildcards
75-
rendered_wfs = os.listdir("docs/workflows")
76-
redirects = {}
77-
for wf in rendered_wfs:
78-
if not wf.endswith(".md"):
79-
continue
80-
wf_items = wf.replace(".md", "").split(" ")
81-
redirects[f"?usage={wf_items[0]}%2F{wf_items[1]}"] = (
82-
f"docs/workflows/{wf_items[0]} {wf_items[1]}"
83-
)
74+
html_js_files = [
75+
"redirect.js",
76+
]

source/docs/about/adding_workflows.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ usage:
2929
flags: # put your flags here
3030
software-stack-deployment:
3131
conda: true # whether pipeline works with '--sdm conda'
32-
singularity: true # whether pipeline works with '--sdm singularity/apptainer'
33-
singularity+conda: true # whether pipeline works with '--sdm conda singularity/apptainer'
32+
apptainer: true # whether pipeline works with '--sdm apptainer/singularity'
33+
apptainer+conda: true # whether pipeline works with '--sdm conda apptainer/singularity'
3434
report: true # whether creation of reports using 'snakemake --report report.zip' is supported
3535
```
3636
@@ -42,7 +42,7 @@ Definition of mandatory flags can happen through a list of strings (`['--a', '--
4242
The content of the `.snakemake-workflow-catalog.yml` file is subject to change. Flags might change in the near future, but current versions will always stay compatible with the catalog.
4343
:::
4444

45-
Once included in the standardized usage area you can link directly to the usage instructions for your repository via the URL `https://snakemake.github.io/snakemake-workflow-catalog?usage=<owner>/<repo>`. Do not forget to replace the `<owner>` and `<repo>` tags at the end of the URL.
45+
Once included in the standardized usage area you can link directly to the workflow page using the URL `https://snakemake.github.io/snakemake-workflow-catalog/docs/workflows/<owner>/<repo>`. Do not forget to replace the `<owner>` and `<repo>` tags at the end of the URL.
4646

4747
### Release handling
4848

source/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Explore workflows 🔭
6666

6767
## Contributing
6868

69-
- Improving PRs or issues with the workflow catalog (only the catalog, not the workflows themselves) can be made [here](http://github.com/snakemake/snakemake-plugin-catalog)
69+
- Improving PRs or issues with the workflow catalog (only the catalog, not the workflows themselves) can be made [here](http://github.com/snakemake/snakemake-workflow-catalog)
7070
- Improving PRs or issues with the listed workflows can be made at the respective workflow repository (see indivuidual [workflow pages](<docs/all_standardized_workflows>)).
7171
- Resources for creating new workflows can be found [here](<docs/snakemake>) or in more detail on the [Snakemake documnentation](https://snakemake.readthedocs.io/en/stable/index.html)
7272
- New workflows will be [automatically added](<docs/catalog>) to the workflow catalog if they are contained in eligible Github repositories

0 commit comments

Comments
 (0)