Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs #51

Merged
merged 2 commits into from
Oct 20, 2024
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "MGVI"
uuid = "fdae7790-d271-4276-880d-f72bbddf129c"
version = "0.3.2"
version = "0.3.3"

[deps]
AutoDiffOperators = "6e1301d5-4f4d-4fb5-9679-7191e22f0e0e"
Expand Down
4 changes: 4 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
build/
site/
src/tutorial.*
src/mgvi_tutorial.*
src/advanced_tutorial.*
src/mgvi_advanced_tutorial.*
40 changes: 15 additions & 25 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,30 @@ using MGVI

SRC=joinpath(@__DIR__, "src")

GENERATED = joinpath(@__DIR__, "build")
GENERATED_SRC = joinpath(GENERATED, "src")
GENERATED_DOCS = joinpath(GENERATED, "docs")

EXECUTE_MD = true

mkpath(GENERATED)
cp(SRC, GENERATED_SRC, force = true)

function dir_replace(content)
content = replace(content, "@__DIR__" => '"' * GENERATED_SRC * '"')
function fix_literate_output(content)
content = replace(content, "EditURL = \"@__REPO_ROOT_URL__/\"" => "")
return content
end

Literate.notebook(joinpath(GENERATED_SRC, "advanced_tutorial_lit.jl"),
GENERATED_SRC; name="advanced_tutorial", execute=false)
Literate.script(joinpath(GENERATED_SRC, "advanced_tutorial_lit.jl"),
GENERATED_SRC; name="advanced_tutorial")
Literate.markdown(joinpath(GENERATED_SRC, "advanced_tutorial_lit.jl"),
GENERATED_SRC; name="advanced_tutorial", execute=EXECUTE_MD, preprocess=dir_replace)
gen_content_dir = joinpath(@__DIR__, "src")

tutorial_src = joinpath(@__DIR__, "src", "tutorial_lit.jl")
Literate.markdown(tutorial_src, gen_content_dir, name = "tutorial", documenter = true, credit = true, postprocess = fix_literate_output)
#Literate.markdown(tutorial_src, gen_content_dir, name = "tutorial", codefence = "```@repl tutorial" => "```", documenter = true, credit = true)
Literate.notebook(tutorial_src, gen_content_dir, execute = false, name = "mgvi_tutorial", documenter = true, credit = true)
Literate.script(tutorial_src, gen_content_dir, keep_comments = false, name = "mgvi_tutorial", documenter = true, credit = false)

advanced_tutorial_src = joinpath(@__DIR__, "src", "advanced_tutorial_lit.jl")
Literate.markdown(advanced_tutorial_src, gen_content_dir, name = "advanced_tutorial", documenter = true, credit = true, postprocess = fix_literate_output)
#Literate.markdown(advanced_tutorial_src, gen_content_dir, name = "advanced_tutorial", codefence = "```@repl advanced_tutorial" => "```", documenter = true, credit = true)
Literate.notebook(advanced_tutorial_src, gen_content_dir, execute = false, name = "mgvi_advanced_tutorial", documenter = true, credit = true)
Literate.script(advanced_tutorial_src, gen_content_dir, keep_comments = false, name = "mgvi_advanced_tutorial", documenter = true, credit = false)

Literate.notebook(joinpath(GENERATED_SRC, "tutorial_lit.jl"),
GENERATED_SRC; name="tutorial", execute=false)
Literate.script(joinpath(GENERATED_SRC, "tutorial_lit.jl"),
GENERATED_SRC; name="tutorial")
Literate.markdown(joinpath(GENERATED_SRC, "tutorial_lit.jl"),
GENERATED_SRC; name="tutorial", execute=EXECUTE_MD)

makedocs(
sitename = "MGVI",
modules = [MGVI],
root = GENERATED,
source = "src",
build = "docs",
format = Documenter.HTML(
prettyurls = !("local" in ARGS),
canonical = "https://bat.github.io/MGVI.jl/stable/"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

```@eval
using Markdown
Markdown.parse_file(joinpath(@__DIR__, "..", "..", "..", "LICENSE.md"))
Markdown.parse_file(joinpath(@__DIR__, "..", "..", "LICENSE.md"))
```
5 changes: 4 additions & 1 deletion docs/src/advanced_tutorial_lit.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#md # # Advanced Tutorial
#md # Notebook [download](advanced_tutorial.ipynb) [source](advanced_tutorial.jl)

#md # You can also download this tutorial as a
#md # [Jupyter notebook](mgvi_advanced_tutorial.ipynb) and a plain
#md # [Julia source file](mgvi_advanced_tutorial.jl).

# ## Introduction

Expand Down
5 changes: 4 additions & 1 deletion docs/src/tutorial_lit.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#md # # Tutorial
#md # Notebook [download](tutorial.ipynb) [source](tutorial.jl)

#md # You can also download this tutorial as a
#md # [Jupyter notebook](mgvi_tutorial.ipynb) and a plain
#md # [Julia source file](mgvi_tutorial.jl).

using MGVI
#
Expand Down
Loading