|
1 | 1 | # clj-toml
|
2 | 2 |
|
3 |
| -clj-toml is [TOML](https://github.com/vmfhrmfoaj/clj-toml) for Clojure. TOML is Tom's Obvious, Minimal Language. |
| 3 | +`clj-toml` is [TOML](https://toml.io) for Clojure. |
| 4 | +TOML is Tom's Obvious, Minimal Language. |
4 | 5 |
|
5 | 6 | > TOML is like INI, only better (Tom Preston-Werner)
|
6 | 7 |
|
7 |
| -clj-toml uses [Instaparse](https://github.com/Engelberg/instaparse) for parsing. |
| 8 | +`clj-toml` uses [Instaparse](https://github.com/Engelberg/instaparse) for parsing. |
8 | 9 | Instaparse does all the heavy lifting, we're just sitting pretty.
|
9 |
| -Currently clj-toml support TOML [v1.0.0](https://toml.io/en/v1.0.0). |
| 10 | +`clj-toml` support TOML [v1.0.0](https://toml.io/en/v1.0.0). |
| 11 | + |
10 | 12 |
|
11 | 13 | ## Usage
|
12 | 14 |
|
13 |
| -Work is underway towards a TOML 0.4.0-compliant release. Use the 0.3.1 release (TOML 0.1.0-compliant) in the meantime: |
14 |
| - |
15 |
| -Leiningen: |
16 |
| - ```clojure |
17 |
| - [clj-toml "1.0.0"] |
18 |
| - ``` |
19 |
| - |
20 |
| -Test: |
21 |
| - ```clojure |
22 |
| - lein test |
23 |
| - ``` |
24 |
| - |
25 |
| -Use: |
26 |
| - ```clojure |
27 |
| - (use 'clj-toml.core) |
28 |
| - |
29 |
| - (parse-toml " |
30 |
| - title = \"TOML\" |
31 |
| - [Foo] |
32 |
| - bar=[1,2,3]") |
33 |
| - ;; {"title" "TOML" "foo" {"bar" [1 2 3]}} |
34 |
| - |
35 |
| - (meta (parse-toml " |
36 |
| - title = \"TOML\" |
37 |
| - [Foo] |
38 |
| - bar=[1,2,3]")) |
39 |
| - ;; {...} |
40 |
| - ``` |
| 15 | +Currently `clj-toml` v1.0.0 has not been released yet. |
| 16 | +You can install `clj-toml` locally by using `lein install` command. |
| 17 | + |
| 18 | +```clojure |
| 19 | +#_user> (use 'clj-toml.core) |
| 20 | +;;=> nil |
| 21 | + |
| 22 | +#_user> (def example " |
| 23 | +title = \"TOML\"\n |
| 24 | +[Foo]\n |
| 25 | +bar=[1,2,3]") |
| 26 | + |
| 27 | +#_user> (parse-toml example) |
| 28 | +;;=> {"title" "TOML", "Foo" {"bar" [1 2 3]}} |
| 29 | + |
| 30 | +#_user> (meta (parse-toml example)) |
| 31 | +;;=> {"title" #:clj-toml.core{:start 1, :end 15}, |
| 32 | +;; "Foo" {:clj-toml.core/start 17, |
| 33 | +;; :clj-toml.core/end 22, |
| 34 | +;; "bar" #:clj-toml.core{:start 24, :end 35}}} |
| 35 | + |
| 36 | +#_user> (subs example 1 15) |
| 37 | +;;=> "title = \"TOML\"" |
| 38 | + |
| 39 | +#_user> (subs example 17 22) |
| 40 | +;;=> "[Foo]" |
| 41 | +``` |
| 42 | + |
| 43 | + |
| 44 | +### Version |
| 45 | + |
| 46 | +``` |
| 47 | +x.x.x-z.z < patch number |
| 48 | +^^^^^ |
| 49 | +TOML version |
| 50 | +``` |
| 51 | + |
41 | 52 |
|
42 | 53 | ## License
|
43 | 54 |
|
|
0 commit comments