-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no 'struct per func' needed (i.e. close #61). I tried that but not good. Cause: the docstring of the options was intertwined with the function. So annoying to separate. solved keyword distr problem with a `select(kw, f)`, using `Base.kwarg_decl(only(methods(f)))` So like this is good. enduser func docstrs should now refer to the eventual funcs docstrs, and not Settings header. i.e. delete that header (it's duplicate non DRY info)
- Loading branch information
Showing
13 changed files
with
117 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,12 +33,6 @@ url | |
webapps | ||
``` | ||
|
||
## Settings object | ||
|
||
```@docs | ||
Options | ||
``` | ||
|
||
## Graphs.jl conversion | ||
|
||
```@docs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
```julia | ||
to_dot_str( | ||
edges; | ||
mode = :light, | ||
bg = "transparent", | ||
style = default_style(), | ||
indent = 4, | ||
emptymsg = nothing, | ||
) | ||
``` | ||
|
||
Build a string that represents the given directed graph in the | ||
[Graphviz DOT format ↗](https://graphviz.org/doc/info/lang.html). | ||
|
||
## Keyword arguments | ||
|
||
### `mode` | ||
Either `:light` (default) or `:dark`.\ | ||
Whether to use black lines and black text on a white background, or vice | ||
versa.\ | ||
Note that locally-generated SVGs get both colour-schemes simultaneously, | ||
so this option is irrelevant for them. | ||
|
||
### `bg` | ||
Background colour for the image.\ | ||
Default is `"transparent"`.\ | ||
`"white"` (in combination with `mode = :light`) might be a sensible | ||
value when you are creating a PNG but do not know on what background it | ||
will be seen. (A light-mode PNG with transparent background looks bad on | ||
a dark background). | ||
|
||
### `style` | ||
A list of strings, inserted as lines in the output (after the lines | ||
generated for `mode` and `bg`, and just before the graph edge lines). To | ||
use Graphviz's default style, pass `style = []`. For the default see | ||
[`default_style`](@ref). For more on how dot-graphs can be styled, see | ||
[Styling Graphviz output](@ref). | ||
|
||
### `indent` | ||
The number of spaces to indent each line in the "`digraph`" block with. | ||
|
||
### `emtpymsg` | ||
If there are no `edges`, a single node with `emptymsg` is created. If | ||
`emptymsg` is `nothing` (default), no nodes are created, and the image | ||
rendered from the DOT-string will be empty. | ||
|
||
## Example: | ||
|
||
```jldoctest | ||
julia> edges = [:A => :B, "yes" => "no"]; | ||
julia> style = ["node [color=\"red\"]"]; | ||
julia> using PkgGraph | ||
julia> PkgGraph.to_dot_str(edges; style, bg=:blue, indent=2) |> println | ||
digraph { | ||
bgcolor = "blue" | ||
node [fillcolor="white", fontcolor="black", color="black"] | ||
edge [color="black"] | ||
node [color="red"] | ||
A -> B | ||
yes -> no | ||
} | ||
julia> emptymsg="(empty graph)"; | ||
julia> PkgGraph.to_dot_str([]; emptymsg, mode=:dark, style=[]) |> println | ||
digraph { | ||
bgcolor = "transparent" | ||
node [fillcolor="black", fontcolor="white", color="white"] | ||
edge [color="white"] | ||
onlynode [label=" (empty graph) ", shape="plaintext"] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters