Skip to content

Commit f20dfbb

Browse files
committed
Runic formatting
1 parent 0cc4687 commit f20dfbb

8 files changed

Lines changed: 156 additions & 153 deletions

File tree

.JuliaFormatter.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/make.jl

Lines changed: 96 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -21,111 +21,115 @@ Building aggregate site into: $(outpath)
2121
@info "Building Documenter site for ITensorDocsNext"
2222
include("make_index.jl")
2323
Documenter.makedocs(;
24-
sitename="ITensor ecosystem docs",
25-
modules=[ITensorDocsNext],
26-
warnonly=true,
27-
format=Documenter.HTML(; assets=["assets/favicon.ico", "assets/extras.css"]),
28-
pages=["index.md", "ecosystem_overview.md", "upgrade_guide.md"],
24+
sitename = "ITensor ecosystem docs",
25+
modules = [ITensorDocsNext],
26+
warnonly = true,
27+
format = Documenter.HTML(; assets = ["assets/favicon.ico", "assets/extras.css"]),
28+
pages = ["index.md", "ecosystem_overview.md", "upgrade_guide.md"],
2929
)
3030

3131
@info "Building aggregate ITensorDocsNext site"
32-
function itensor_multidocref(pkgname::String; clonedir::String=clonedir)
33-
return MultiDocumenter.MultiDocRef(;
34-
upstream=joinpath(clonedir, pkgname),
35-
path=pkgname,
36-
name=pkgname,
37-
giturl="https://github.com/ITensor/$(pkgname).jl.git",
38-
)
32+
function itensor_multidocref(pkgname::String; clonedir::String = clonedir)
33+
return MultiDocumenter.MultiDocRef(;
34+
upstream = joinpath(clonedir, pkgname),
35+
path = pkgname,
36+
name = pkgname,
37+
giturl = "https://github.com/ITensor/$(pkgname).jl.git",
38+
)
3939
end
4040
docs = [
41-
# We also add ITensorDocsNext's own generated pages
42-
MultiDocumenter.MultiDocRef(;
43-
upstream=joinpath(@__DIR__, "build"),
44-
path="Overview",
45-
name="Home",
46-
fix_canonical_url=false,
47-
),
48-
MultiDocumenter.DropdownNav(
49-
"Tensor Network Libraries", itensor_multidocref.(["ITensorNetworksNext"])
50-
),
51-
MultiDocumenter.DropdownNav(
52-
"Array Libraries",
53-
itensor_multidocref.([
54-
"ITensorBase",
55-
"NamedDimsArrays",
56-
"TensorAlgebra",
57-
"BlockSparseArrays",
58-
"SparseArraysBase",
59-
"DiagonalArrays",
60-
"KroneckerArrays",
61-
]),
62-
),
63-
MultiDocumenter.DropdownNav(
64-
"Symmetric Tensors", itensor_multidocref.(["FusionTensors", "GradedArrays"])
65-
),
66-
MultiDocumenter.DropdownNav(
67-
"Graph Libraries", itensor_multidocref.(["NamedGraphs", "DataGraphs"])
68-
),
69-
MultiDocumenter.DropdownNav(
70-
"Developer Tools",
71-
itensor_multidocref.([
72-
"FunctionImplementations",
73-
"TypeParameterAccessors",
74-
"MapBroadcast",
75-
"BackendSelection",
76-
"ITensorPkgSkeleton",
77-
]),
78-
),
41+
# We also add ITensorDocsNext's own generated pages
42+
MultiDocumenter.MultiDocRef(;
43+
upstream = joinpath(@__DIR__, "build"),
44+
path = "Overview",
45+
name = "Home",
46+
fix_canonical_url = false,
47+
),
48+
MultiDocumenter.DropdownNav(
49+
"Tensor Network Libraries", itensor_multidocref.(["ITensorNetworksNext"])
50+
),
51+
MultiDocumenter.DropdownNav(
52+
"Array Libraries",
53+
itensor_multidocref.(
54+
[
55+
"ITensorBase",
56+
"NamedDimsArrays",
57+
"TensorAlgebra",
58+
"BlockSparseArrays",
59+
"SparseArraysBase",
60+
"DiagonalArrays",
61+
"KroneckerArrays",
62+
]
63+
),
64+
),
65+
MultiDocumenter.DropdownNav(
66+
"Symmetric Tensors", itensor_multidocref.(["FusionTensors", "GradedArrays"])
67+
),
68+
MultiDocumenter.DropdownNav(
69+
"Graph Libraries", itensor_multidocref.(["NamedGraphs", "DataGraphs"])
70+
),
71+
MultiDocumenter.DropdownNav(
72+
"Developer Tools",
73+
itensor_multidocref.(
74+
[
75+
"FunctionImplementations",
76+
"TypeParameterAccessors",
77+
"MapBroadcast",
78+
"BackendSelection",
79+
"ITensorPkgSkeleton",
80+
]
81+
),
82+
),
7983
]
8084

