Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggleLiu committed Feb 22, 2024
1 parent f660709 commit 4c7f5ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 868 deletions.
15 changes: 5 additions & 10 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,17 @@ attach_notebook_badge(root, name) = str->attach_notebook_badge(root, name, str)

function attach_notebook_badge(root, name, str)
mybinder_badge_url = "https://mybinder.org/badge_logo.svg"
nbviewer_badge_url = "https://img.shields.io/badge/show-nbviewer-579ACA.svg"
download_badge_url = "https://img.shields.io/badge/download-project-orange"
mybinder = "[![]($mybinder_badge_url)](@__BINDER_ROOT_URL__/generated/$root/$name/main.ipynb)"
nbviewer = "[![]($nbviewer_badge_url)](@__NBVIEWER_ROOT_URL__/generated/$root/$name/main.ipynb)"
download = "[![]($download_badge_url)](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/QuantumBFS/tutorials/tree/gh-pages/dev/generated/$root/$name)"

markdown_only(x) = "#md # " * x
return join(map(markdown_only, (mybinder, nbviewer, download)), "\n") * "\n\n" * str
return join(map(markdown_only, (mybinder, )), "\n") * "\n\n" * str
end

function build_tutorial(root, name)
generated_path = joinpath("generated", root, name)
generated_abspath = joinpath(@__DIR__, "src", generated_path)
source_dir = joinpath(@__DIR__, "src", root, name)
source_path = joinpath(source_dir, "main.jl")
Literate.markdown(source_path, generated_abspath; execute=true, name="index", preprocess = attach_notebook_badge(root, name))
Literate.notebook(source_path, generated_abspath; execute=false, name="main", preprocess = notebook_filter)
Literate.script(source_path, generated_abspath; execute=false, name="main")
Literate.markdown(source_path, generated_abspath; execute=true, name="index", preprocess = attach_notebook_badge(root, name), binder_root_url="")
# copy other things
for each in readdir(source_dir)
if each != "main.jl"
Expand All @@ -53,6 +46,8 @@ end

# download("yaoquantum.org/assets/logo-light.png", "docs/src/assets/logo.png")

example_pages = build("examples")

const PAGES = [
"Home" => "index.md",
"Quick Start" => "quick-start.md",
Expand All @@ -68,7 +63,7 @@ const PAGES = [
"man/simplification.md",
"man/bitbasis.md",
],
"Examples" => build("examples"),
"Examples" => example_pages,
"Performance Tips" => "performancetips.md",
]

Expand Down
Loading

0 comments on commit 4c7f5ca

Please sign in to comment.