Skip to content

Commit

Permalink
Support applying options to multiple examples as
Browse files Browse the repository at this point in the history
suggested in #640

Signed-off-by: Hanson Char <[email protected]>
  • Loading branch information
hansonchar committed Jun 10, 2024
1 parent 12f1783 commit 3994ad2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
*.zip

build/*
tex/generic/pgf/pgf.revision.tex
4 changes: 4 additions & 0 deletions doc/generic/pgf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added

- Add `RGB` and `gray` color model support for ConTeXt #1130
- Support an apply-all feature (suggested in issue #640) to
apply a single definition of options to multiple examples.

### Fixed

Expand All @@ -27,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Resolve overfull hboxes >=20pt in the manual
- Adapt `\graphicspath` setting for flattened doc tree #1191
- Promote warning "Plot data file \`...' not found" to error
- Ignore file `tex/generic/pgf/pgf.revision.tex` in git

### Contributors

Expand All @@ -40,6 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Yukai Chou (@muzimuzhi)
- Alexander Grahn
- Max Chernoff
- Hanson Char

## [3.1.10] - 2023-01-13 Henri Menke

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ declare {
type = "number",
initial = 1,

summary = [["
summary = [[
Defines the electric charge of the node. The stronger the
|electric charge| of a node the stronger the repulsion between the
node and others in the graph. A negative |electric charge| means that
Expand All @@ -38,24 +38,24 @@ declare {
|spring electrical layout| algorithm works.
Two typical effects of increasing the |electric charge| are distortion
of symmetries and an upscaling of the drawings.
"]],
]],
examples = {
options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}} ]],
{
options = [["preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}}"]],
code = [["
code = [[
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ 0 [electric charge=1] -- subgraph C_n [n=10] };
"]]
]]
},{
code = [["
code = [[
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ 0 [electric charge=5] -- subgraph C_n [n=10] };
"]]
]]
},{
code = [["
code = [[
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ [clique] 1 [electric charge=5], 2, 3, 4 };
"]]
]]
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions tex/generic/pgf/lua/pgf/manual/DocumentParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,17 @@ local function process_examples(t)

local n = {}
for i=1,#t do
local code, options
local code
local options = t.options
if type(t[i]) == "table" then
code = assert(t[i].code)
options = t[i].options
if options then
if t[i].options then
options = options .. t[i].options
end
else
options = t[i].options
end
else
code = t[i]
end
Expand Down

0 comments on commit 3994ad2

Please sign in to comment.