Liking cljdoc? Tell your friends :D
Clojure only.

clj-format.parser

Parses cl-format format strings into the clj-format s-expression DSL.

Follows the Hiccup convention: [:keyword optional-map & children]. Bare keywords represent no-opts directives. Strings are literal text.

Examples: (parse-format "~A") ;=> [:str] (parse-format "Hello ~A!") ;=> ["Hello " :str "!"] (parse-format "~{~A~^, ~}") ;=> [[:each {:sep ", "} :str]] (parse-format "~:[no~;yes~]") ;=> [[:if "yes" "no"]] (parse-format "~:(~A~)") ;=> [[:str {:case :capitalize}]]

Parses cl-format format strings into the clj-format s-expression DSL.

Follows the Hiccup convention: [:keyword optional-map & children].
Bare keywords represent no-opts directives. Strings are literal text.

Examples:
  (parse-format "~A")             ;=> [:str]
  (parse-format "Hello ~A!")      ;=> ["Hello " :str "!"]
  (parse-format "~{~A~^, ~}")    ;=> [[:each {:sep ", "} :str]]
  (parse-format "~:[no~;yes~]")  ;=> [[:if "yes" "no"]]
  (parse-format "~:(~A~)")       ;=> [[:str {:case :capitalize}]]
raw docstring

parse-formatclj

(parse-format s)

Parse a cl-format format string into the clj-format s-expression DSL.

Returns a vector of elements: literal strings, bare keywords (simple directives), and vectors (directives with opts or compound directives). Follows the Hiccup convention: [:keyword optional-map & children].

Examples: (parse-format "~A") ;=> [:str] (parse-format "Hello ~A!") ;=> ["Hello " :str "!"] (parse-format "~R file~:P") ;=> [:cardinal " file" [:plural {:rewind true}]] (parse-format "~10:D") ;=> [[:int {:width 10 :group true}]] (parse-format "~{~A~^, ~}") ;=> [[:each {:sep ", "} :str]] (parse-format "~:[no~;yes~]") ;=> [[:if "yes" "no"]] (parse-format "~:(~A~)") ;=> [[:str {:case :capitalize}]]

Parse a cl-format format string into the clj-format s-expression DSL.

Returns a vector of elements: literal strings, bare keywords (simple
directives), and vectors (directives with opts or compound directives).
Follows the Hiccup convention: [:keyword optional-map & children].

Examples:
  (parse-format "~A")             ;=> [:str]
  (parse-format "Hello ~A!")      ;=> ["Hello " :str "!"]
  (parse-format "~R file~:P")     ;=> [:cardinal " file" [:plural {:rewind true}]]
  (parse-format "~10:D")          ;=> [[:int {:width 10 :group true}]]
  (parse-format "~{~A~^, ~}")    ;=> [[:each {:sep ", "} :str]]
  (parse-format "~:[no~;yes~]")  ;=> [[:if "yes" "no"]]
  (parse-format "~:(~A~)")       ;=> [[:str {:case :capitalize}]]
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close