aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/text/escape.lux
blob: 02739600382cb9e96a813eb32068de811ab1835e (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
(.module:
  [library
   [lux "*"
    ["$" documentation {"+" [documentation:]}]
    [data
     [text {"+" [\n]}
      ["%" format {"+" [format]}]]]
    [macro
     ["." template]]]]
  [\\library
   ["." /]])

(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)]
            []))