Skip to content

Commit 3c6b753

Browse files
author
Yannick Scherer
committed
Release 0.2.0
1 parent 26d0ff5 commit 3c6b753

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- `of-string`, `of-file`
1212
- `print`, `print-root`
1313
- `->string`, `->root-string`
14+
- `append-space`, `prepend-space`
1415
- `append-newline`, `prepend-newline`
1516
- `right*`, `left*`, ... (delegating to `fast-zip.core/right`, ...)
1617
- new token type `:forms`

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ __This project is in flux. Anything may change at any time.__
1919
__Leiningen ([via Clojars](http://clojars.org/rewrite-clj))__
2020

2121
```clojure
22-
[rewrite-clj "0.1.0"]
22+
[rewrite-clj "0.2.0"]
2323
```
2424

2525
__Parsing Data__
@@ -62,7 +62,7 @@ operations, based on [fast-zip](https://github.com/akhudek/fast-zip).
6262
"(defn my-function [a]
6363
;; a comment
6464
(* a 3))")
65-
(def data (z/edn (p/parse-string data-string)))
65+
(def data (z/of-string data-string))
6666

6767
(z/sexpr data) ;; => (defn my-function [a] (* a 3))
6868
(-> data z/down z/right z/node) ;; => [:token my-function]
@@ -71,7 +71,7 @@ operations, based on [fast-zip](https://github.com/akhudek/fast-zip).
7171
(-> data z/down z/right (z/edit (comp symbol str) "2") z/up z/sexpr)
7272
;; => (defn my-function2 [a] (* a 3))
7373

74-
(-> data z/down z/right (z/edit (comp symbol str) "2") z/root prn/print-edn)
74+
(-> data z/down z/right (z/edit (comp symbol str) "2") z/print-root)
7575
;; (defn my-function2 [a]
7676
;; ;; a comment
7777
;; (* a 3))
@@ -102,7 +102,7 @@ use `rewrite-clj.zip/next`, if you wanted to look for something on the same leve
102102
Now, to enter the project map, you'd look for the symbol `defproject` in a depth-first way:
103103

104104
```clojure
105-
(def data (z/edn (p/parse-file "project.clj")))
105+
(def data (z/of-file "project.clj"))
106106
(def prj-map (z/find-value data z/next 'defproject))
107107
```
108108

@@ -116,7 +116,7 @@ The `:description` keyword should be on the same layer, the corresponding string
116116
Replace it, zip up and print the result:
117117

118118
```clojure
119-
(-> descr (z/replace "My first Project.") z/root prn/print-edn)
119+
(-> descr (z/replace "My first Project.") z/print-root)
120120
;; (defproject my-project "0.1.0-SNAPSHOT"
121121
;; :description "My first Project."
122122
;; ...)
@@ -144,14 +144,14 @@ rewrite-clj aims at providing easy ways to work with Clojure data structures. It
144144
to the standard seq functions designed to work with zipper nodes containing said structures, e.g.:
145145

146146
```clojure
147-
(def data (z/edn (p/parse-string "[1\n2\n3]")))
147+
(def data (z/of-string "[1\n2\n3]"))
148148

149149
(z/vector? data) ;; => true
150150
(z/sexpr data) ;; => [1 2 3]
151151
(-> data (z/get 1) z/node) ;; => [:token 2]
152152
(-> data (z/assoc 1 5) z/sexpr) ;; => [1 5 3]
153153

154-
(with-out-str (->> data (z/map #(z/edit % + 4)) z/node prn/print-edn))
154+
(->> data (z/map #(z/edit % + 4)) z/->root-string)
155155
;; => "[5\n6\n7]"
156156
```
157157

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject rewrite-clj "0.2.0-SNAPSHOT"
1+
(defproject rewrite-clj "0.2.0"
22
:description "Comment-/Whitespace-preserving rewriting of EDN documents."
33
:url "https://github.com/xsc/rewrite-clj"
44
:license {:name "Eclipse Public License"

0 commit comments

Comments
 (0)