Skip to content

Commit 8d1f41f

Browse files
committed
Add support for top-level SVG attributes, fixes #26
It turns out I had a pretty good idea how to do this cleanly, so I went ahead and implemented a solution.
1 parent 7a95498 commit 8d1f41f

File tree

8 files changed

+4120
-52
lines changed

8 files changed

+4120
-52
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ This change log follows the conventions of
88

99
Nothing so far.
1010

11+
## [1.6.0] - 2021-09-08
12+
13+
### Added
14+
15+
- A new predefined value, `svg-attrs`, which starts out as an empty
16+
map, but can be redefined to add arbitrary SVG attributes to the
17+
top-level SVG node of your diagram (for example, to set a background
18+
color for the entire diagram).
19+
1120
## [1.5.0] - 2020-07-12
1221

1322
### Added

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ extension.)
139139

140140
To check for outdated dependencies, you can run:
141141

142-
clojure -A:outdated
142+
clojure -M:outdated
143143

144144
## Releasing
145145

@@ -155,7 +155,7 @@ version in `package.json`, tag and push to GitHub, then run:
155155
<a href="http://deepsymmetry.org"><img align="right" alt="Deep Symmetry"
156156
src="doc/assets/DS-logo-bw-200-padded-left.png" width="216" height="123"></a>
157157

158-
Copyright © 2020 [Deep Symmetry, LLC](http://deepsymmetry.org)
158+
Copyright © 2020–2021 [Deep Symmetry, LLC](http://deepsymmetry.org)
159159

160160
Distributed under the [Eclipse Public License
161161
2.0](https://opensource.org/licenses/EPL-2.0). By using this software

deps.edn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
;; Clojure dependency information and source location.
2-
{:deps {thheller/shadow-cljs {:mvn/version "2.8.93"}
3-
org.clojure/tools.reader {:mvn/version "1.3.2"}
4-
analemma {:mvn/version "1.1.0"}
2+
{:deps {thheller/shadow-cljs {:mvn/version "2.15.9"}
3+
org.clojure/tools.reader {:mvn/version "1.3.6"}
4+
analemma/analemma {:mvn/version "1.1.0"}
55
borkdude/sci {:git/url "https://github.com/borkdude/sci.git"
66
:sha "26944ee9e1349fecd113ac6075bd66306ce3a6f8"}}
77
;; When sci is released with the shadow-cljs fix, {:mvn/version "0.0.13-alpha.13"} ?

doc/antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ asciidoc:
77
attributes:
88
icons: font
99
experimental: ''
10-
page-copyright: 2020
10+
page-copyright: 2020–2021
1111
page-pagination: ''
1212
nav:
1313
- modules/ROOT/nav.adoc

doc/modules/ROOT/pages/values.adoc

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ number).
1818
|===
1919
|Variable |Default Value |Purpose
2020

21-
|left-margin |40 | How far from the left edge of the diagram the first
21+
|left-margin |40 |How far from the left edge of the diagram the first
2222
box begins. This default is large enough to accommodate the row
2323
address labels for all but extremely long byte fields. If you are
2424
drawing a single row (which won’t have a row label), it’s nice to set
2525
this to `1` so the diagram is centered.
2626

27-
|right-margin |1 | How far from the right edge of the diagram the last
27+
|right-margin |1 |How far from the right edge of the diagram the last
2828
box ends. This default is just large enough to make sure the box
2929
boundary doesn’t get clipped. You can make it bigger if you want to
3030
draw custom content there.
3131

32-
|bottom-margin |1 | How far from the bottom edge of the diagram the
32+
|bottom-margin |1 |How far from the bottom edge of the diagram the
3333
last row of boxes ends. This default is just large enough to make
3434
sure the box boundaries don’t get clipped. You can make it bigger if
3535
you want to draw custom content there.
3636

3737
| | |
3838

39-
|box-width |40 | How much horizontal space each box takes up.
39+
|box-width |40 |How much horizontal space each box takes up.
4040

4141
|boxes-per-row |16 |How many boxes are drawn on a row before moving to
4242
the next row. The default is 16, so that the hexadecimal row labels
@@ -51,7 +51,15 @@ number).
5151
the `:labels` attribute when calling
5252
<<funcs.adoc#draw-column-headers,`draw-column-headers`>>.
5353

54-
|row-height |30 | How much vertical space a row of boxes takes up.
54+
|row-height |30 |How much vertical space a row of boxes takes up.
55+
56+
|svg-attrs |{} |A map that can contain arbitrary
57+
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute[SVG
58+
attributes] to be added to the top-level SVG element in the diagram.
59+
For example, if you want the entire diagram to have a solid white
60+
background color rather than its transparent default, you could:
61+
62+
`(def svg-attrs {:style "background-color:white"})`
5563

5664
| | |
5765

0 commit comments

Comments
 (0)