8185
MultiDocumenter.make(
82-
outpath,
83-
docs;
84-
search_engine=MultiDocumenter.SearchConfig(;
85-
index_versions=["stable"], engine=MultiDocumenter.FlexSearch
86-
),
87-
rootpath="/ITensorDocsNext/",
88-
canonical_domain="https://itensor.github.io/",
89-
sitemap=true,
90-
assets_dir="docs/src/assets",
91-
brand_image=MultiDocumenter.BrandImage(
92-
"https://itensor.org", joinpath("assets", "logo-dark.png")
93-
),
86+
outpath,
87+
docs;
88+
search_engine = MultiDocumenter.SearchConfig(;
89+
index_versions = ["stable"], engine = MultiDocumenter.FlexSearch
90+
),
91+
rootpath = "/ITensorDocsNext/",
92+
canonical_domain = "https://itensor.github.io/",
93+
sitemap = true,
94+
assets_dir = "docs/src/assets",
95+
brand_image = MultiDocumenter.BrandImage(
96+
"https://itensor.org", joinpath("assets", "logo-dark.png")
97+
),
9498
)
9599

96100
if "deploy" in ARGS
97-
@warn "Deploying to GitHub" ARGS
98-
gitroot = normpath(joinpath(@__DIR__, ".."))
99-
run(`git pull`)
100-
outbranch = "gh-pages"
101-
has_outbranch = true
102-
if !success(`git checkout $outbranch`)
103-
has_outbranch = false
104-
if !success(`git switch --orphan $outbranch`)
105-
@error "Cannot create new orphaned branch $outbranch."
106-
exit(1)
101+
@warn "Deploying to GitHub" ARGS
102+
gitroot = normpath(joinpath(@__DIR__, ".."))
103+
run(`git pull`)
104+
outbranch = "gh-pages"
105+
has_outbranch = true
106+
if !success(`git checkout $outbranch`)
107+
has_outbranch = false
108+
if !success(`git switch --orphan $outbranch`)
109+
@error "Cannot create new orphaned branch $outbranch."
110+
exit(1)
111+
end
107112
end
108-
end
109-
for file in readdir(gitroot; join=true)
110-
endswith(file, ".git") && continue
111-
rm(file; force=true, recursive=true)
112-
end
113-
for file in readdir(outpath)
114-
cp(joinpath(outpath, file), joinpath(gitroot, file))
115-
end
116-
run(`git add .`)
117-
if success(`git commit -m 'Aggregate documentation'`)
118-
@info "Pushing updated documentation."
119-
if has_outbranch
120-
run(`git push`)
113+
for file in readdir(gitroot; join = true)
114+
endswith(file, ".git") && continue
115+
rm(file; force = true, recursive = true)
116+
end
117+
for file in readdir(outpath)
118+
cp(joinpath(outpath, file), joinpath(gitroot, file))
119+
end
120+
run(`git add .`)
121+
if success(`git commit -m 'Aggregate documentation'`)
122+
@info "Pushing updated documentation."
123+
if has_outbranch
124+
run(`git push`)
125+
else
126+
run(`git push -u origin $outbranch`)
127+
end
128+
run(`git checkout main`)
121129
else
122-
run(`git push -u origin $outbranch`)
130+
@info "No changes to aggregated documentation."
123131
end
124-
run(`git checkout main`)
125-
else
126-
@info "No changes to aggregated documentation."
127-
end
128132
else
129-
@info "Skipping deployment, 'deploy' not passed. Generated files in docs/out." ARGS
130-
cp(outpath, joinpath(@__DIR__, "out"); force=true)
133+
@info "Skipping deployment, 'deploy' not passed. Generated files in docs/out." ARGS
134+
cp(outpath, joinpath(@__DIR__, "out"); force = true)
131135
end

docs/make_index.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using ITensorDocsNext: ITensorDocsNext
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
```@raw html
77
<img class="display-light-only" src="assets/CCQ.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
88
<img class="display-dark-only" src="assets/CCQ-dark.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
99
```
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir(ITensorDocsNext), "examples", "README.jl"),
17-
joinpath(pkgdir(ITensorDocsNext), "docs", "src");
18-
flavor=Literate.DocumenterFlavor(),
19-
name="index",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(ITensorDocsNext), "examples", "README.jl"),
17+
joinpath(pkgdir(ITensorDocsNext), "docs", "src");
18+
flavor = Literate.DocumenterFlavor(),
19+
name = "index",
20+
postprocess = ccq_logo,
2121
)

