Skip to content

Commit 373183f

Browse files
authored
Fix and test docstrings, and use Documenter v1 for docs (#324)
* Fix and test docstrings, and use Docuemnter v1 for docs * Change 7. to 7.0 in Fill docstring * Ignore manual files
1 parent d3387ba commit 373183f

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FillArraysStatisticsExt = "Statistics"
2222
[compat]
2323
Aqua = "0.8"
2424
Base64 = "1.6"
25+
Documenter = "1"
2526
Infinities = "0.1"
2627
LinearAlgebra = "1.6"
2728
PDMats = "0.11.17"
@@ -36,6 +37,7 @@ julia = "1.6"
3637
[extras]
3738
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3839
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
40+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3941
Infinities = "e1ba4f0e-776d-440f-acd9-e1d2e9742647"
4042
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
4143
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
@@ -45,4 +47,4 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
4547
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4648

4749
[targets]
48-
test = ["Aqua", "Test", "Base64", "Infinities", "PDMats", "ReverseDiff", "SparseArrays", "StaticArrays", "Statistics"]
50+
test = ["Aqua", "Test", "Base64", "Infinities", "PDMats", "ReverseDiff", "SparseArrays", "StaticArrays", "Statistics", "Documenter"]

docs/Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
66
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
77

88
[compat]
9-
Documenter = "0.27"
9+
Documenter = "1"
10+
Random = "1"
11+
SparseArrays = "1"
1012
StaticArrays = "1"

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The elements of a `Fill` array don't need to be restricted to numbers, and these
6969

7070
```jldoctest
7171
julia> f = Fill("hello", 2,5)
72-
2×5 Fill{String}, with entries equal to hello
72+
2×5 Fill{String}, with entries equal to "hello"
7373
7474
julia> Array(f)
7575
2×5 Matrix{String}:

src/FillArrays.jl

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,10 @@ Typically created by `Fill` or `Zeros` or `Ones`
9494
9595
```jldoctest
9696
julia> Fill(7, (2,3))
97-
2×3 Fill{Int64,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}:
98-
7 7 7
99-
7 7 7
100-
101-
julia> Fill{Float64, 1, Tuple{UnitRange{Int64}}}(7., (1:2,))
102-
2-element Fill{Float64,1,Tuple{UnitRange{Int64}}} with indices 1:2:
103-
7.0
104-
7.0
97+
2×3 Fill{Int64}, with entries equal to 7
98+
99+
julia> Fill{Float64, 1, Tuple{UnitRange{Int64}}}(7.0, (1:2,))
100+
2-element Fill{Float64, 1, Tuple{UnitRange{Int64}}} with indices 1:2, with entries equal to 7.0
105101
```
106102
"""
107103
struct Fill{T, N, Axes} <: AbstractFill{T, N, Axes}
@@ -716,12 +712,9 @@ function Base.show(io::IO, ::MIME"text/plain", x::Union{Eye, AbstractFill})
716712
return show(io, x)
717713
end
718714
summary(io, x)
719-
if x isa Union{AbstractZeros, AbstractOnes, Eye}
720-
# then no need to print entries
721-
elseif length(x) > 1
722-
print(io, ", with entries equal to ", getindex_value(x))
723-
else
724-
print(io, ", with entry equal to ", getindex_value(x))
715+
if !(x isa Union{AbstractZeros, AbstractOnes, Eye})
716+
print(io, ", with ", length(x) > 1 ? "entries" : "entry", " equal to ")
717+
show(io, getindex_value(x))
725718
end
726719
end
727720

src/trues.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@ Typically created using `Trues(dims)` or `Trues(dims...)`
77
88
# Example
99
```jldoctest
10-
julia> Trues(1,3)
11-
1×3 Ones{Bool,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}} = true
10+
julia> T = Trues(1,3)
11+
1×3 Ones{Bool}
1212
13-
julia> Trues((2,3))
14-
2×3 Ones{Bool,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}} = true
13+
julia> Array(T)
14+
1×3 Matrix{Bool}:
15+
1 1 1
1516
```
1617
"""
1718
const Trues = Ones{Bool, N, Axes} where {N, Axes}
1819

1920

20-
""" `Falses = Zeros{Bool, N, Axes}` (see `Trues`) """
21+
"""
22+
Falses = Zeros{Bool, N, Axes}
23+
24+
Lazy version of `falses` with axes.
25+
26+
See also: [`Trues`](@ref)
27+
"""
2128
const Falses = Zeros{Bool, N, Axes} where {N, Axes}
2229

2330

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
using FillArrays, LinearAlgebra, PDMats, SparseArrays, StaticArrays, ReverseDiff, Random, Base64, Test, Statistics
22
import FillArrays: AbstractFill, RectDiagonal, SquareEye
33

4+
using Documenter
5+
DocMeta.setdocmeta!(FillArrays, :DocTestSetup, :(using FillArrays))
6+
doctest(FillArrays; manual = false)
7+
48
using Aqua
59
@testset "Project quality" begin
610
Aqua.test_all(FillArrays;

0 commit comments

Comments
 (0)