Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

julia/docs: more DRY on page rendering #16396

Merged
merged 3 commits into from
Oct 24, 2019
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 julia/docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ DocumenterMarkdown = "997ab1e6-3595-5248-9280-8efb232c3433"
MXNet = "a7949054-b901-59c6-b8e3-7238c29bf7f0"

[compat]
Documenter = "~0.21"
Documenter = "~0.23"
33 changes: 33 additions & 0 deletions julia/docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,39 @@ using Documenter
using DocumenterMarkdown
using MXNet

"""
Return all files of a submodule

julia> listpages("ndarray")
15-element Array{String,1}:
"ndarray.jl"
"ndarray/activation.jl"
"ndarray/arithmetic.jl"
"ndarray/array.jl"
...
"ndarray/statistic.jl"
"ndarray/trig.jl"
"ndarray/type.jl"
"""
listpages(x) =
["$x.jl"; joinpath.(x, readdir(joinpath(@__DIR__, "..", "src", x)))]

const api_pages = [
"api/context.md",
"api/ndarray.md",
"api/symbolic-node.md",
"api/model.md",
"api/initializers.md",
"api/optimizers.md",
"api/callbacks.md",
"api/metric.md",
"api/io.md",
"api/nn-factory.md",
"api/executor.md",
"api/kvstore.md",
"api/visualize.md",
]

makedocs(
sitename = "MXNet.jl",
modules = MXNet,
Expand Down
1 change: 1 addition & 0 deletions julia/docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ nav:
- Symbolic API: api/symbolic-node.md
- Neural Networks Factory: api/nn-factory.md
- Executor: api/executor.md
- Key-Value Store: api/kvstore.md
- Network Visualization: api/visualize.md
15 changes: 1 addition & 14 deletions julia/docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,5 @@
# API Documentation

```@contents
Pages = [
"api/symbolic-node.md",
"api/ndarray.md",
"api/context.md",
"api/model.md",
"api/initializers.md",
"api/optimizers.md",
"api/callbacks.md",
"api/metric.md",
"api/io.md",
"api/nn-factory.md",
"api/executor.md",
"api/visualize.md",
]
Pages = api_pages
```
20 changes: 2 additions & 18 deletions julia/docs/src/api/ndarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

## Arithmetic Operations

In the following example `y` can be a `Real` value or another `NDArray`
In the following example `y` can be a `Real` value or another `NDArray`.

| API | Example | |
|-----|----------|----------------------------|
Expand Down Expand Up @@ -70,21 +70,5 @@ In the following example `y` can be a `Real` value or another `NDArray`

```@autodocs
Modules = [MXNet.mx]
Pages = [
"ndarray.jl",
"ndarray/activation.jl",
"ndarray/arithmetic.jl",
"ndarray/array.jl",
"ndarray/autoimport.jl",
"ndarray/comparison.jl",
"ndarray/context.jl",
"ndarray/io.jl",
"ndarray/linalg.jl",
"ndarray/reduction.jl",
"ndarray/remap.jl",
"ndarray/show.jl",
"ndarray/statistic.jl",
"ndarray/trig.jl",
"ndarray/type.jl",
]
Pages = listpages("ndarray")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if anything gets added you don't have to list it out manually?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that function lists the dir src/ndarray.

```
11 changes: 1 addition & 10 deletions julia/docs/src/api/symbolic-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,5 @@

```@autodocs
Modules = [MXNet.mx]
Pages = [
"symbolic-node.jl",
"symbolic-node/arithmetic.jl",
"symbolic-node/array.jl",
"symbolic-node/autodiff.jl",
"symbolic-node/io.jl",
"symbolic-node/op.jl",
"symbolic-node/show.jl",
"symbolic-node/type.jl",
]
Pages = listpages("symbolic-node")
```
16 changes: 2 additions & 14 deletions julia/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ Depth = 2
## API Documentation

```@contents
Pages = [
"api/context.md",
"api/ndarray.md",
"api/symbolic-node.md",
"api/model.md",
"api/initializers.md",
"api/optimizers.md",
"api/callbacks.md",
"api/metric.md",
"api/io.md",
"api/nn-factory.md",
"api/executor.md",
"api/visualize.md",
]
Pages = api_pages
Depth = 2
```
2 changes: 1 addition & 1 deletion julia/src/executor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Total 11 TempSpace resource requested
```
"""
Base.print(io::IO, x::Executor) = print(io, debug_str(x))
Base.print(x::Executor) = print(STDOUT, x)
Base.print(x::Executor) = print(stdout, x)

function debug_str(x::Executor)
s_ref = Ref{Cstring}(C_NULL)
Expand Down
2 changes: 1 addition & 1 deletion julia/src/symbolic-node/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ function Base.print(io::IO, sym::SymbolicNode)
print(io, unsafe_string(out[]))
end

Base.print(sym::SymbolicNode) = print(STDOUT, sym)
Base.print(sym::SymbolicNode) = print(stdout, sym)