aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/text/escape.lux
blob: af4c640603aa7b8eecc562effebc1bab56c0a627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(.using
 [library
  [lux (.full)
   ["$" documentation (.only documentation:)]
   [data
    [text (.only \n)
     ["%" format (.only format)]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]])

(documentation: /.escaped
  "Yields a escaped version of the text."
  [(escaped text)])

(documentation: /.un_escaped
  (format "Yields an un-escaped text."
          \n "Fails if it was improperly escaped.")
  [(un_escaped text)])

(documentation: /.literal
  "If given a escaped text literal, expands to an un-escaped version."
  [(/.literal "Line 1\nLine 2")
   "=>"
   (format "Line 1" \n
           "Line 2")])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..escaped
             ..un_escaped
             ..literal
             ($.default /.escapable?)
             ($.default /.dangling_escape)
             ($.default /.invalid_escape)
             ($.default /.invalid_unicode_escape)]
            []))