Skip to content

Commit e649cf9

Browse files
authored
Merge pull request #157 from clamsproject/155-app-intermediate-links
added data to app breadcrumb
2 parents a3445ca + 687edd4 commit e649cf9

File tree

4 files changed

+49
-4
lines changed

4 files changed

+49
-4
lines changed

.github/workflows/register.yml

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ jobs:
152152
mkdir -p $dir
153153
cp {metadata,submission}.json index.md $dir/
154154
python scripts/index_page_data.py $dir
155+
python scripts/app_pages.py
155156
156157
- name: "🫙 Commit and push docs with generated files"
157158
id: create_branch

docs/_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# https://mmistakes.github.io/minimal-mistakes/docs/quick-start-guide/#installing-the-theme
1212

1313
#theme : "minimal-mistakes-jekyll"
14-
remote_theme : "mmistakes/minimal-mistakes@4.24.0"
14+
remote_theme : "https://github.com/clamsproject/website-theme-minimal-mistakes"
1515
minimal_mistakes_skin : "default" # "air", "aqua", "contrast", "dark", "dirt", "neon", "mint", "plum", "sunrise"
1616

1717
# Site Settings

docs/index.md

+20-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,30 @@ toc_sticky: true
1515
## App Directory
1616

1717
{% for app in site.data.app-index %}
18-
{%- assign check = app[0] | split:'http://apps.clams.ai/' -%}
18+
{% assign check = app[0] | split:'http://apps.clams.ai/' %}
1919
{% if check.size == 2 %}
20+
{% assign versions = app[1]["versions"] %}
21+
{% capture numstr %} {{ versions.size }},3 {% endcapture %}
22+
{% assign numstrs = numstr | split: "," %}
23+
{% assign nums = "" | split: "" %}
24+
{% for num in numstrs %}
25+
{% assign cast = num | to_integer %}
26+
{% assign nums = nums | push: cast %}
27+
{% endfor %}
28+
{% assign to_display = nums | sort | first | to_i %}
29+
{% assign end_loop = to_display | minus: 1 %}
30+
2031
### {{ check[1] }}
32+
2133
{{ app[1]["description"] }}
22-
{% for version in app[1]["versions"] %}
23-
* [{{ version[0] }}]({{ check[1] }}/{{ version[0] }}) ([`@{{ version[1] }}`](https://github.com/{{ version[1] }}))
34+
35+
{% for i in (0..end_loop) %}
36+
* [{{ versions[i][0] }}]({{ check[1] }}/{{ versions[i][0] }}) ([`@{{ versions[i][1] }}`](https://github.com/{{ versions[i][1] }}))
2437
{% endfor %}
38+
{% if versions.size > to_display %}
39+
40+
* [all {{ versions.size }} releases]({{ check[1] }})
41+
{% endif %}
2542
{% else %}
2643
### {{ app[0] }}
2744
{% for version in app[1] %}

scripts/app_pages.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
import json
3+
4+
docs_dir = os.path.join(os.path.dirname(__file__), '..', 'docs')
5+
6+
apps = json.load(open(os.path.join(docs_dir, '_data', 'app-index.json')))
7+
8+
for app_uri, app_details in apps.items():
9+
app_title = app_uri.rsplit('/', 1)[1]
10+
app_submitters = {ver: submitter for ver, submitter in app_details['versions']}
11+
app_description = app_details['description']
12+
13+
file_name = os.path.join(docs_dir, '_apps', app_title, 'index.md')
14+
15+
f = open(file_name, "w")
16+
17+
f.write('---\n')
18+
f.write("layout: posts\n")
19+
f.write("classes: wide\n")
20+
f.write(f"title: {app_title}\n")
21+
f.write("---\n")
22+
f.write(f"{app_description}\n")
23+
24+
for app_ver, app_submitter in app_submitters.items():
25+
f.write(f"- [{app_ver}]({app_ver}) ([`@{app_submitter}`](https://github.com/{app_submitter}))\n")
26+
27+
f.close()

0 commit comments

Comments
 (0)