Skip to content

Commit cadab16

Browse files
authored
Standardize yml files / Polynomials v4 compat (#85)
* Standardize docs * Standardize yml * Show version * Polynomials v4 * Update jldoctest output for v10 * Update jldoctest output
1 parent 3242e34 commit cadab16

File tree

13 files changed

+102
-25
lines changed

13 files changed

+102
-25
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
version: 2
44
updates:
5-
- package-ecosystem: "github-actions"
5+
- package-ecosystem: github-actions
66
directory: "/"
77
schedule:
88
interval: "weekly"

.github/workflows/CompatHelper.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: julia-actions/setup-julia@latest
2020
with:
2121
version: '1'
22-
arch: ${{ runner.arch }}
22+
# arch: ${{ runner.arch }}
2323
if: steps.julia_in_path.outcome != 'success'
2424
- name: "Add the General registry via Git"
2525
run: |
@@ -43,3 +43,6 @@ jobs:
4343
env:
4444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4545
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
46+
47+
# based on:
48+
# https://github.com/JuliaRegistries/CompatHelper.jl

.github/workflows/Documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: julia-actions/setup-julia@latest
2121
with:
2222
version: '1'
23-
- name: Cache artifacts
23+
- name: CacheArtifacts
2424
uses: actions/cache@v4
2525
env:
2626
cache-name: cache-artifacts
@@ -31,7 +31,7 @@ jobs:
3131
${{ runner.os }}-test-${{ env.cache-name }}-
3232
${{ runner.os }}-test-
3333
${{ runner.os }}-
34-
- name: Install dependencies
34+
- name: InstallDependencies
3535
run: |
3636
julia --project=docs/ -e '
3737
ENV["JULIA_PKG_SERVER"] = ""

.github/workflows/SpellCheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Spell Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
typos-check:
7+
name: Spell Check with Typos
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Actions Repository
11+
uses: actions/checkout@v4
12+
- name: Check spelling
13+
uses: crate-ci/typos@master

.github/workflows/TagBot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: TagBot
2+
23
on:
34
issue_comment:
45
types:
56
- created
67
workflow_dispatch:
8+
79
jobs:
810
TagBot:
911
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
77
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
88

99
[compat]
10-
Polynomials = "1, 2, 3"
10+
Polynomials = "1, 2, 3, 4"
1111
julia = "1.6"

docs/inc/reproduce.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
# ### Reproducibility
3+
4+
# This page was generated with the following version of Julia:
5+
using InteractiveUtils: versioninfo
6+
io = IOBuffer(); versioninfo(io); split(String(take!(io)), '\n')
7+
8+
# And with the following package versions
9+
import Pkg; Pkg.status()

docs/inc/urls.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
#=
3+
This page comes from a single Julia file:
4+
[`@__NAME__.jl`](xxxrepo/@__NAME__.jl).
5+
6+
You can access the source code
7+
for such Julia documentation
8+
using the 'Edit on GitHub' link in the top right.
9+
You can view the corresponding notebook in
10+
[nbviewer](https://nbviewer.org/) here:
11+
[`@__NAME__.ipynb`](xxxnb/@__NAME__.ipynb),
12+
or open it in [binder](https://mybinder.org/) here:
13+
[`@__NAME__.ipynb`](xxxbinder/@__NAME__.ipynb).
14+
=#

docs/lit/examples/1-overview.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ supports
1717
Toeplitz, Hankel, and circulant matrices.
1818
=#
1919

20+
#srcURL
21+
22+
2023
# ### Setup
2124

2225
# Packages needed here.
@@ -88,6 +91,7 @@ Kahan(5, 3, 0.5, 0)
8891
#
8992
Kahan(3, 5, 0.5, 1e-3)
9093

94+
9195
#=
9296
## `Riemann` matrix
9397
@@ -140,3 +144,6 @@ V \ a
140144

141145
#
142146
V' \ V[3,:]
147+
148+
149+
include("../../../inc/reproduce.jl")

docs/make.jl

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ execute = isempty(ARGS) || ARGS[1] == "run"
22

33
org, reps = :JuliaLinearAlgebra, :SpecialMatrices
44
eval(:(using $reps))
5-
using Documenter
6-
using Literate
5+
import Documenter
6+
import Literate
77

88
# https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@example-block
99
ENV["GKSwstype"] = "100"
@@ -15,25 +15,51 @@ src = joinpath(@__DIR__, "src")
1515
gen = joinpath(@__DIR__, "src/generated")
1616

1717
base = "$org/$reps.jl"
18-
repo_root_url =
19-
"https://github.com/$base/blob/main"
18+
repo_root_url = "https://github.com/$base/blob/main"
2019
nbviewer_root_url =
2120
"https://nbviewer.org/github/$base/tree/gh-pages/dev/generated/examples"
2221
binder_root_url =
2322
"https://mybinder.org/v2/gh/$base/gh-pages?filepath=dev/generated/examples"
2423

2524

2625
repo = eval(:($reps))
27-
DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true)
26+
Documenter.DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true)
27+
28+
# preprocessing
29+
inc1 = "include(\"../../../inc/reproduce.jl\")"
30+
31+
function prep_markdown(str, root, file)
32+
inc_read(file) = read(joinpath("docs/inc", file), String)
33+
repro = inc_read("reproduce.jl")
34+
str = replace(str, inc1 => repro)
35+
urls = inc_read("urls.jl")
36+
file = joinpath(splitpath(root)[end], splitext(file)[1])
37+
tmp = splitpath(root)[end-3:end] # docs lit demos 00
38+
urls = replace(urls,
39+
"xxxrepo" => joinpath(repo_root_url, tmp...),
40+
"xxxnb" => joinpath(nbviewer_root_url, tmp[end]),
41+
"xxxbinder" => joinpath(binder_root_url, tmp[end]),
42+
)
43+
str = replace(str, "#srcURL" => urls)
44+
end
45+
46+
function prep_notebook(str)
47+
str = replace(str, inc1 => "", "#srcURL" => "")
48+
end
2849

2950
for (root, _, files) in walkdir(lit), file in files
3051
splitext(file)[2] == ".jl" || continue # process .jl files only
3152
ipath = joinpath(root, file)
3253
opath = splitdir(replace(ipath, lit => gen))[1]
33-
Literate.markdown(ipath, opath; documenter = execute, # run examples
34-
repo_root_url, nbviewer_root_url, binder_root_url)
35-
Literate.notebook(ipath, opath; execute = false, # no-run notebooks
36-
repo_root_url, nbviewer_root_url, binder_root_url)
54+
Literate.markdown(ipath, opath;
55+
repo_root_url,
56+
preprocess = str -> prep_markdown(str, root, file),
57+
documenter = execute, # run examples
58+
)
59+
Literate.notebook(ipath, opath;
60+
preprocess = prep_notebook,
61+
execute = false, # no-run notebooks
62+
)
3763
end
3864

3965

@@ -48,10 +74,10 @@ format = Documenter.HTML(;
4874
prettyurls = isci,
4975
edit_link = "main",
5076
canonical = "https://$org.github.io/$repo.jl/stable/",
51-
# assets = String[],
77+
assets = ["assets/custom.css"],
5278
)
5379

54-
makedocs(;
80+
Documenter.makedocs(;
5581
modules = [repo],
5682
sitename = "$repo.jl",
5783
format,
@@ -63,7 +89,7 @@ makedocs(;
6389
)
6490

6591
if isci
66-
deploydocs(;
92+
Documenter.deploydocs(;
6793
repo = "github.com/$base",
6894
devbranch = "main",
6995
devurl = "dev",

docs/src/assets/custom.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.docs-sourcelink {
2+
opacity:1 !important;
3+
}

src/companion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Also, directly from a polynomial:
3232
julia> using Polynomials
3333
3434
julia> P = Polynomial(2:5)
35-
Polynomials.Polynomial(2 + 3*x + 4*x^2 + 5*x^3)
35+
Polynomial(2 + 3*x + 4*x^2 + 5*x^3)
3636
3737
julia> C = Companion(P)
3838
3×3 Companion{Float64}:

src/hilbert.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ where element `i,j` equal to `1 / (i+j-1)`.
1414
```jldoctest hilbert1
1515
julia> A = Hilbert(5)
1616
5×5 Hilbert{Rational{Int64}}:
17-
1//1 1//2 1//3 1//4 1//5
17+
1 1//2 1//3 1//4 1//5
1818
1//2 1//3 1//4 1//5 1//6
1919
1//3 1//4 1//5 1//6 1//7
2020
1//4 1//5 1//6 1//7 1//8
2121
1//5 1//6 1//7 1//8 1//9
2222
2323
julia> Matrix(A)
2424
5×5 Matrix{Rational{Int64}}:
25-
1//1 1//2 1//3 1//4 1//5
25+
1 1//2 1//3 1//4 1//5
2626
1//2 1//3 1//4 1//5 1//6
2727
1//3 1//4 1//5 1//6 1//7
2828
1//4 1//5 1//6 1//7 1//8
@@ -34,11 +34,11 @@ Inverses are also integer matrices:
3434
```jldoctest hilbert1
3535
julia> inv(A)
3636
5×5 InverseHilbert{Rational{Int64}}:
37-
25//1 -300//1 1050//1 -1400//1 630//1
38-
-300//1 4800//1 -18900//1 26880//1 -12600//1
39-
1050//1 -18900//1 79380//1 -117600//1 56700//1
40-
-1400//1 26880//1 -117600//1 179200//1 -88200//1
41-
630//1 -12600//1 56700//1 -88200//1 44100//1
37+
25 -300 1050 -1400 630
38+
-300 4800 -18900 26880 -12600
39+
1050 -18900 79380 -117600 56700
40+
-1400 26880 -117600 179200 -88200
41+
630 -12600 56700 -88200 44100
4242
```
4343
"""
4444
struct Hilbert{T} <: AbstractMatrix{T}

0 commit comments

Comments
 (0)