... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\injection]]
    [collection
     ["[0]" list]]]]]
 [\\library
  ["[0]" /]])

(the .public documentation
  (List $.Documentation)
  (list ($.module /._
                  "Utilities commonly used while templating.")

        ($.definition /.irregular_arguments)

        ($.definition /.spliced
          ""
          ($.example (' (spliced [a b c d])))
          ($.comment "=>")
          ($.example (' a))
          ($.example (' b))
          ($.example (' c))
          ($.example (' d)))

        ($.definition /.amount
          ""
          ($.example (' (amount [a b c d])))
          ($.comment "=>")
          ($.example (' 4)))

        ($.definition /.with_locals
          "Creates names for local bindings aliased by the names you choose."
          ($.example (' (with_locals [my_var]
                          (let [my_var 123]
                            (text [my_var])))))
          ($.comment "=>")
          ($.example (' "__gensym__my_var506")))

        ($.definition /.text
          "A text literal made by concatenating pieces of code."
          ($.example (' (text [#0 123 +456 +789.0 "abc" .def ..ghi])))
          ($.comment "=>")
          ($.example (' "#0123+456+789.0abcdefghi")))

        ($.definition /.symbol
          (%.message "An symbol made by concatenating pieces of code."
                     \n "The (optional) module part and the short part are specified independently.")
          ($.example (' (symbol ["abc" .def ..ghi])))
          ($.comment "=>")
          ($.example (' abcdefghi))
          
          ($.example (' (symbol [.def] ["abc" .def ..ghi])))
          ($.comment "=>")
          ($.example (' .abcdefghi)))

        ($.definition /.let
          "Lexically-bound templates."
          ($.example (' (let [(!square <root>)
                              [(* <root> <root>)]]
                          (the (square root)
                            (-> Natural Natural)
                            (!square root))))))
        ))
