Skip to content

Commit 047e753

Browse files
authored
Merge pull request #65 from lorenzoh/lo/pollen-docs
Set up Pollen.jl documentation
2 parents c51834b + 64d416e commit 047e753

File tree

11 files changed

+200
-36
lines changed

11 files changed

+200
-36
lines changed

.github/workflows/pollenbuild.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: pollenbuild
2+
3+
on:
4+
push:
5+
branches: ['master', 'main']
6+
7+
jobs:
8+
pollen:
9+
name: "Pollen - build documentation data"
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v2
14+
with:
15+
ref: pollen
16+
path: pollen
17+
- uses: julia-actions/setup-julia@latest
18+
with:
19+
version: '1.7'
20+
- name: "Install package and docs dependencies"
21+
run: |
22+
julia --color=yes --project=./docs -e 'using Pkg; Pkg.add([Pkg.PackageSpec(path="."), Pkg.PackageSpec(url="https://github.com/c42f/JuliaSyntax.jl"), Pkg.PackageSpec(url="https://github.com/lorenzoh/ModuleInfo.jl"), Pkg.PackageSpec(url="https://github.com/lorenzoh/Pollen.jl", rev="main")]); Pkg.instantiate();'
23+
- name: Build
24+
run: |
25+
julia --color=yes --project=./docs ./docs/make.jl ./pollen/dev/
26+
- name: Deploy
27+
run: |
28+
cd pollen
29+
git config user.name github-actions
30+
git config user.email [email protected]
31+
git add .
32+
git commit -m "Build documentation data (Pollen.jl)"
33+
git push

