Skip to content

Commit

Permalink
Merge pull request #295 from hyrodium/fix/docs
Browse files Browse the repository at this point in the history
Update documents
  • Loading branch information
cormullion authored Feb 18, 2024
2 parents 7fa91e1 + 6df6d2a commit 80a780b
Show file tree
Hide file tree
Showing 38 changed files with 184 additions and 177 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Luxor isn't interactive: for building interactivity, look at [Pluto.jl](https://
[docs-development-url]: https://juliagraphics.github.io/LuxorManual/dev/

[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg
[docs-stable-url]: https://juliagraphics.github.io/Luxor.jl/stable/
[docs-stable-url]: https://juliagraphics.github.io/LuxorManual/stable/

[travis-img]: https://travis-ci.org/JuliaGraphics/Luxor.jl.svg?branch=master
[travis-url]: https://travis-ci.org/JuliaGraphics/Luxor.jl
Expand Down
79 changes: 41 additions & 38 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Documenter, Luxor

# Setup for doctests in docstrings
DocMeta.setdocmeta!(Luxor, :DocTestSetup, :(using Luxor))

makedocs(
modules = [Luxor],
sitename = "Luxor",
Expand All @@ -13,57 +16,57 @@ makedocs(
pages = [
"Introduction to Luxor" => "index.md",
"Tutorials" => [
"Hello World" => "tutorial/helloworld.md",
"Basic path building" => "tutorial/basicpath.md",
"Design a logo" => "tutorial/quickstart.md",
"Geometry tutorial" => "tutorial/basictutorial.md",
"Playing with pixels" => "tutorial/pixels.md",
"Simple animation" => "tutorial/simple-animation.md"
"Hello World" => "tutorial/helloworld.md",
"Basic path building" => "tutorial/basicpath.md",
"Design a logo" => "tutorial/quickstart.md",
"Geometry tutorial" => "tutorial/basictutorial.md",
"Playing with pixels" => "tutorial/pixels.md",
"Simple animation" => "tutorial/simple-animation.md",
],
"Examples" => [
"Simple examples" => "example/examples.md",
"More examples" => "example/moreexamples.md",
"Gallery" => "example/gallery.md",
"Simple examples" => "example/examples.md",
"More examples" => "example/moreexamples.md",
"Gallery" => "example/gallery.md",
],
"How to guides" => [
"Create drawings" => "howto/createdrawings.md",
"Draw simple shapes" => "howto/simplegraphics.md",
"Use geometry tools" => "howto/geometrytools.md",
"Work with tables and grids" => "howto/tables-grids.md",
"Use colors and styles" => "howto/colors-styles.md",
"Work with polygons" => "howto/polygons.md",
"Add text" => "howto/text.md",
"Clip graphics" => "howto/clipping.md",
"Placing images" => "howto/images.md",
"Turtle graphics" => "howto/turtle.md",
"Make animations" => "howto/animation.md",
"Snapshots" => "howto/snapshots.md",
"Interactive graphics and Threads" => "howto/livegraphics.md"
"Create drawings" => "howto/createdrawings.md",
"Draw simple shapes" => "howto/simplegraphics.md",
"Use geometry tools" => "howto/geometrytools.md",
"Work with tables and grids" => "howto/tables-grids.md",
"Use colors and styles" => "howto/colors-styles.md",
"Work with polygons" => "howto/polygons.md",
"Add text" => "howto/text.md",
"Clip graphics" => "howto/clipping.md",
"Placing images" => "howto/images.md",
"Turtle graphics" => "howto/turtle.md",
"Make animations" => "howto/animation.md",
"Snapshots" => "howto/snapshots.md",
"Interactive graphics and Threads" => "howto/livegraphics.md",
],
"Explanations" => [
"Basic concepts" => "explanation/basics.md",
"Paths vs Polygon" => "explanation/pathspolygons.md",
"Perfect pixels and antialising" => "explanation/perfectpixels.md",
"Transforms and matrices" => "explanation/transforms.md",
"Image matrix" => "explanation/imagematrix.md",
"Fonts on Linux" => "explanation/fonts.md",
"Luxor and Cairo" => "explanation/luxorcairo.md",
"Customize strokepath/fillpath" => "explanation/strokepathdispatch.md",
"Contributing" => "explanation/contributing.md"
"Basic concepts" => "explanation/basics.md",
"Paths vs Polygon" => "explanation/pathspolygons.md",
"Perfect pixels and antialising" => "explanation/perfectpixels.md",
"Transforms and matrices" => "explanation/transforms.md",
"Image matrix" => "explanation/imagematrix.md",
"Fonts on Linux" => "explanation/fonts.md",
"Luxor and Cairo" => "explanation/luxorcairo.md",
"Customize strokepath/fillpath" => "explanation/strokepathdispatch.md",
"Contributing" => "explanation/contributing.md",
],
"Reference" => [
"Alphabetical function list" => "reference/functionindex.md"
"Function reference" => "reference/api.md"
]
"Alphabetical function list" => "reference/functionindex.md",
"Function reference" => "reference/api.md",
],
],
)

repo = "github.com/JuliaGraphics/LuxorManual.git"
withenv("GITHUB_REPOSITORY" => repo) do
deploydocs(
repo = repo,
target = "build",
push_preview = true,
forcepush = true,
repo = repo,
target = "build",
push_preview = true,
forcepush = true,
)
end
10 changes: 5 additions & 5 deletions docs/src/explanation/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ You can reposition the origin at any time, using [`origin`](@ref). The 'user spa

The Point type holds two coordinates, `x` and `y`. For example:

```julia
```julia-repl
julia> P = Point(12.0, 13.0)
Luxor.Point(12.0, 13.0)
Expand All @@ -95,7 +95,7 @@ Points are immutable, so you can't change P's x or y values directly. But it's e

Points can be added together:

```julia
```julia-repl
julia> Q = Point(4, 5)
Luxor.Point(4.0, 5.0)
Expand All @@ -105,7 +105,7 @@ Luxor.Point(16.0, 18.0)

You can add and multiply Points and scalars:

```julia
```julia-repl
julia> 10P
Luxor.Point(120.0, 130.0)
Expand All @@ -115,7 +115,7 @@ Luxor.Point(112.0, 113.0)

You can also make new points by mixing Points and tuples:

```julia
```julia-repl
julia> P + (10, 0)
Luxor.Point(22.0, 13.0)
Expand All @@ -125,7 +125,7 @@ Luxor.Point(2.0, 2.5)

You can also create points from tuples:

```julia
```julia-repl
julia> Point((1.0, 14))
Point(1.0, 14.0)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/explanation/imagematrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ preview()
The next example draws an ampersand and then processes the
pixels further in Images.jl.

```
```julia
using Luxor, Colors, Images, ImageFiltering

m = @imagematrix begin
Expand Down Expand Up @@ -57,7 +57,7 @@ bit integer.

You can display the matrix using, for example, Images.jl.

```
```julia
using Luxor, Images

# in Luxor
Expand Down
8 changes: 4 additions & 4 deletions docs/src/explanation/pathspolygons.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ this is easy, and the functions that provide a `reversepath`
keyword argument can help. If not, you can do things like
this:

```
```julia
circle(O, 100, :path) # add a circle to the current path
poly(reverse(box(O, 50, 50)), :path) # create polygon, add to current path after reversing
fillpath() # finally fill the two-part path
Expand Down Expand Up @@ -178,7 +178,7 @@ pathexample # save Path

`pathexample` now contains the path, stored in a Luxor object of type `Path`. The current path is still present.

```
```julia-repl
julia> pathexample
Path([
PathMove(Point(-220.0, 50.0)),
Expand Down Expand Up @@ -249,15 +249,15 @@ sequences of short straight lines.

So:

```
```julia
circle(O, 100, :path)
p = pathtopoly()
poly(first(p), :stroke)
```

is more or less equivalent to:

```
```julia
ngon(O, 100, 129, 0, :stroke) # a 129agon with radius 100
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/explanation/transforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ In Luxor, there's always a *current matrix* that determines how coordinates are

and Luxor/Cairo matrix functions accept and return simple 6-element vectors:

```julia
```julia-repl
julia> getmatrix()
6-element Array{Float64,1}:
1.0
Expand Down
2 changes: 1 addition & 1 deletion docs/src/howto/livegraphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ preview()

Luxor is thread safe. To run the examples below, [start Julia with more than 1 thread](https://docs.julialang.org/en/v1/manual/multi-threading/#Starting-Julia-with-multiple-threads). To see how many threads you have available, ask Julia:

```julia
```julia-repl
julia> Threads.nthreads()
4
```
Expand Down
8 changes: 4 additions & 4 deletions docs/src/howto/simplegraphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ circle at the midpoint of an arrow's shaft, you can define a
function that draws text `t` in a circle of radius `r` like
this:

```
```julia
function marker(r, t)
@layer begin
sethue("purple")
Expand Down Expand Up @@ -1148,7 +1148,7 @@ nothing # hide

It's possible to store the current path in a Path object. For example, this code:

```
```julia
fontsize(160)
fontface("Bodoni-Poster")
textpath("", O, halign=:center, valign=:middle)
Expand All @@ -1159,7 +1159,7 @@ stores the instructions to build the current path (which describe the dagger sym

The `dagger` is a Luxor Path type, and contains:

```
```julia
PathMove(Point(2.0, 90.5625)),
PathCurve(Point(4.08203125, 68.16015625), Point(11.28125, 45.28125), Point(24.8828125, 26.40234375)),
PathCurve(Point(17.51953125, 22.87890625), Point(2.0, 14.71875), Point(2.0, 5.12109375)),
Expand Down Expand Up @@ -1298,7 +1298,7 @@ There are various options for `julialogo()` to control coloring and positioning.

The four standard Julia colors are available as RGB tuples as `Luxor.julia_blue`, `Luxor.julia_green`, `Luxor.julia_purple`, `Luxor.julia_red`:

```julia
```julia-repl
julia> Luxor.julia_red
(0.796, 0.235, 0.2)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/howto/tables-grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ Tables don't store data, of course, but are designed to help you draw tabular da

To create a simple table with 3 rows and 4 columns, using the default width and height (100):

```julia
```julia-repl
julia> t = Table(3, 4);
```

When you use this as an iterator, you can get the coordinates of the center of each cell, and its number:

```julia
```julia-repl
julia> for i in t
println("row: $(t.currentrow), column: $(t.currentcol), center: $(i[1])")
end
Expand All @@ -113,7 +113,7 @@ row: 3, column: 4, center: Luxor.Point(150.0, 100.0)

You can also access row and column information:

```julia
```julia-repl
julia> for r in 1:size(t)[1]
for c in 1:size(t)[2]
@show t[r, c]
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ using Luxor

To test:

```julia
```julia-repl
julia> @svg juliacircles()
```

or

```julia
```julia-repl
julia> @png juliacircles()
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorial/basicpath.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ You can use `currentpoint()` to get the current point.

There's another method for `line()` which takes two points and a rendering instruction. For example:

```
```julia
line(Point(0, 0), Point(100, 100), :stroke)
```

is just a quicker way of typing:

```
```julia
move(Point(0, 0))
line(Point(100, 100))
strokepath()
Expand Down
6 changes: 3 additions & 3 deletions docs/src/tutorial/pixels.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ The array `A` should be a matrix where each element is an ARGB32 value. ARGB32 i

You can set and get the values of pixels by treating the drawing's array like a standard Julia array. So we can inspect pixels like this:

```julia
```julia-repl
julia> A[10, 200] # row 10, column 200
ARGB32(0.0N0f8,0.0N0f8,0.0N0f8,0.0N0f8)
```

and set them like this:

```julia
```julia-repl
julia> A[10, 200] = colorant"red"
RGB{N0f8}(1.0, 0.0, 0.0)
```

or even like this:

```julia
```julia-repl
julia> A[200:250, 100:250] .= colorant"green"
julia> A[300:350, 50:450] .= colorant"blue"
julia> [A[rand(1:(400 * 800))] = RGB(rand(), rand(), rand()) for i in 1:800]
Expand Down
2 changes: 1 addition & 1 deletion ext/latex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ rotating around `pt`.
If `paths` is true, text paths are added to the current
path, rather than drawn.
```
```julia
using Luxor
using MathTeXEngine
using LaTeXStrings
Expand Down
4 changes: 2 additions & 2 deletions src/Boxmaptile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ to the original values, scaled as necessary.
The return value is an array of BoxmapTiles. For example:
```
```julia
[BoxmapTile(0.0, 0.0, 10.0, 20.0)
BoxmapTile(10.0, 0.0, 10.0, 13.3333)
BoxmapTile(10.0, 13.3333, 10.0, 6.66667)]
Expand All @@ -117,7 +117,7 @@ BoxmapTiles as well.
# Example
```
```julia
using Luxor
@svg begin
fontsize(16)
Expand Down
2 changes: 1 addition & 1 deletion src/Luxor.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
The Luxor package provides a set of vector drawing functions for creating graphical documents.
```
```julia
@draw begin
circle(Point(0, 0), 100, :stroke)
text("Hello World")
Expand Down
2 changes: 1 addition & 1 deletion src/Path.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A Path object contains, in the `.path` field, a vector of
`PathClose`) that describe a Cairo path. Use `drawpath()` to
draw it.
```
```julia
Path([PathMove(Point(2.0, 90.5625)),
PathCurve(Point(4.08203, 68.16015), Point(11.28, 45.28), Point(24.8828, 26.40234)),
PathLine(Point(2.0, 90.5625)),
Expand Down
Loading

0 comments on commit 80a780b

Please sign in to comment.