Skip to content

Commit e338eb5

Browse files
authored
Merge branch 'master' into fix/gh-pages-workflow
2 parents e1c1a54 + 4552c75 commit e338eb5

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

.github/workflows/gh-pages.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,12 @@ jobs:
6161
- name: Build Sway std library
6262
run: forc doc --path ./sway-lib-std
6363

64-
- name: Move assets into std directory
65-
run: |
66-
mv ./sway-lib-std/out/doc/static.files ./sway-lib-std/out/doc/std/
67-
mv ./sway-lib-std/out/doc/search.js ./sway-lib-std/out/doc/std/
68-
# Fix relative paths in HTML files
69-
find ./sway-lib-std/out/doc/std -name "*.html" -type f -exec sed -i 's|../static\.files/|static.files/|g' {} \;
70-
find ./sway-lib-std/out/doc/std -name "*.html" -type f -exec sed -i 's|../search\.js|search.js|g' {} \;
71-
7264
- name: Deploy master std
7365
uses: peaceiris/actions-gh-pages@v3
7466
with:
7567
github_token: ${{ secrets.GITHUB_TOKEN }}
76-
publish_dir: ./sway-lib-std/out/doc/std
77-
destination_dir: master/std
68+
publish_dir: ./sway-lib-std/out/doc
69+
destination_dir: master
7870
if: github.ref == 'refs/heads/master'
7971

8072
- name: Deploy master book
@@ -139,7 +131,7 @@ jobs:
139131
uses: peaceiris/actions-gh-pages@v3
140132
with:
141133
github_token: ${{ secrets.GITHUB_TOKEN }}
142-
publish_dir: ./sway-lib-std/out/doc
134+
publish_dir: ./sway-lib-std/out/doc/std
143135
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/std
144136
if: startsWith(github.ref, 'refs/tags')
145137

forc-plugins/forc-doc/src/render/mod.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,29 @@ impl RenderedDocumentation {
120120
for (rendered_doc, local_module_map, local_all_docs) in rendered_results? {
121121
rendered_docs.0.push(rendered_doc);
122122

123+
// Merge module maps without overwriting existing categories; append and dedup links.
123124
for (key, value) in local_module_map {
124-
module_map.entry(key).or_default().extend(value);
125+
let entry = module_map.entry(key).or_default();
126+
for (block, mut links) in value {
127+
let list = entry.entry(block).or_default();
128+
// Append new links while avoiding duplicates.
129+
for link in links.drain(..) {
130+
if !list.contains(&link) {
131+
list.push(link);
132+
}
133+
}
134+
}
125135
}
126136

127-
all_docs.links.extend(local_all_docs.links);
137+
// Merge "all docs" links similarly, preserving existing items.
138+
for (block, mut links) in local_all_docs.links {
139+
let list = all_docs.links.entry(block).or_default();
140+
for link in links.drain(..) {
141+
if !list.contains(&link) {
142+
list.push(link);
143+
}
144+
}
145+
}
128146
}
129147

130148
// ProjectIndex

0 commit comments

Comments
 (0)