mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-22 16:49:22 -05:00
fixed book links
This commit is contained in:
parent
5f06393eba
commit
81c4e591c0
2 changed files with 52 additions and 9 deletions
39
.github/workflows/book.yml
vendored
Normal file
39
.github/workflows/book.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
name: Book
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install mdbook I
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-binstall,mdbook
|
||||
- name: Install mdbook II
|
||||
run: |
|
||||
cargo binstall -y mdbook-cmdrun
|
||||
cargo binstall -y trunk
|
||||
rustup target add wasm32-unknown-unknown
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v3
|
||||
- name: Build mdbook
|
||||
run: |
|
||||
cd docs/book
|
||||
mdbook build
|
||||
python3 post_build.py
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
path: ./docs/book/book
|
||||
- name: Deploy book to github pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v2
|
|
@ -84,13 +84,15 @@ def add_source_paragraph(name, module):
|
|||
print("\n## Source\n")
|
||||
|
||||
if module is not None:
|
||||
module = f"/{module}"
|
||||
mod = f"/{module}"
|
||||
else:
|
||||
mod = ""
|
||||
|
||||
source_url = f"https://github.com/Synphonyte/leptos-use/blob/main/src{module}/{name}.rs"
|
||||
source_url = f"https://github.com/Synphonyte/leptos-use/blob/main/src{mod}/{name}.rs"
|
||||
demo_url = f"https://github.com/Synphonyte/leptos-use/tree/main/examples/{name}"
|
||||
docs_url = f"https://docs.rs/leptos-use/latest/leptos_use{module}/fn.{name}.html"
|
||||
docs_url = f"https://docs.rs/leptos-use/latest/leptos_use{mod}/fn.{name}.html"
|
||||
|
||||
demo_link = " • <a href=\"{demo_url}\" target=\"_blank\">Demo</a>" if os.path.isdir(
|
||||
demo_link = f" • <a href=\"{demo_url}\" target=\"_blank\">Demo</a>" if os.path.isdir(
|
||||
os.path.join("..", "..", "..", "..", "examples", name)) else ""
|
||||
|
||||
print(
|
||||
|
@ -113,10 +115,12 @@ def process_line(line, name, module):
|
|||
</div>'''
|
||||
else:
|
||||
if module is not None:
|
||||
module = f"/{module}"
|
||||
mod = f"/{module}"
|
||||
else:
|
||||
mod = ""
|
||||
|
||||
result = re.sub(internal_doc_link_pattern,
|
||||
rf"[`\1`](https://docs.rs/leptos-use/latest/leptos_use{module}/fn.\1.html)",
|
||||
rf"[`\1`](https://docs.rs/leptos-use/latest/leptos_use{mod}/fn.\1.html)",
|
||||
line)
|
||||
|
||||
return result
|
||||
|
@ -141,11 +145,11 @@ def append_type(line, ty, types, module=None):
|
|||
ident = m.group(0)
|
||||
|
||||
if module is not None:
|
||||
module = f"/{module}"
|
||||
mod = f"/{module}"
|
||||
else:
|
||||
module = ""
|
||||
mod = ""
|
||||
|
||||
types.append(f"- [`{ty} {ident}`](https://docs.rs/leptos-use/latest/leptos_use{module}/{ty}.{ident}.html)")
|
||||
types.append(f"- [`{ty} {ident}`](https://docs.rs/leptos-use/latest/leptos_use{mod}/{ty}.{ident}.html)")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Reference in a new issue