本站源代码
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

245 linhas
5.1KB

  1. ################################################################################
  2. ## Comment
  3. # Speak your mind with the hash symbol. They go from the symbol to the end of
  4. # the line.
  5. ################################################################################
  6. ## Table
  7. # Tables (also known as hash tables or dictionaries) are collections of
  8. # key/value pairs. They appear in square brackets on a line by themselves.
  9. [table]
  10. key = "value" # Yeah, you can do this.
  11. # Nested tables are denoted by table names with dots in them. Name your tables
  12. # whatever crap you please, just don't use #, ., [ or ].
  13. [table.subtable]
  14. key = "another value"
  15. # You don't need to specify all the super-tables if you don't want to. TOML
  16. # knows how to do it for you.
  17. # [x] you
  18. # [x.y] don't
  19. # [x.y.z] need these
  20. [x.y.z.w] # for this to work
  21. ################################################################################
  22. ## Inline Table
  23. # Inline tables provide a more compact syntax for expressing tables. They are
  24. # especially useful for grouped data that can otherwise quickly become verbose.
  25. # Inline tables are enclosed in curly braces `{` and `}`. No newlines are
  26. # allowed between the curly braces unless they are valid within a value.
  27. [table.inline]
  28. name = { first = "Tom", last = "Preston-Werner" }
  29. point = { x = 1, y = 2 }
  30. ################################################################################
  31. ## String
  32. # There are four ways to express strings: basic, multi-line basic, literal, and
  33. # multi-line literal. All strings must contain only valid UTF-8 characters.
  34. [string.basic]
  35. basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
  36. [string.multiline]
  37. # The following strings are byte-for-byte equivalent:
  38. key1 = "One\nTwo"
  39. key2 = """One\nTwo"""
  40. key3 = """
  41. One
  42. Two"""
  43. [string.multiline.continued]
  44. # The following strings are byte-for-byte equivalent:
  45. key1 = "The quick brown fox jumps over the lazy dog."
  46. key2 = """
  47. The quick brown \
  48. fox jumps over \
  49. the lazy dog."""
  50. key3 = """\
  51. The quick brown \
  52. fox jumps over \
  53. the lazy dog.\
  54. """
  55. [string.literal]
  56. # What you see is what you get.
  57. winpath = 'C:\Users\nodejs\templates'
  58. winpath2 = '\\ServerX\admin$\system32\'
  59. quoted = 'Tom "Dubs" Preston-Werner'
  60. regex = '<\i\c*\s*>'
  61. [string.literal.multiline]
  62. regex2 = '''I [dw]on't need \d{2} apples'''
  63. lines = '''
  64. The first newline is
  65. trimmed in raw strings.
  66. All other whitespace
  67. is preserved.
  68. '''
  69. ################################################################################
  70. ## Integer
  71. # Integers are whole numbers. Positive numbers may be prefixed with a plus sign.
  72. # Negative numbers are prefixed with a minus sign.
  73. [integer]
  74. key1 = +99
  75. key2 = 42
  76. key3 = 0
  77. key4 = -17
  78. [integer.underscores]
  79. # For large numbers, you may use underscores to enhance readability. Each
  80. # underscore must be surrounded by at least one digit.
  81. key1 = 1_000
  82. key2 = 5_349_221
  83. key3 = 1_2_3_4_5 # valid but inadvisable
  84. ################################################################################
  85. ## Float
  86. # A float consists of an integer part (which may be prefixed with a plus or
  87. # minus sign) followed by a fractional part and/or an exponent part.
  88. [float.fractional]
  89. key1 = +1.0
  90. key2 = 3.1415
  91. key3 = -0.01
  92. [float.exponent]
  93. key1 = 5e+22
  94. key2 = 1e6
  95. key3 = -2E-2
  96. [float.both]
  97. key = 6.626e-34
  98. [float.underscores]
  99. key1 = 9_224_617.445_991_228_313
  100. key2 = 1e1_00
  101. ################################################################################
  102. ## Boolean
  103. # Booleans are just the tokens you're used to. Always lowercase.
  104. [boolean]
  105. True = true
  106. False = false
  107. ################################################################################
  108. ## Datetime
  109. # Datetimes are RFC 3339 dates.
  110. [datetime]
  111. key1 = 1979-05-27T07:32:00Z
  112. key2 = 1979-05-27T00:32:00-07:00
  113. key3 = 1979-05-27T00:32:00.999999-07:00
  114. ################################################################################
  115. ## Array
  116. # Arrays are square brackets with other primitives inside. Whitespace is
  117. # ignored. Elements are separated by commas. Data types may not be mixed.
  118. [array]
  119. key1 = [ 1, 2, 3 ]
  120. key2 = [ "red", "yellow", "green" ]
  121. key3 = [ [ 1, 2 ], [3, 4, 5] ]
  122. #key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok
  123. # Arrays can also be multiline. So in addition to ignoring whitespace, arrays
  124. # also ignore newlines between the brackets. Terminating commas are ok before
  125. # the closing bracket.
  126. key5 = [
  127. 1, 2, 3
  128. ]
  129. key6 = [
  130. 1,
  131. 2, # this is ok
  132. ]
  133. ################################################################################
  134. ## Array of Tables
  135. # These can be expressed by using a table name in double brackets. Each table
  136. # with the same double bracketed name will be an element in the array. The
  137. # tables are inserted in the order encountered.
  138. [[products]]
  139. name = "Hammer"
  140. sku = 738594937
  141. [[products]]
  142. [[products]]
  143. name = "Nail"
  144. sku = 284758393
  145. color = "gray"
  146. # You can create nested arrays of tables as well.
  147. [[fruit]]
  148. name = "apple"
  149. [fruit.physical]
  150. color = "red"
  151. shape = "round"
  152. [[fruit.variety]]
  153. name = "red delicious"
  154. [[fruit.variety]]
  155. name = "granny smith"
  156. [[fruit]]
  157. name = "banana"
  158. [[fruit.variety]]
  159. name = "plantain"
上海开阖软件有限公司 沪ICP备12045867号-1