.github/workflows/pollenstatic.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: pollenstatic
2+
3+
on:
4+
push:
5+
branches: ['pollen']
6+
workflow_run:
7+
workflows: ['pollenbuild']
8+
types:
9+
- completed
10+
11+
jobs:
12+
pollen:
13+
name: "Pollen - Prerender static frontend and deploy"
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: pollen
19+
path: data
20+
- uses: actions/checkout@v2
21+
with:
22+
ref: "gh-pages"
23+
path: pages
24+
- uses: actions/checkout@v2
25+
with:
26+
repository: lorenzoh/pollenjl-frontend
27+
path: frontend
28+
ref: main
29+
- name: Move Pollen data to static folder
30+
run: |
31+
ls
32+
rm -rf data/.git
33+
cp -r data/ frontend/static/
34+
- uses: actions/setup-node@v2
35+
- name: Install dependencies
36+
run: |
37+
cd frontend
38+
npm install
39+
- name: Build
40+
run: |
41+
cd frontend
42+
npm run build
43+
- name: Build search index
44+
run: |
45+
cd frontend
46+
cat static/data/dev/documents.json | node buildindex.cjs > ../data/dev/searchindex.json
47+
- name: Deploy changes
48+
run: |
49+
ls -lt
50+
rm -r frontend/build/data
51+
cp -r frontend/build/** pages
52+
cp -r data pages/
53+
cd pages
54+
git config user.name github-actions
55+
git config user.email [email protected]
56+
git add -f .
57+
git commit -m "Deploy documentation (Pollen.jl)"
58+
git push

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ Setfield = "0.7, 0.8"
4040
StaticArrays = "1"
4141
julia = "1.3, 1.4, 1.5"
4242

43-
[publish]
43+
[pollen]
4444
title = "DataAugmentation.jl"

docs/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
[deps]
22
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
3+
DataAugmentation = "88a5189c-e7ff-4f85-ac6b-e6158070f02e"
34
FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
45
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
56
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
67
ImageShow = "4e3cecfd-b093-5904-9786-8bbb286a6a31"
78
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
9+
JuliaSyntax = "70703baa-626e-46a2-a12c-08ffd08c73b4"
10+
ModuleInfo = "3c3ff5e7-c68c-4a09-80d1-9526a1e9878a"
811
MosaicViews = "e94cdb99-869f-56ef-bcf0-1ae2bcbe0389"
12+
Pollen = "c88717ad-5130-4874-a664-5a9aba5ec443"
913
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1014
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"

docs/make.jl

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1-
using Pollen
2-
using DataAugmentation
3-
using FilePathsBase
1+
"""
2+
This script builds the Pollen.jl documentation so that it can be loaded
3+
by the frontend. It accepts one argument: the path where the generated
4+
files should be stored.
45
5-
project = Pollen.documentationproject(DataAugmentation)
6-
Pollen.fullbuild(project, Pollen.FileBuilder(Pollen.HTML(), p"dev/"))
6+
> julia docs/make.jl DIR
7+
8+
Use `./serve.jl` for interactive development.
9+
"""
10+
11+
# Create target folder
12+
isempty(ARGS) && error("Please pass a file path to make.jl:\n\t> julia docs/make.jl DIR ")
13+
DIR = abspath(mkpath(ARGS[1]))
14+
15+
# Create Project
16+
project = include("project.jl")
17+
18+
@info "Rewriting documents..."
19+
Pollen.rewritesources!(project)
20+
21+
@info "Writing to disk at \"$DIR\"..."
22+
Pollen.build(
23+
FileBuilder(
24+
JSONFormat(),
25+
DIR,
26+
),
27+
project,
28+
)

docs/project.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Pollen
2+
using Pkg
3+
4+
# The main package you are documenting
5+
using DataAugmentation
6+
m = DataAugmentation
7+
8+
9+
# Packages that will be indexed in the documentation. Add additional modules
10+
# to the list.
11+
ms = [m]
12+
13+
14+
# Add rewriters here
15+
project = Project(
16+
Pollen.Rewriter[
17+
DocumentFolder(Pkg.pkgdir(m), prefix = "documents"),
18+
ParseCode(),
19+
ExecuteCode(),
20+
PackageDocumentation(ms),
21+
StaticResources(),
22+
DocumentGraph(),
23+
SearchIndex(),
24+
SaveAttributes((:title,)),
25+
LoadFrontendConfig(Pkg.pkgdir(m))
26+
],
27+
)

docs/serve.jl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1-
using Pkg
1+
"""
2+
This script serves the Pollen.jl documentation on a local file server
3+
so that it can be loaded by the frontend in development mode.
4+
files should be stored.
5+
6+
> julia docs/serve.jl
7+
8+
Use `./make.jl` to export the generated documents to disk.
9+
10+
There are two modes for interactive development: Lazy and Regular.
11+
In lazy mode, each document will be built only if it is requested in
12+
the frontend, while for Regular mode, each document will be built
13+
once before serving.
14+
"""
15+
216
using Pollen
3-
using DataAugmentation
417

5-
p = Pollen.documentationproject(DataAugmentation)
6-
Pollen.serve(p)
18+
project = include("project.jl")
19+
20+
21+
Pollen.serve(
22+
project;
23+
lazy = get(ENV, "POLLEN_LAZY", "false") == "true",
24+
port = Base.parse(Int, get(ENV, "POLLEN_PORT", "8000")),
25+
format = JSONFormat()
26+
)

docs/toc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"README": "documents/README.md",
3+
"Quickstart": "documents/docs/literate/quickstart.md",
4+
"Overview": "documents/docs/literate/intro.md",
5+
"How-to": {
6+
"Apply transforms inplace": "documents/docs/literate/buffering.md",
7+
"Construct projective transforms": "docs/literate/projective/usage.md"
8+
},
9+
"Reference": {
10+
"Module reference": "references/DataAugmentation",
11+
"Transforms": {
12+
"Projective": "documents/docs/literate/projective/gallery.md",
13+
"Preprocessing": "documents/docs/literate/preprocessing.md",
14+
"Color": "documents/docs/literate/colortransforms.md",
15+
"Stochastic": "documents/docs/literate/stochastic.md"
16+
},
17+
"Items": {
18+
"Spatial data": "documents/docs/literate/projective/data.md"
19+
},
20+
"Interfaces": {
21+
"Items": "documents/docs/literate/iteminterface.md",
22+
"Transforms": "documents/docs/literate/tfminterface.md",
23+
"Projective transforms": "documents/docs/literate/projective/interface.md"
24+
}
25+
}
26+
}

src/items/image.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# ## `items/image.jl`
2-
#
3-
# ### Item
4-
#
51
# We first define the [`Image`](#) item. Since we need to keep
62
# track of the spatial bounds for projective transformations
73
# we add them as a field. By default, they will simply
@@ -58,9 +54,6 @@ function showitem!(img, image::Image{2, <:AbstractFloat})
5854
end
5955

6056

61-
62-
# ### Projective transformations
63-
#
6457
# To support projective transformations, we need to implement [`getbounds`](#)
6558
# and [`project`](#).
6659

src/items/keypoints.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ function showitem!(img, keypoints::Keypoints{N}) where N
6262
return img
6363
end
6464

65-
# ## Wrappers
66-
#
6765
# We also define some wrappers for `Keypoints` which have the same representation,
6866
# but a different meaning.
6967

0 commit comments

Comments
 (0)