Commit Graph

33 Commits

Author SHA1 Message Date
Mike Fährmann
9309204d9b [formatter] add 'R' conversion - extract URLs (#8125) 2025-08-26 16:44:22 +02:00
Mike Fährmann
8fbb6d29d8 [docs/formatting] update / improve
- add table of contents
- use more links
- reword & reformat general description text
- use HTML entities for double curly braces
  to prevent Jekyll from interpreting them as template expressions
2025-08-13 20:53:31 +02:00
Mike Fährmann
240f958707 [formatter] add 'W' conversion - sanitize whitespace (#6582)
https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3090777073
2025-07-19 21:44:55 +02:00
Mike Fährmann
f25c5f4b0c [formatter] add basic 'Jinja2' template support (#1390) 2025-07-16 23:23:58 +02:00
Mike Fährmann
2bcc2f2a17 [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"]
2025-06-22 16:33:20 +02:00
Mike Fährmann
71461ceaba [formatter] add 'L' conversion
to map ISO 639-1 language codes to their full names
2025-06-22 14:01:58 +02:00
Mike Fährmann
5e0cdac337 [formatter] change 'L'/length conversion to 'n' 2025-06-22 13:54:57 +02:00
Mike Fährmann
539ed8fef4 [formatter] add 'D' conversion 2025-05-29 20:09:26 +02:00
Mike Fährmann
9ce6de6ca0 [formatter] add 'i' and 'f' conversions (#6582)
https://github.com/mikf/gallery-dl/issues/6582#issuecomment-2792166608
2025-04-11 09:18:24 +02:00
Mike Fährmann
bb03311894 [docs] rewrite Field Names table in formatting.md as HTML
should fix the '\|' in '{empty\|title}'
in https://gdl-org.github.io/docs/formatting.html
2024-09-19 20:47:43 +02:00
Mike Fährmann
68bff76d90 [formatter] implement 'L' conversion 2024-09-19 13:50:52 +02:00
Mike Fährmann
b44f0cdab0 [formatter] allow accessing 'util.NONE' via global '_nul' 2024-09-19 13:28:59 +02:00
Mike Fährmann
78ae0ba9f7 [formatter] implement 'A' format specifier (#6036) 2024-08-16 20:34:23 +02:00
Mike Fährmann
8f50c04af2 [formatter] implement 'X' format specifier (#5770) 2024-06-21 20:56:19 +02:00
Mike Fährmann
1ce5de0290 [formatter] implement 'C' format specifier (#5647)
to apply a conversion after ':' or
to apply multiple conversions

for example {tags:CSl} or {tags:J - /Cl}
to convert list to string and lowercase it
2024-06-05 16:49:29 +02:00
Mike Fährmann
ce93c460a6 [formatter] implement 'H' conversion (#4164)
to remove HTML tags and unescape HTML entities
2023-06-15 13:07:51 +02:00
Mike Fährmann
9810ab35af [docs] update formatting.md
- add element access with quotes
- fix \f formatting
- remove note about typing \f in a shell (9e6c9813)
2023-05-22 22:24:23 +02:00
Mike Fährmann
69865dcc05 [formatter] implement slicing strings as bytes (#4087)
prefixing a slice '[10:30]' with a lowercase b '[b10:30]' encodes
the string to bytes in filesystem encoding before applying the slice
2023-05-22 18:30:45 +02:00
Mike Fährmann
46fdf46f21 [formatter] support loading an f-string from a template file
"\fTF ~/path/to/file.txt"
2023-03-20 22:05:33 +01:00
Mike Fährmann
1a4d4a799b [formatter] support filesystem paths for \fM 2023-03-20 22:01:33 +01:00
Mike Fährmann
42481aed59 [formatter] implement 'S' format specifier (#3266)
to Sort lists
2022-11-21 21:44:42 +01:00
Mike Fährmann
8839b0d2ee add section about global replacement fields to formatting.md
(#2862)
2022-08-30 21:32:22 +02:00
Mike Fährmann
67bad04dda [formatter] add 'g' conversion to sluGify a string (#2410) 2022-08-26 17:57:17 +02:00
Mike Fährmann
90ae48c40c [formatter] implement 'O' format specifier (#2736)
to apply a UTC offset to 'date' values and other datetime objects
2022-07-08 12:51:03 +02:00
Mike Fährmann
54525d2e21 [formatter] implement slice operator as format specifier
this allows using a slice operator alongside other (special) format
specifiers like J, to first join list elements to a string and then
trimming that with a slice.

{tags:J, /[:50]}
2022-06-25 16:52:58 +02:00
Mike Fährmann
cf44aba333 [formatter] allow evaluating f-string literals
by starting a format string with '\fF'.

This was technically already possible with '\fE',
but this makes it a bit more convenient.
2022-03-18 13:31:01 +01:00
Mike Fährmann
58e0b17211 add note about using '\f' in shells to docs/formatting.md
(closes #2398, closes #2406)
2022-03-17 23:09:25 +01:00
ImportTaste
c559c49781 formatting.md: add environment variable syntax (#2065) 2022-01-13 17:47:19 +01:00
Mike Fährmann
3842cdcd8f [formatter] implement 'D' format specifier
To be able to parse any string into a 'datetime' object
and format it as necessary.

Example:

{created_at:D%Y-%m-%dT%H:%M:%S%z}
->
"2010-01-01 00:00:00"

{created_at:D%Y-%m-%dT%H:%M:%S%z/%b %d %Y %I:%M %p}
->
"Jan 01 2010 12:00 AM"

with 'created_at' == "2010-01-01T01:00:00+0100"
2021-11-20 23:04:34 +01:00
ImportTaste
69cd573809 add special type format strings to docs (#1987) 2021-10-30 21:46:26 +02:00
Mike Fährmann
292fffc83c add 'j' format string conversion
to convert to a JSON formatted string
2021-08-28 01:19:36 +02:00
Mike Fährmann
317ecc8180 use HTML tables in docs/formatting.md 2021-07-05 23:29:03 +02:00
Mike Fährmann
963d177a68 document format string syntax
or at least attempt to
2021-06-29 19:35:07 +02:00