Skip to content

Commit 30d9d8e

Browse files
committed
Bump to v1.1.0 with better trees
1 parent 3045b5b commit 30d9d8e

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
## [1.1.0] - 2019-05-28
4+
### Added
5+
- More flexible tree rendering/aggregation
6+
7+
### Changed
8+
- Replaced lots of redundant tree code with a `walk` function
9+
310
## [1.0.0] - 2019-04-17
411
### Added
512
- PDF generation

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ common sense styling.
88

99
Lein:
1010
```
11-
[org.clojars.mjdowney/excel-clj "1.0.0"]
11+
[org.clojars.mjdowney/excel-clj "1.1.0"]
1212
```
1313

1414
- [Getting Started](#getting-started)
@@ -92,6 +92,30 @@ the balances corresponding to an account hierarchy.
9292

9393
![An excel sheet is opened](resources/quick-open-tree.png)
9494

95+
Trees are pretty flexible — the only requirement that we impose is that their
96+
leaves have the format `[string-label, map-of-numbers]`. We construct trees
97+
using the same arguments we'd give to `clojure.core/tree-seq`, plus a walk
98+
function.
99+
100+
We could make a tree for some part of our file system for example:
101+
102+
```clojure
103+
(require '[excel-clj.tree :as tree] '[clojure.java.io :as io])
104+
=> nil
105+
106+
(let [src-tree
107+
(tree/walk
108+
(fn [f xs]
109+
(if-not (seq xs)
110+
[(.getName f) {:size (.length f)}]
111+
[(str (.getName f) "/") xs]))
112+
#(.isDirectory %) #(.listFiles %) (io/file "."))]
113+
(excel/quick-open
114+
{"Source Tree" (excel/tree ["Source" [src-tree]] :data-format :number)}))
115+
```
116+
117+
![An excel sheet is opened](resources/file-tree.png)
118+
95119

96120
### PDF Generation
97121

@@ -188,11 +212,6 @@ that includes optional style data / cell merging instructions.
188212
![A spreadsheet with a merged title](resources/manual-grid.png)
189213

190214
## Roadmap
191-
- Tree flexibility. [tree.clj](src/excel_clj/tree.clj) should be able to work
192-
with any data shape given the same functions as [`clojure.core/tree-seq`](https://clojuredocs.org/clojure.core/tree-seq).
193-
Additionally, it should provide hooks for custom ways to aggregate columns
194-
(instead of expecting `Number` data and summing it) and whether or not to display
195-
sub-category level totals vs just grand totals.
196215

197216
- Templates! There's no reason to do all of the styling work programmatically.
198217
We should be able to download [some cool Google Sheets template](https://docs.google.com/spreadsheets/u/0/?usp=mkt_sheets_tpl)
@@ -225,7 +244,7 @@ that includes optional style data / cell merging instructions.
225244

226245
![Filled in template draft](resources/filled-template-draft.png)
227246

228-
- Reading & editing existing spradsheets. This should go hand in hand with
247+
- Reading & editing existing spreadsheets. This should go hand in hand with
229248
template generation.
230249

231250
- Formulas! We don't have them. I'm envisioning a syntax where a table column

resources/file-tree.png

144 KB
Loading

0 commit comments

Comments
 (0)