[formatter] implement 'M' format specifier
Map a list of objects to a list of values
[
{"name": "John Doe" , "age": 42},
{"name": "Jane Smith" , "age": 24},
{"name": "Max Mustermann", "age": null}
]
== :Mname =>
["John Doe", "Jane Smith", "Max Mustermann"]
This commit is contained in:
@@ -266,6 +266,12 @@ Format specifiers can be used for advanced formatting by using the options provi
|
||||
<td><code>{tags:J - /}</code></td>
|
||||
<td><code>sun - tree - water</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>M<key>/</code></td>
|
||||
<td>Maps a list of objects to a list of corresponding values by looking up <code><key></code> in each object</td>
|
||||
<td><code>{users:Mname/}</code></td>
|
||||
<td><code>["John", "David", "Max"]</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>R<old>/<new>/</code></td>
|
||||
<td>Replaces all occurrences of <code><old></code> with <code><new></code> using <a href="https://docs.python.org/3/library/stdtypes.html#str.replace" rel="nofollow"><code>str.replace()</code></a></td>
|
||||
|
||||
Reference in New Issue
Block a user