Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,12 @@ jobs:
- name: Build Sway std library
run: forc doc --path ./sway-lib-std

- name: Move assets into std directory
run: |
mv ./sway-lib-std/out/doc/static.files ./sway-lib-std/out/doc/std/
mv ./sway-lib-std/out/doc/search.js ./sway-lib-std/out/doc/std/
# Fix relative paths in HTML files
find ./sway-lib-std/out/doc/std -name "*.html" -type f -exec sed -i 's|../static\.files/|static.files/|g' {} \;
find ./sway-lib-std/out/doc/std -name "*.html" -type f -exec sed -i 's|../search\.js|search.js|g' {} \;

- name: Deploy master std
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./sway-lib-std/out/doc/std
destination_dir: master/std
publish_dir: ./sway-lib-std/out/doc
destination_dir: master
if: github.ref == 'refs/heads/master'

- name: Deploy master book
Expand Down Expand Up @@ -133,7 +125,7 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./sway-lib-std/out/doc
publish_dir: ./sway-lib-std/out/doc/std
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/std
if: startsWith(github.ref, 'refs/tags')

Expand Down
22 changes: 20 additions & 2 deletions forc-plugins/forc-doc/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,29 @@ impl RenderedDocumentation {
for (rendered_doc, local_module_map, local_all_docs) in rendered_results? {
rendered_docs.0.push(rendered_doc);

// Merge module maps without overwriting existing categories; append and dedup links.
for (key, value) in local_module_map {
module_map.entry(key).or_default().extend(value);
let entry = module_map.entry(key).or_default();
for (block, mut links) in value {
let list = entry.entry(block).or_default();
// Append new links while avoiding duplicates.
for link in links.drain(..) {
if !list.contains(&link) {
list.push(link);
}
}
}
}

all_docs.links.extend(local_all_docs.links);
// Merge "all docs" links similarly, preserving existing items.
for (block, mut links) in local_all_docs.links {
let list = all_docs.links.entry(block).or_default();
for link in links.drain(..) {
if !list.contains(&link) {
list.push(link);
}
}
}
}

// ProjectIndex
Expand Down
Loading