docs/make_readme.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using ITensorDocsNext: ITensorDocsNext
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
<picture>
77
<source media="(prefers-color-scheme: dark)" width="20%" srcset="docs/src/assets/CCQ-dark.png">
88
<img alt="Flatiron Center for Computational Quantum Physics logo." width="20%" src="docs/src/assets/CCQ.png">
99
</picture>
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir(ITensorDocsNext), "examples", "README.jl"),
17-
joinpath(pkgdir(ITensorDocsNext));
18-
flavor=Literate.CommonMarkFlavor(),
19-
name="README",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(ITensorDocsNext), "examples", "README.jl"),
17+
joinpath(pkgdir(ITensorDocsNext));
18+
flavor = Literate.CommonMarkFlavor(),
19+
name = "README",
20+
postprocess = ccq_logo,
2121
)

examples/README.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# # Documentation for in-progress rewrite of the ITensor ecosystem
2-
#
2+
#
33
# A preview of the documentation for an in-progress rewrite of the ITensor Julia
44
# ecosystem. You can find the documentation [here](https://itensor.github.io/ITensorDocsNext).
55

test/basics/test_basics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ using ITensorDocsNext: ITensorDocsNext
22
using Test: @test, @testset
33

44
@testset "ITensorDocsNext" begin
5-
# Tests go here.
5+
# Tests go here.
66
end

test/runtests.jl

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,62 @@ using Suppressor: Suppressor
66
const pat = r"(?:--group=)(\w+)"
77
arg_id = findfirst(contains(pat), ARGS)
88
const GROUP = uppercase(
9-
if isnothing(arg_id)
10-
get(ENV, "GROUP", "ALL")
11-
else
12-
only(match(pat, ARGS[arg_id]).captures)
13-
end,
9+
if isnothing(arg_id)
10+
get(ENV, "GROUP", "ALL")
11+
else
12+
only(match(pat, ARGS[arg_id]).captures)
13+
end,
1414
)
1515

1616
"match files of the form `test_*.jl`, but exclude `*setup*.jl`"
1717
function istestfile(fn)
18-
return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
18+
return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
1919
end
2020
"match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
2121
function isexamplefile(fn)
22-
return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
22+
return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
2323
end
2424

2525
@time begin
26-
# tests in groups based on folder structure
27-
for testgroup in filter(isdir, readdir(@__DIR__))
28-
if GROUP == "ALL" || GROUP == uppercase(testgroup)
29-
groupdir = joinpath(@__DIR__, testgroup)
30-
for file in filter(istestfile, readdir(groupdir))
31-
filename = joinpath(groupdir, file)
32-
@eval @safetestset $file begin
33-
include($filename)
26+
# tests in groups based on folder structure
27+
for testgroup in filter(isdir, readdir(@__DIR__))
28+
if GROUP == "ALL" || GROUP == uppercase(testgroup)
29+
groupdir = joinpath(@__DIR__, testgroup)
30+
for file in filter(istestfile, readdir(groupdir))
31+
filename = joinpath(groupdir, file)
32+
@eval @safetestset $file begin
33+
include($filename)
34+
end
35+
end
3436
end
35-
end
3637
end
37-
end
3838

39-
# single files in top folder
40-
for file in filter(istestfile, readdir(@__DIR__))
41-
(file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion
42-
@eval @safetestset $file begin
43-
include($file)
39+
# single files in top folder
40+
for file in filter(istestfile, readdir(@__DIR__))
41+
(file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion
42+
@eval @safetestset $file begin
43+
include($file)
44+
end
4445
end
45-
end
4646

47-
# test examples
48-
examplepath = joinpath(@__DIR__, "..", "examples")
49-
for (root, _, files) in walkdir(examplepath)
50-
contains(chopprefix(root, @__DIR__), "setup") && continue
51-
for file in filter(isexamplefile, files)
52-
filename = joinpath(root, file)
53-
@eval begin
54-
@safetestset $file begin
55-
$(Expr(
56-
:macrocall,
57-
GlobalRef(Suppressor, Symbol("@suppress")),
58-
LineNumberNode(@__LINE__, @__FILE__),
59-
:(include($filename)),
60-
))
47+
# test examples
48+
examplepath = joinpath(@__DIR__, "..", "examples")
49+
for (root, _, files) in walkdir(examplepath)
50+
contains(chopprefix(root, @__DIR__), "setup") && continue
51+
for file in filter(isexamplefile, files)
52+
filename = joinpath(root, file)
53+
@eval begin
54+
@safetestset $file begin
55+
$(
56+
Expr(
57+
:macrocall,
58+
GlobalRef(Suppressor, Symbol("@suppress")),
59+
LineNumberNode(@__LINE__, @__FILE__),
60+
:(include($filename)),
61+
)
62+
)
63+
end
64+
end
6165
end
62-
end
6366
end
64-
end
6567
end

test/test_aqua.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ using Aqua: Aqua
33
using Test: @testset
44

55
@testset "Code quality (Aqua.jl)" begin
6-
Aqua.test_all(ITensorDocsNext)
6+
Aqua.test_all(ITensorDocsNext)
77
end

0 commit comments

Comments
 (0)