forked from JuliaIO/MAT.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Documenter documentation (JuliaIO#178)
* Add documentation * Tweak docstring * Add urls to readme --------- Co-authored-by: Steve Kelly <[email protected]>
- Loading branch information
Showing
9 changed files
with
171 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Documentation | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'README.md' | ||
push: | ||
paths-ignore: | ||
- 'README.md' | ||
branches: | ||
- 'main' | ||
- 'release-' | ||
tags: '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: '1' | ||
- name: CacheArtifacts | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-artifacts | ||
with: | ||
path: ~/.julia/artifacts | ||
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-test-${{ env.cache-name }}- | ||
${{ runner.os }}-test- | ||
${{ runner.os }}- | ||
- name: InstallDependencies | ||
run: | | ||
julia --project=docs/ -e ' | ||
ENV["JULIA_PKG_SERVER"] = "" | ||
using Pkg | ||
Pkg.develop(PackageSpec(path=pwd())) | ||
Pkg.instantiate()' | ||
- name: BuildAndDeploy | ||
env: | ||
# https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#Authentication:-GITHUB_TOKEN | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
ssh: ${{ secrets.DOCUMENTER_KEY }} | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} | ||
run: julia --project=docs/ docs/make.jl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
*~ | ||
Manifest.toml | ||
|
||
# Build artifacts for creating documentation generated by the Documenter package | ||
docs/build/ | ||
docs/site/ | ||
docs/src/generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" | ||
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
execute = isempty(ARGS) || ARGS[1] == "run" | ||
|
||
org, reps = :JuilaIO, :MAT | ||
eval(:(using $reps)) | ||
using Documenter | ||
using Literate | ||
|
||
# https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@example-block | ||
ENV["GKSwstype"] = "100" | ||
ENV["GKS_ENCODING"] = "utf-8" | ||
|
||
# generate examples using Literate | ||
lit = joinpath(@__DIR__, "lit") | ||
src = joinpath(@__DIR__, "src") | ||
gen = joinpath(@__DIR__, "src/generated") | ||
|
||
base = "$org/$reps.jl" | ||
repo_root_url = | ||
"https://github.com/$base/blob/main/docs/lit/examples" | ||
nbviewer_root_url = | ||
"https://nbviewer.org/github/$base/tree/gh-pages/dev/generated/examples" | ||
binder_root_url = | ||
"https://mybinder.org/v2/gh/$base/gh-pages?filepath=dev/generated/examples" | ||
|
||
|
||
repo = eval(:($reps)) | ||
DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true) | ||
|
||
for (root, _, files) in walkdir(lit), file in files | ||
splitext(file)[2] == ".jl" || continue # process .jl files only | ||
ipath = joinpath(root, file) | ||
opath = splitdir(replace(ipath, lit => gen))[1] | ||
Literate.markdown(ipath, opath; documenter = execute, # run examples | ||
repo_root_url, nbviewer_root_url, binder_root_url) | ||
Literate.notebook(ipath, opath; execute = false, # no-run notebooks | ||
repo_root_url, nbviewer_root_url, binder_root_url) | ||
end | ||
|
||
|
||
# Documentation structure | ||
ismd(f) = splitext(f)[2] == ".md" | ||
pages(folder) = | ||
[joinpath("generated/", folder, f) for f in readdir(joinpath(gen, folder)) if ismd(f)] | ||
|
||
isci = get(ENV, "CI", nothing) == "true" | ||
|
||
format = Documenter.HTML(; | ||
prettyurls = isci, | ||
edit_link = "main", | ||
canonical = "https://$org.github.io/$repo.jl/stable/", | ||
assets = ["assets/custom.css"], | ||
) | ||
|
||
makedocs(; | ||
modules = [repo], | ||
authors = "Contributors", | ||
sitename = "$repo.jl", | ||
format, | ||
pages = [ | ||
"Home" => "index.md", | ||
"Methods" => "methods.md", | ||
# "Examples" => pages("examples") | ||
], | ||
) | ||
|
||
if isci | ||
deploydocs(; | ||
repo = "github.com/$base", | ||
devbranch = "main", | ||
devurl = "dev", | ||
versions = ["stable" => "v^", "dev" => "dev"], | ||
forcepush = true, | ||
push_preview = true, | ||
# see https://$org.github.io/$repo.jl/previews/PR## | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.docs-sourcelink { | ||
opacity:1 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
```@meta | ||
CurrentModule = MAT | ||
``` | ||
|
||
# MAT.jl Documentation | ||
|
||
## Overview | ||
|
||
This Julia package | ||
[(MAT.jl)](https://github.com/JuliaIO/MAT.jl) | ||
provides tools | ||
for reading and writing MATLAB format data files in Julia. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Methods list | ||
|
||
```@index | ||
``` | ||
|
||
## Methods usage | ||
|
||
```@autodocs | ||
Modules = [MAT] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters