[formatter] add 'Xb' format specifier - 'X' for bytes (#6582)

https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3479362186
This commit is contained in:
Mike Fährmann
2025-11-03 12:35:47 +01:00
parent 0ecc1b6ead
commit 91a5fd85db
3 changed files with 42 additions and 8 deletions

View File

@@ -303,6 +303,16 @@ Format specifiers can be used for advanced formatting by using the options provi
<td><code>{foo:X6/&nbsp;.../}</code></td>
<td><code>Fo&nbsp;...</code></td>
</tr>
<tr>
<td rowspan="2"><code>Xb&lt;maxlen&gt;/&lt;ext&gt;/</code></td>
<td rowspan="2">Same as <code>X</code>, but applies to the <a href="https://docs.python.org/3/library/stdtypes.html#bytes"><code>bytes()</code></a> representation of a string in <a href="https://docs.python.org/3/library/sys.html#sys.getfilesystemencoding">filesystem encoding</a></td>
<td><code>{foo_ja:Xb15/〜/}</code></td>
<td><code>フー・バー</code></td>
</tr>
<tr>
<td><code>{foo_ja:Xb8/〜/}</code></td>
<td><code>フ〜</code></td>
</tr>
<tr>
<td><code>J&lt;separator&gt;/</code></td>
<td>Concatenates elements of a list with <code>&lt;separator&gt;</code> using <a href="https://docs.python.org/3/library/stdtypes.html#str.join" rel="nofollow"><code>str.join()</code></a></td>