Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Folder full of pertinent coursework

1666 views
1
# Example borrowed from: http://learnxinyminutes.com/docs/yaml/
2
#
3
# YAML is a data serialisation language designed to be directly writable and readable by humans.
4
# It’s a strict superset of JSON, with the addition of syntactically significant newlines and indentation (like Python).
5
# YAML does not allow literal tab characters.
6
7
# Comments in YAML look like this.
8
9
################
10
# SCALAR TYPES #
11
################
12
13
# Our root object (which continues for the entire document) will be a map,
14
# which is equivalent to a dictionary, hash or object in other languages.
15
key: value
16
another_key: Another value goes here.
17
a_number_value: 100
18
scientific_notation: 1e+12
19
boolean: true
20
null_value: null
21
key with spaces: value
22
# Notice that strings don't need to be quoted. However, they can be.
23
however: "A string, enclosed in quotes."
24
"Keys can be quoted too.": "Useful if you want to put a ':' in your key."
25
26
# Multiple-line strings can be written either as a 'literal block' (using |),
27
# or a 'folded block' (using '>').
28
literal_block: |
29
This entire block of text will be the value of the 'literal_block' key,
30
with line breaks being preserved.
31
32
The literal continues until de-dented, and the leading indentation is
33
stripped.
34
35
Any lines that are 'more-indented' keep the rest of their indentation -
36
these lines will be indented by 4 spaces.
37
folded_style: >
38
This entire block of text will be the value of 'folded_style', but this
39
time, all newlines will be replaced with a single space.
40
41
Blank lines, like above, are converted to a newline character.
42
43
'More-indented' lines keep their newlines, too -
44
this text will appear over two lines.
45
46
####################
47
# COLLECTION TYPES #
48
####################
49
50
# Nesting is achieved by indentation.
51
a_nested_map:
52
key: value
53
another_key: Another Value
54
another_nested_map:
55
hello: hello
56
57
# Maps don't have to have string keys.
58
0.25: a float key
59
60
# Keys can also be multi-line objects, using ? to indicate the start of a key.
61
? |
62
This is a key
63
that has multiple lines
64
: and this is its value
65
66
# YAML also allows collection types in keys, but many programming languages
67
# will complain.
68
69
# Sequences (equivalent to lists or arrays) look like this:
70
a_sequence:
71
- Item 1
72
- Item 2
73
- 0.5 # sequences can contain disparate types.
74
- Item 4
75
- key: value
76
another_key: another_value
77
-
78
- This is a sequence
79
- inside another sequence
80
81
# Since YAML is a superset of JSON, you can also write JSON-style maps and
82
# sequences:
83
json_map: {"key": "value"}
84
json_seq: [3, 2, 1, "takeoff"]
85
86
#######################
87
# EXTRA YAML FEATURES #
88
#######################
89
90
# YAML also has a handy feature called 'anchors', which let you easily duplicate
91
# content across your document. Both of these keys will have the same value:
92
anchored_content: &anchor_name This string will appear as the value of two keys.
93
other_anchor: *anchor_name
94
95
# YAML also has tags, which you can use to explicitly declare types.
96
explicit_string: !!str 0.5
97
# Some parsers implement language specific tags, like this one for Python's
98
# complex number type.
99
python_complex_number: !!python/complex 1+2j
100
101
####################
102
# EXTRA YAML TYPES #
103
####################
104
105
# Strings and numbers aren't the only scalars that YAML can understand.
106
# ISO-formatted date and datetime literals are also parsed.
107
datetime: 2001-12-15T02:59:43.1Z
108
datetime_with_spaces: 2001-12-14 21:59:43.10 -5
109
date: 2002-12-14
110
111
# The !!binary tag indicates that a string is actually a base64-encoded
112
# representation of a binary blob.
113
gif_file: !!binary |
114
R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
115
OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
116
+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
117
AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
118
119
# YAML also has a set type, which looks like this:
120
set:
121
? item1
122
? item2
123
? item3
124
125
# Like Python, sets are just maps with null values; the above is equivalent to:
126
set2:
127
item1: null
128
item2: null
129
item3: null
130
131