aboutsummaryrefslogtreecommitdiff
path: root/test/command/yaml-metadata-blocks.md
blob: d92994b03773d0e047fe60a423e7b6d57cb13b25 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
```
% pandoc -s -t native
---
foobar_: this should be ignored
foo:
  bar_: as should this
---
^D
Pandoc
  Meta
    { unMeta = fromList [ ( "foo" , MetaMap (fromList []) ) ] }
  []
```
```
% pandoc -s -t native
---
# For precedence, see multiple-metadata-blocks.md and vars-and-metadata.md
# For Bools, see also 4819.md
# For Multiline strings, see yaml-with-chomp.md
int: 7
float: 1.5
scientific: 3.7e-5
bool: true
more: False
nothing: null
empty: []
nested:
  int: 8
  float: 2.5
  bool: true
  more: False
  nothing: null
  empty: []
  scientific: 3.7e-5
---
^D
Pandoc
  Meta
    { unMeta =
        fromList
          [ ( "bool" , MetaBool True )
          , ( "empty" , MetaList [] )
          , ( "float" , MetaInlines [ Str "1.5" ] )
          , ( "int" , MetaInlines [ Str "7" ] )
          , ( "more" , MetaBool False )
          , ( "nested"
            , MetaMap
                (fromList
                   [ ( "bool" , MetaBool True )
                   , ( "empty" , MetaList [] )
                   , ( "float" , MetaInlines [ Str "2.5" ] )
                   , ( "int" , MetaInlines [ Str "8" ] )
                   , ( "more" , MetaBool False )
                   , ( "nothing" , MetaString "" )
                   , ( "scientific" , MetaInlines [ Str "3.7e-5" ] )
                   ])
            )
          , ( "nothing" , MetaString "" )
          , ( "scientific" , MetaInlines [ Str "3.7e-5" ] )
          ]
    }
  []
```
```
% pandoc -s -t native
---
array:
  - foo: bar
  - bool: True
---
^D
Pandoc
  Meta
    { unMeta =
        fromList
          [ ( "array"
            , MetaList
                [ MetaMap
                    (fromList [ ( "foo" , MetaInlines [ Str "bar" ] ) ])
                , MetaMap (fromList [ ( "bool" , MetaBool True ) ])
                ]
            )
          ]
    }
  []
```
```
% pandoc -s -t native --metadata-file command/yaml-metadata.yaml
---
title: document
---
^D
Pandoc
  Meta
    { unMeta =
        fromList
          [ ( "other"
            , MetaInlines
                [ Emph [ Str "markdown" ] , Space , Str "value" ]
            )
          , ( "title" , MetaInlines [ Str "document" ] )
          ]
    }
  []
```
```
% pandoc -s -t native --metadata-file command/yaml-metadata.yaml -M title=cmdline
^D
Pandoc
  Meta
    { unMeta =
        fromList
          [ ( "other"
            , MetaInlines
                [ Emph [ Str "markdown" ] , Space , Str "value" ]
            )
          , ( "title" , MetaString "cmdline" )
          ]
    }
  []
```