diff --git a/CHANGELOG.md b/CHANGELOG.md index 39ed7e2b..5a0a6431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ because it turns other people's test suites red. ## [Unreleased] +## [0.6.0-rc1] - 2026-11-18 + ### Breaking - **The label drawn in a picture no longer states the size of the file.** It @@ -263,6 +265,11 @@ because it turns other people's test suites red. ### Changed +- **Working out the smallest file of a picture takes half the time.** A + picture with its width and height set and `smallest` as its size was + compressed twice while the run worked out how small it can be, and is now + compressed once. `tfg preset show picture-sizes` and a dry run of the set + take about 0.7 s rather than 1.2 to 1.3 s. The files are the same. - **Many pictures are ready to write several times sooner.** Before the first file is written, every file is worked out, and a picture is drawn to do it - now on every processor at once. On 16 threads, @@ -281,11 +288,12 @@ because it turns other people's test suites red. turn of the mouse wheel takes the window about 8 to 11 ms rather than 15 to 20 ms, inside the time of one screen refresh. - **A value to type stands out from the words describing it.** In the - explanation behind a field, a value you type as it is - `screens` and `all` - for the groups of `picture-sizes`, `10mb` for a size, `{index:04}` in a file - name, `cccccc` for a colour - is drawn in a code typeface and its own colour. - The site shows it as code, and `tfg preset show` and `tfg formats` print it - between backticks. + explanation behind a field, each value you type as it is - the choices and + the default of a setting, its examples, and values such as `screens` and + `all` for the groups of `picture-sizes` - is drawn in a code typeface and + its own colour. The site shows them as code. The command line prints them + between backticks in `tfg formats`, `tfg preset show` and the list of a + preset's flags. - **The mouse wheel scrolls the window as far as the system says.** One notch moves three lines of text, or as many as Windows is set to under Mouse, Lines to scroll at a time, where it moved about half as far before. A @@ -380,6 +388,11 @@ because it turns other people's test suites red. ### Fixed +- **The title bar of the window is dark on Windows set to light apps.** The + window is always dark, and on a Windows set to light apps its title bar was + white. It is now dark there too, and stays dark when the Windows setting is + changed while the window is open. On macOS and Linux the title bar still + follows the system. - **The smallest size a refusal names is one every file of the batch takes.** Three 320x240 PNGs asked for at 1 B named the smallest size of the first file, and that size was refused again, because each picture needs its own. @@ -3203,7 +3216,8 @@ because it turns other people's test suites red. Initial release. -[Unreleased]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.5.0...HEAD +[Unreleased]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.6.0-rc1...HEAD +[0.6.0-rc1]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.5.0...v0.6.0-rc1 [0.5.0]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.4.0...v0.5.0 [0.4.0]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.3.0...v0.4.0 [0.3.0]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.2.0...v0.3.0 diff --git a/README.md b/README.md index 176d8618..836ac745 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Arm. It holds the program from the release archive and nothing else, and it runs with no network: ``` -docker run --rm --network none -v "${PWD}:/work" ghcr.io/donislawdev/tfg:0.5.0 generate --format pdf --size 1mb +docker run --rm --network none -v "${PWD}:/work" ghcr.io/donislawdev/tfg:0.6.0-rc1 generate --format pdf --size 1mb ``` The files land in the current directory. On Linux add @@ -779,7 +779,7 @@ interrupted. One entry per file: ```json { "manifest_version": "1.0", - "tool": { "name": "testing-files-generator", "version": "0.5.0" }, + "tool": { "name": "testing-files-generator", "version": "0.6.0-rc1" }, "run": { "id": "run_b359aa8d94", "seed": 0, @@ -906,7 +906,7 @@ On a Linux runner the Docker image needs no install step: ```yaml - name: build the fixtures - run: docker run --rm --network none --user "$(id -u):$(id -g)" -v "$PWD:/work" ghcr.io/donislawdev/tfg:0.5.0 generate fixtures.yaml --out fixtures + run: docker run --rm --network none --user "$(id -u):$(id -g)" -v "$PWD:/work" ghcr.io/donislawdev/tfg:0.6.0-rc1 generate fixtures.yaml --out fixtures ``` Name the version rather than `latest`, so the same recipe gives the same bytes @@ -926,7 +926,7 @@ names the SPDX predicate. On macOS this needs an Apple silicon runner, such as env: GH_TOKEN: ${{ github.token }} run: | - version=0.5.0 + version=0.6.0-rc1 arch=amd64 if [ "$RUNNER_ARCH" = ARM64 ]; then arch=arm64; fi case "$RUNNER_OS" in diff --git a/cmd/tfg-gui/rsrc_windows_amd64.syso b/cmd/tfg-gui/rsrc_windows_amd64.syso index 0e2e8715..890c87d7 100644 Binary files a/cmd/tfg-gui/rsrc_windows_amd64.syso and b/cmd/tfg-gui/rsrc_windows_amd64.syso differ diff --git a/cmd/tfg/rsrc_windows_amd64.syso b/cmd/tfg/rsrc_windows_amd64.syso index f98f27a8..02f468c3 100644 Binary files a/cmd/tfg/rsrc_windows_amd64.syso and b/cmd/tfg/rsrc_windows_amd64.syso differ diff --git a/cmd/tfg/tfg.rc b/cmd/tfg/tfg.rc index 9a169f23..c029be65 100644 --- a/cmd/tfg/tfg.rc +++ b/cmd/tfg/tfg.rc @@ -39,8 +39,8 @@ 1 ICON "../../internal/gui/icon/chickpea.ico" 1 VERSIONINFO -FILEVERSION 0,5,0,0 -PRODUCTVERSION 0,5,0,0 +FILEVERSION 0,6,0,0 +PRODUCTVERSION 0,6,0,0 FILEOS 0x40004L FILETYPE 0x1L BEGIN @@ -50,12 +50,12 @@ BEGIN BEGIN VALUE "CompanyName", "DonislawDev" VALUE "FileDescription", "Generates test files for QA, from the command line" - VALUE "FileVersion", "0.5.0" + VALUE "FileVersion", "0.6.0-rc1" VALUE "InternalName", "tfg" VALUE "LegalCopyright", "Copyright (C) 2026 DonislawDev. GNU GPL version 3." VALUE "OriginalFilename", "tfg.exe" VALUE "ProductName", "Testing Files Generator" - VALUE "ProductVersion", "0.5.0" + VALUE "ProductVersion", "0.6.0-rc1" END END BLOCK "VarFileInfo" diff --git a/internal/cli/cleanup.go b/internal/cli/cleanup.go index 3c3c40f5..d10d7fe0 100644 --- a/internal/cli/cleanup.go +++ b/internal/cli/cleanup.go @@ -38,7 +38,7 @@ Usage: Flags: `) fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } fs.Usage = func() { usage(errOut) } diff --git a/internal/cli/damagecmd.go b/internal/cli/damagecmd.go index 87227d4a..7e16bf17 100644 --- a/internal/cli/damagecmd.go +++ b/internal/cli/damagecmd.go @@ -214,7 +214,7 @@ Usage: Flags: `) fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } diff --git a/internal/cli/flagusage.go b/internal/cli/flagusage.go new file mode 100644 index 00000000..57feb80f --- /dev/null +++ b/internal/cli/flagusage.go @@ -0,0 +1,43 @@ +package cli + +import ( + "flag" + "fmt" + "strings" + + "github.com/donislawdev/TestingFilesGenerator/internal/core" +) + +// printFlags is fs.PrintDefaults with the backticks of every usage left as +// they are, written where fs writes. +// +// PrintDefaults takes the first word of a usage written between backticks for +// the name of the flag's value, prints it after the flag and drops the marks +// (flag.UnquoteUsage). No flag of ours names its value that way, and the +// usages of a preset's and a tool's settings mark the values a person types +// (core.Literal) - so a preset's groups printed as "-groups screens", with +// screens the one value left unmarked, measured on 2026-11-18 +// (docs/HINT-VALUES-2026-11-18.md). The marks stand aside while the flags are +// printed and come back in what was printed. +func printFlags(fs *flag.FlagSet) { + out := fs.Output() + var printed strings.Builder + var marked []*flag.Flag + fs.VisitAll(func(f *flag.Flag) { + if strings.Contains(f.Usage, core.Backtick) { + f.Usage = strings.ReplaceAll(f.Usage, core.Backtick, markStandIn) + marked = append(marked, f) + } + }) + fs.SetOutput(&printed) + fs.PrintDefaults() + fs.SetOutput(out) + for _, f := range marked { + f.Usage = strings.ReplaceAll(f.Usage, markStandIn, core.Backtick) + } + fmt.Fprint(out, strings.ReplaceAll(printed.String(), markStandIn, core.Backtick)) +} + +// markStandIn holds a backtick's place while PrintDefaults reads a usage - a +// character no usage carries, so putting the marks back finds only theirs. +const markStandIn = "\x00" diff --git a/internal/cli/formats.go b/internal/cli/formats.go index 793b5166..51267d39 100644 --- a/internal/cli/formats.go +++ b/internal/cli/formats.go @@ -233,7 +233,7 @@ Usage: Flags: `) fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } fs.Usage = func() { usage(errOut) } diff --git a/internal/cli/generate.go b/internal/cli/generate.go index 086a752f..2c0cd857 100644 --- a/internal/cli/generate.go +++ b/internal/cli/generate.go @@ -108,7 +108,7 @@ Usage: Flags: `) fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } // Pointed at wherever the set is currently writing rather than at errOut, diff --git a/internal/cli/presetcmd.go b/internal/cli/presetcmd.go index 7758528e..41a7dfc3 100644 --- a/internal/cli/presetcmd.go +++ b/internal/cli/presetcmd.go @@ -132,7 +132,7 @@ Usage: Flags: `) fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } fs.Usage = func() { usage(errOut) } diff --git a/internal/cli/recipecmd.go b/internal/cli/recipecmd.go index 7c6db763..afa83a75 100644 --- a/internal/cli/recipecmd.go +++ b/internal/cli/recipecmd.go @@ -62,7 +62,7 @@ func validateFlagSet(errOut io.Writer, v *validateFlags) (*flag.FlagSet, func(io usage := func(w io.Writer) { fmt.Fprint(w, "tfg validate - check a recipe and write nothing.\n\nUsage:\n tfg validate \n\nFlags:\n") fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } fs.Usage = func() { usage(errOut) } @@ -311,7 +311,7 @@ Usage: Flags: `) fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } fs.Usage = func() { usage(errOut) } diff --git a/internal/cli/verify.go b/internal/cli/verify.go index 565b4b04..aba34b02 100644 --- a/internal/cli/verify.go +++ b/internal/cli/verify.go @@ -36,7 +36,7 @@ Usage: Flags: `) fs.SetOutput(w) - fs.PrintDefaults() + printFlags(fs) fs.SetOutput(errOut) } fs.Usage = func() { usage(errOut) } diff --git a/internal/core/literal.go b/internal/core/literal.go index 3433658b..f71730bb 100644 --- a/internal/core/literal.go +++ b/internal/core/literal.go @@ -52,6 +52,19 @@ func Pieces(s string) []Piece { return out } +// Literal marks value as one to type, for a description put together by the +// program - the choices and the default of a setting (format.Property.Allowed). +func Literal(value string) string { return Backtick + value + Backtick } + +// LiteralEach is Literal of every value, in order. +func LiteralEach(values []string) []string { + out := make([]string, len(values)) + for i, v := range values { + out[i] = Literal(v) + } + return out +} + // Literals is every value to type in a description, in order. func Literals(s string) []string { var out []string diff --git a/internal/format/allowed.go b/internal/format/allowed.go new file mode 100644 index 00000000..293df7ef --- /dev/null +++ b/internal/format/allowed.go @@ -0,0 +1,102 @@ +package format + +import ( + "fmt" + "strings" + + "github.com/donislawdev/TestingFilesGenerator/internal/core" +) + +// What a setting takes, said to a person looking at an empty field: the start +// of the explanation under it, which tfg formats prints and the window builds +// in its own words from the same parts. Beside format.go, which holds the +// refusal a value meets (Allows), rather than in it: the two say the same +// words, a guard reads them side by side, and format.go reached the ceiling +// on the length of a file when the values in this one were marked (O358). + +// sizePhrase is what a size setting takes under an empty field, its example +// marked as a value to type (core.Literal). +// +// Allows says the same words, and until 2026-08-26 the two said it +// differently - "a size written the way any size is, such as 2mb or a plain +// byte count" against "a size such as 2mb, or a plain byte count". The other +// four kinds agree word for word, so size was the one place where the sentence +// a person reads depended on whether they had already typed something. O64, +// held by TestASettingIsDescribedTheSameWayEmptyOrRefused, which reads the two +// without the marks: a refusal is a sentence of the engine and carries none. +// +// The shorter half won: "written the way any size is" is a sentence about +// sizes rather than about this setting, and somebody who has just been refused +// needs the shape, not the provenance. +const sizePhrase = "a size such as `2mb`, or a plain byte count" + +func (p Property) unitSuffix() string { + if p.Unit == "" { + return "" + } + return " of " + p.Unit +} + +// Allowed says what this property accepts, as one phrase for a person. +// +// The values in it a person types as they are - each choice, the default, the +// examples - stand between backticks (core.Literal), which the window draws in +// the type of code, the site as code and the command line as written. The +// owner's decision of 2026-11-18 (O358, docs/HINT-VALUES-2026-11-18.md): the +// sentences under it marked them already, and the start of the same +// explanation did not. +// +// It lives here rather than beside a consumer because there are two of them and +// they cannot import each other. "tfg formats png" prints it in a list, and the +// window shows it under the field it drew from this same declaration - so a +// second copy would be two surfaces coming to describe one format differently, +// which is D1 in the place nobody thinks to compare. +// +// Near neighbour of Allows above, and deliberately not folded into it. Allows +// answers somebody who has already typed a wrong value and names the flag that +// would have taken a right one. This answers somebody looking at an empty field. +// The two phrasings agree today for every kind but size, and unifying them would +// change a message the command line already prints - a decision for the owner +// rather than a tidy up. Recorded as O64. +func (p Property) Allowed() string { + var what string + switch p.Kind { + case PropertyInt: + if p.Min != 0 || p.Max != 0 { + what = fmt.Sprintf("whole number%s from %d to %d", p.unitSuffix(), p.Min, p.Max) + } else { + what = "whole number" + p.unitSuffix() + } + case PropertyChoice: + what = "one of: " + strings.Join(core.LiteralEach(p.Choices), ", ") + case PropertyBool: + what = core.Literal("true") + " or " + core.Literal("false") + case PropertySize: + what = sizePhrase + case PropertyDuration: + what = p.durationPhrase() + default: + // A text setting describes itself with Shape or not at all. Saying + // "text" under a field is a word where a description should be. + what = p.Shape + } + if p.Default != "" && what == "" { + return "default " + core.Literal(p.Default) + } + if p.Default != "" { + what += ", default " + core.Literal(p.Default) + } + return what +} + +// durationPhrase is what a length of time takes under an empty field: the +// refusal's own words without its first two (takesDuration), so an empty field +// and a refused one describe the setting identically, and the examples marked +// as values to type. +func (p Property) durationPhrase() string { + examples := core.Literal("10s") + ", " + core.Literal("1m30s") + " or " + core.Literal("500ms") + if p.Min == 0 && p.Max == 0 { + return "a length of time such as " + examples + } + return "a length of time from " + core.FormatDuration(p.Min) + " to " + core.FormatDuration(p.Max) + ", such as " + examples +} diff --git a/internal/format/archive/archive.go b/internal/format/archive/archive.go index 4a45ca7a..a15b325b 100644 --- a/internal/format/archive/archive.go +++ b/internal/format/archive/archive.go @@ -77,7 +77,7 @@ const ( // archive's and a message's alike. Given by example rather than by the // command that lists formats, because a window has no command line beside // the box and does have a list of formats at its top. - FormatShape = "the id of a format, such as png or csv" + FormatShape = "the id of a format, such as `png` or `csv`" defaultEntries = 1 diff --git a/internal/format/avif/avif.go b/internal/format/avif/avif.go index 0b70e91e..4797252c 100644 --- a/internal/format/avif/avif.go +++ b/internal/format/avif/avif.go @@ -152,11 +152,19 @@ func init() { type generator struct{} -type memo struct { +// drawing is everything the picture is drawn and coded from, and nothing +// else. picture and codePicture read only this, so it is the whole of what the +// bytes coded in one round of a walk to the smallest file are kept under for +// the next (format.Measure). +type drawing struct { width, height int quality int seed uint64 label string +} + +type memo struct { + drawing // coded is the file the encoder produced, and it is filled in only when the // recipe named the picture size. Left out, the picture is chosen from the @@ -388,7 +396,7 @@ func chooseSize(r format.Request, label string, q int) (memo, error) { break } } - return memo{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}, nil + return memo{drawing: drawing{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}}, nil } // measuredSize walks the ladder coding each step, and takes the first that @@ -397,7 +405,7 @@ func chooseSize(r format.Request, label string, q int) (memo, error) { func measuredSize(r format.Request, label string, q int) (memo, error) { var smallest memo for _, step := range sizeLadder { - m, err := coded(memo{width: step.width, height: step.height, quality: q, seed: r.Seed, label: label}) + m, err := coded(r.Measured, drawing{width: step.width, height: step.height, quality: q, seed: r.Seed, label: label}) if err != nil { return memo{}, err } @@ -424,17 +432,24 @@ func namedSize(r format.Request, label string, q int) (memo, error) { if err := checkJointLimits(w, h); err != nil { return memo{}, err } - return coded(memo{width: w, height: h, quality: q, seed: r.Seed, label: label}) + return coded(r.Measured, drawing{width: w, height: h, quality: q, seed: r.Seed, label: label}) } // coded fills in the encoded bytes for a picture that has been settled. -func coded(m memo) (memo, error) { - b, err := encode(picture(m), m.quality) +// +// Once in a walk to the smallest file, whose later rounds ask for the same +// picture: the bytes the first round coded are the bytes the plan carries. +func coded(measured *format.Measured, d drawing) (memo, error) { + b, err := format.Measure(measured, d, codePicture) if err != nil { return memo{}, err } - m.coded = b - return m, nil + return memo{drawing: d, coded: b}, nil +} + +// codePicture is the picture d draws, coded. +func codePicture(d drawing) ([]byte, error) { + return encode(picture(d), d.quality) } // checkJointLimits asks the registry's own declaration about a pair of @@ -488,7 +503,7 @@ func (generator) Write(ctx context.Context, w io.Writer, p format.Plan) error { if coded == nil { // Planning chose the picture without coding it, so this is where the // work actually happens. - b, err := encode(picture(m), m.quality) + b, err := codePicture(m.drawing) if err != nil { return err } diff --git a/internal/format/avif/picture.go b/internal/format/avif/picture.go index 6856c379..4ae5c03e 100644 --- a/internal/format/avif/picture.go +++ b/internal/format/avif/picture.go @@ -16,7 +16,7 @@ import ( // picture builds the image for one file: a gradient that moves with the seed, // and the label burned into the top of it when there is room. -func picture(m memo) *image.RGBA { +func picture(m drawing) *image.RGBA { off := int(m.seed % 256) img := image.NewRGBA(image.Rect(0, 0, m.width, m.height)) diff --git a/internal/format/condition.go b/internal/format/condition.go index bce89e21..aa4518be 100644 --- a/internal/format/condition.go +++ b/internal/format/condition.go @@ -4,6 +4,8 @@ import ( "fmt" "slices" "strings" + + "github.com/donislawdev/TestingFilesGenerator/internal/core" ) // Condition is a setting that changes a file only while another setting of @@ -29,9 +31,10 @@ type Condition struct { func (c Condition) IsZero() bool { return c.Setting == "" } // Describe is the condition in the words tfg formats prints after what a -// setting takes. +// setting takes, the setting and its values marked as Property.Allowed marks +// the values it names. func (c Condition) Describe() string { - return fmt.Sprintf("only when %s is %s", c.Setting, strings.Join(c.Values, " or ")) + return fmt.Sprintf("only when %s is %s", core.Literal(c.Setting), strings.Join(core.LiteralEach(c.Values), " or ")) } // Applies reports whether p changes anything while the settings declared diff --git a/internal/format/format.go b/internal/format/format.go index 65d6fb18..1bceeb88 100644 --- a/internal/format/format.go +++ b/internal/format/format.go @@ -424,73 +424,6 @@ func (p Property) takesDuration() core.Said { core.A("Least", core.FormatDuration(p.Min)), core.A("Most", core.FormatDuration(p.Max))) } -// sizePhrase is what a size setting takes, written once. -// -// Allows and Allowed both have to say this, and until 2026-08-26 they said it -// differently - "a size written the way any size is, such as 2mb or a plain -// byte count" against "a size such as 2mb, or a plain byte count". The other -// four kinds agree word for word, so size was the one place where the sentence -// a person reads depended on whether they had already typed something. O64. -// -// The shorter half won: "written the way any size is" is a sentence about -// sizes rather than about this setting, and somebody who has just been refused -// needs the shape, not the provenance. -const sizePhrase = "a size such as 2mb, or a plain byte count" - -func (p Property) unitSuffix() string { - if p.Unit == "" { - return "" - } - return " of " + p.Unit -} - -// Allowed says what this property accepts, as one phrase for a person. -// -// It lives here rather than beside a consumer because there are two of them and -// they cannot import each other. "tfg formats png" prints it in a list, and the -// window shows it under the field it drew from this same declaration - so a -// second copy would be two surfaces coming to describe one format differently, -// which is D1 in the place nobody thinks to compare. -// -// Near neighbour of Allows above, and deliberately not folded into it. Allows -// answers somebody who has already typed a wrong value and names the flag that -// would have taken a right one. This answers somebody looking at an empty field. -// The two phrasings agree today for every kind but size, and unifying them would -// change a message the command line already prints - a decision for the owner -// rather than a tidy up. Recorded as O64. -func (p Property) Allowed() string { - var what string - switch p.Kind { - case PropertyInt: - if p.Min != 0 || p.Max != 0 { - what = fmt.Sprintf("whole number%s from %d to %d", p.unitSuffix(), p.Min, p.Max) - } else { - what = "whole number" + p.unitSuffix() - } - case PropertyChoice: - what = "one of: " + strings.Join(p.Choices, ", ") - case PropertyBool: - what = "true or false" - case PropertySize: - what = sizePhrase - case PropertyDuration: - // The refusal's own words without its first two, so an empty field - // and a refused one describe the setting identically. - what = strings.TrimPrefix(p.takesDuration().String(), "it takes ") - default: - // A text setting describes itself with Shape or not at all. Saying - // "text" under a field is a word where a description should be. - what = p.Shape - } - if p.Default != "" && what == "" { - return "default " + p.Default - } - if p.Default != "" { - what += ", default " + p.Default - } - return what -} - // SmallestAccepted is the smallest size this format will actually produce for // a request shaped like r. // @@ -540,6 +473,8 @@ func (d Descriptor) SmallestAccepted(r Request) int64 { // // The same walk as SmallestAccepted, and the plan it ends on rather than the // number, so the file is planned once rather than walked to and planned again. +// The walk plans it a round at a time, and a picture is encoded in the first +// round only (smallest). // A refusal that is not about the size is handed back as it is - a colour the // format cannot read is the answer somebody needs, not a floor. func (d Descriptor) PlanSmallest(ctx context.Context, r Request) (Plan, error) { @@ -552,8 +487,13 @@ func (d Descriptor) PlanSmallest(ctx context.Context, r Request) (Plan, error) { const SmallestRounds = 64 // smallest walks plan from nought to the first size it accepts. +// +// Every round asks for the same file at another size, so what one round +// measures the next can take: a picture with its width and height set is +// encoded once rather than once a round (Measured). func (d Descriptor) smallest(plan func(Request) (Plan, error), r Request) (Plan, error) { r.SizeFromContents = false + r.Measured = &Measured{} size := int64(0) for round := 0; round < SmallestRounds; round++ { r.Bytes = size @@ -734,6 +674,11 @@ type Request struct { Number int // Properties are format specific settings, straight from the recipe. Properties map[string]string + // Measured is what earlier rounds of a walk to the smallest file measured, + // handed to the next round (Measure), or nil outside one. It changes how + // long a plan takes and never what the plan says, so RequestKey leaves it + // out. + Measured *Measured } // Note is something that happened and has to stay visible. diff --git a/internal/format/gif/animation.go b/internal/format/gif/animation.go index 3a62e598..f77ec94c 100644 --- a/internal/format/gif/animation.go +++ b/internal/format/gif/animation.go @@ -62,7 +62,7 @@ func marker(width, height, frames, i int) (x, y, side int) { // markerFrame is one step of the animation: the square alone, at its own // offset, and nothing else. Keeping it to the square is what stops the frames // costing as much as the picture, in bytes and in memory both. -func markerFrame(m memo, i int) *image.Paletted { +func markerFrame(m drawing, i int) *image.Paletted { x, y, side := marker(m.width, m.height, m.frames, i) img := image.NewPaletted(image.Rect(x, y, x+side, y+side), buildPalette(paletteSize(m.width, m.height))) for j := range img.Pix { @@ -71,7 +71,7 @@ func markerFrame(m memo, i int) *image.Paletted { return img } -func encode(w io.Writer, m memo) error { +func encode(w io.Writer, m drawing) error { if m.frames <= 1 { // The plain encoder, byte for byte what this package wrote before it // could animate. Reached by asking for frames: 1. diff --git a/internal/format/gif/cut.go b/internal/format/gif/cut.go index 5243751e..094adeeb 100644 --- a/internal/format/gif/cut.go +++ b/internal/format/gif/cut.go @@ -41,7 +41,7 @@ var loopExtensionStart = []byte("\x21\xff\x0bNETSCAPE2.0") // every GIF below the ladder ceiling pays at planning today. func writeForACut(ctx context.Context, w io.Writer, m memo, whole int64) error { if !m.bodyKnown { - body, err := encodedBodySize(m) + body, err := encodedBodySize(m.drawing) if err != nil { return err } @@ -64,7 +64,7 @@ func writeForACut(ctx context.Context, w io.Writer, m memo, whole int64) error { return writePadding(ctx, w, m.seed, front) }} holder := &format.TailHolder{W: split, Keep: trailerSize} - if err := encode(holder, m); err != nil { + if err := encode(holder, m.drawing); err != nil { return err } if holder.Written != m.body { diff --git a/internal/format/gif/gif.go b/internal/format/gif/gif.go index 1528642a..54fa6ef7 100644 --- a/internal/format/gif/gif.go +++ b/internal/format/gif/gif.go @@ -151,11 +151,19 @@ func init() { type generator struct{} -type memo struct { +// drawing is everything the frames are drawn and encoded from, and nothing +// else. picture and encode read only this, so it is the whole of what a +// length measured in one round of a walk to the smallest file is kept under +// for the next (format.Measure). +type drawing struct { width, height int frames int seed uint64 label string +} + +type memo struct { + drawing // body is the encoded picture up to but not including the trailer. body int64 // bodyKnown says whether planning worked that out. For a request far @@ -349,7 +357,7 @@ func (generator) Write(ctx context.Context, w io.Writer, p format.Plan) error { // The trailer is always the final byte, so hold it back and let the rest // stream out. Nothing else is buffered. holder := &format.TailHolder{W: w, Keep: trailerSize} - if err := encode(holder, m); err != nil { + if err := encode(holder, m.drawing); err != nil { return err } if !m.bodyKnown { @@ -460,6 +468,8 @@ var sizeLadder = [][2]int{ {40, 30}, {20, 15}, {8, 6}, {4, 3}, {2, 2}, {1, 1}, } +// chooseSize settles the picture size and measures what it encodes to - once +// in a walk to the smallest file, whose later rounds ask for the same picture. func chooseSize(r format.Request, label string) (memo, error) { _, wSet := r.Properties["width"] _, hSet := r.Properties["height"] @@ -481,8 +491,8 @@ func chooseSize(r format.Request, label string) (memo, error) { if err := checkJointLimits(w, h); err != nil { return memo{}, err } - m := memo{width: w, height: h, frames: frames, seed: r.Seed, label: label} - body, err := encodedBodySize(m) + m := memo{drawing: drawing{width: w, height: h, frames: frames, seed: r.Seed, label: label}} + body, err := format.Measure(r.Measured, m.drawing, encodedBodySize) if err != nil { return memo{}, err } @@ -502,13 +512,13 @@ func chooseSize(r format.Request, label string) (memo, error) { // from here. if r.Bytes >= ladderCeiling+trailerSize+smallestCarryingComment { rung := sizeLadder[0] - return memo{width: rung[0], height: rung[1], frames: frames, seed: r.Seed, label: label}, nil + return memo{drawing: drawing{width: rung[0], height: rung[1], frames: frames, seed: r.Seed, label: label}}, nil } var smallest memo for _, rung := range sizeLadder { - m := memo{width: rung[0], height: rung[1], frames: frames, seed: r.Seed, label: label} - body, err := encodedBodySize(m) + m := memo{drawing: drawing{width: rung[0], height: rung[1], frames: frames, seed: r.Seed, label: label}} + body, err := format.Measure(r.Measured, m.drawing, encodedBodySize) if err != nil { return memo{}, err } @@ -523,7 +533,7 @@ func chooseSize(r format.Request, label string) (memo, error) { return smallest, nil } -func encodedBodySize(m memo) (int64, error) { +func encodedBodySize(m drawing) (int64, error) { holder := &format.TailHolder{W: io.Discard, Keep: trailerSize} if err := encode(holder, m); err != nil { return 0, err @@ -539,7 +549,7 @@ func encodedBodySize(m memo) (int64, error) { // run animates. Asking for frames: 1 reaches something smaller, and that is // the setting saying so. func minimumBytes() int64 { - body, err := encodedBodySize(memo{width: 1, height: 1, frames: defaultFrames}) + body, err := encodedBodySize(drawing{width: 1, height: 1, frames: defaultFrames}) if err != nil { return 1 << 62 } diff --git a/internal/format/gif/picture.go b/internal/format/gif/picture.go index 0648966e..e30bc364 100644 --- a/internal/format/gif/picture.go +++ b/internal/format/gif/picture.go @@ -92,7 +92,7 @@ func makePalette(size int) color.Palette { return p } -func picture(m memo) *image.Paletted { +func picture(m drawing) *image.Paletted { size := paletteSize(m.width, m.height) shades := size - reservedSlots if shades < 1 { diff --git a/internal/format/ico/ico.go b/internal/format/ico/ico.go index e5f3d978..acdc0173 100644 --- a/internal/format/ico/ico.go +++ b/internal/format/ico/ico.go @@ -99,11 +99,19 @@ func init() { type generator struct{} -type memo struct { +// drawing is everything the picture inside the icon is drawn and encoded +// from, and nothing else. picture and build read only this, so it is the whole +// of what the bytes built in one round of a walk to the smallest file are kept +// under for the next (format.Measure). +type drawing struct { width, height int seed uint64 label string embed string +} + +type memo struct { + drawing // image is the picture as it will sit inside the file. Small by // construction, because an icon side is at most 256 pixels. image []byte @@ -131,7 +139,8 @@ func (generator) Plan(r format.Request) (format.Plan, error) { return format.Plan{}, err } - blob, err := build(memo{width: w, height: h, seed: r.Seed, label: label, embed: embed}) + pic := drawing{width: w, height: h, seed: r.Seed, label: label, embed: embed} + blob, err := format.Measure(r.Measured, pic, build) if err != nil { return format.Plan{}, err } @@ -141,10 +150,7 @@ func (generator) Plan(r format.Request) (format.Plan, error) { return format.Plan{}, err } - m := memo{ - width: w, height: h, seed: r.Seed, label: label, embed: embed, - image: blob, gap: r.Bytes - bare, cutAt: r.CutAt, - } + m := memo{drawing: pic, image: blob, gap: r.Bytes - bare, cutAt: r.CutAt} p := format.Plan{ Bytes: r.Bytes, @@ -233,7 +239,7 @@ func chooseSize(r format.Request, label, embed string) (int, int, error) { smallest := standardSizes[len(standardSizes)-1] for _, side := range standardSizes { - blob, err := build(memo{width: side, height: side, seed: r.Seed, label: label, embed: embed}) + blob, err := format.Measure(r.Measured, drawing{width: side, height: side, seed: r.Seed, label: label, embed: embed}, build) if err != nil { return 0, 0, err } @@ -364,7 +370,7 @@ func writeGap(ctx context.Context, w io.Writer, seed uint64, n int64) error { } // build produces the picture that sits inside the icon. -func build(m memo) ([]byte, error) { +func build(m drawing) ([]byte, error) { img := picture(m) if m.embed == embedPNG { var buf bytes.Buffer @@ -377,7 +383,7 @@ func build(m memo) ([]byte, error) { return deviceIndependentBitmap(img), nil } -func picture(m memo) *image.RGBA { +func picture(m drawing) *image.RGBA { img := image.NewRGBA(image.Rect(0, 0, m.width, m.height)) off := int(m.seed % 256) for y := 0; y < m.height; y++ { @@ -445,7 +451,7 @@ func deviceIndependentBitmap(img *image.RGBA) []byte { // The refusal says so when it happens, rather than this number pretending to // cover both. func minimumBytes() int64 { - blob, err := build(memo{width: 1, height: 1, embed: embedBMP}) + blob, err := build(drawing{width: 1, height: 1, embed: embedBMP}) if err != nil { return 1 << 62 } diff --git a/internal/format/jpg/cut.go b/internal/format/jpg/cut.go index cafc1933..90c1fb36 100644 --- a/internal/format/jpg/cut.go +++ b/internal/format/jpg/cut.go @@ -44,7 +44,7 @@ func writeForACut(ctx context.Context, w io.Writer, m memo, whole int64) error { // marker held back, so the fill goes in front of it. holder := &format.TailHolder{W: w, Keep: eoiSize} skip := &headSkipper{w: holder, keep: soiSize} - if err := encode(skip, m); err != nil { + if err := encode(skip, m.drawing); err != nil { return err } if err := skip.check(); err != nil { diff --git a/internal/format/jpg/jpg.go b/internal/format/jpg/jpg.go index b7242f42..5c209c7e 100644 --- a/internal/format/jpg/jpg.go +++ b/internal/format/jpg/jpg.go @@ -141,7 +141,11 @@ func init() { type generator struct{} -type memo struct { +// drawing is everything the picture is drawn and encoded from, and nothing +// else. picture and encode read only this, so it is the whole of what a +// length measured in one round of a walk to the smallest file is kept under +// for the next (format.Measure). +type drawing struct { width, height int quality int seed uint64 @@ -150,6 +154,10 @@ type memo struct { // with this file's numbers in them. A test picture has neither. look placeholder.Settings text string +} + +type memo struct { + drawing // body is the exact number of bytes the encoded picture takes, start // marker included. Worked out during planning so that a size this format // cannot reach is refused before any file exists. @@ -345,7 +353,7 @@ func (generator) Write(ctx context.Context, w io.Writer, p format.Plan) error { } skip := &headSkipper{w: w, keep: soiSize} - if err := encode(skip, m); err != nil { + if err := encode(skip, m.drawing); err != nil { return err } if err := skip.check(); err != nil { @@ -366,10 +374,11 @@ var sizeLadder = [][2]int{ {40, 30}, {20, 15}, {8, 6}, {4, 3}, {2, 2}, {1, 1}, } -// chooseSize settles the picture size and measures what it encodes to. +// chooseSize settles the picture size and measures what it encodes to - once +// in a walk to the smallest file, whose later rounds ask for the same picture. func chooseSize(r format.Request, label string, q int, look placeholder.Settings) (memo, error) { at := func(w, h int) memo { - return memo{width: w, height: h, quality: q, seed: r.Seed, label: label, look: look, text: look.Expand(r.Number, w, h)} + return memo{drawing: drawing{width: w, height: h, quality: q, seed: r.Seed, label: label, look: look, text: look.Expand(r.Number, w, h)}} } _, wSet := r.Properties["width"] _, hSet := r.Properties["height"] @@ -387,7 +396,7 @@ func chooseSize(r format.Request, label string, q int, look placeholder.Settings return memo{}, err } m := at(w, h) - body, err := encodedSize(m) + body, err := format.Measure(r.Measured, m.drawing, encodedSize) if err != nil { return memo{}, err } @@ -398,7 +407,7 @@ func chooseSize(r format.Request, label string, q int, look placeholder.Settings var smallest memo for _, rung := range sizeLadder { m := at(rung[0], rung[1]) - body, err := encodedSize(m) + body, err := format.Measure(r.Measured, m.drawing, encodedSize) if err != nil { return memo{}, err } @@ -432,7 +441,7 @@ func qualityOf(props map[string]string) (int, error) { // picture builds the image. Deterministic from the seed, and smooth, so that // it compresses well and the encoded result stays small next to any realistic // requested size. -func picture(m memo) image.Image { +func picture(m drawing) image.Image { img := image.NewRGBA(image.Rect(0, 0, m.width, m.height)) if m.look.Placeholder() { placeholder.Draw(img, m.look.Look(m.text, m.label)) @@ -464,14 +473,14 @@ func picture(m memo) image.Image { return img } -func encode(w io.Writer, m memo) error { +func encode(w io.Writer, m drawing) error { return stdjpeg.Encode(w, picture(m), &stdjpeg.Options{Quality: m.quality}) } // encodedSize is how many bytes the picture takes on its own, start marker // included. Encoding once during planning is what lets a size this format // cannot reach be refused before any file exists. -func encodedSize(m memo) (int64, error) { +func encodedSize(m drawing) (int64, error) { c := &counter{} if err := encode(c, m); err != nil { return 0, err @@ -522,7 +531,7 @@ func declaredMinimum() int64 { return declaredMinimumBytes } func minimumBytes() int64 { var worst int64 for off := uint64(0); off < 256; off++ { - n, err := encodedSize(memo{width: 1, height: 1, quality: defaultQuality, seed: off}) + n, err := encodedSize(drawing{width: 1, height: 1, quality: defaultQuality, seed: off}) if err != nil { // Panics rather than returning a number nobody measured. // diff --git a/internal/format/jxl/jxl.go b/internal/format/jxl/jxl.go index 05c1f47f..56706ec4 100644 --- a/internal/format/jxl/jxl.go +++ b/internal/format/jxl/jxl.go @@ -204,11 +204,19 @@ type generator struct{} // to turn a run green. func (generator) AllocCeiling() int64 { return 700_000 } -type memo struct { +// drawing is everything the picture is drawn and coded from, and nothing +// else. picture and codePicture read only this, so it is the whole of what the +// bytes coded in one round of a walk to the smallest file are kept under for +// the next (format.Measure). +type drawing struct { width, height int quality int seed uint64 label string +} + +type memo struct { + drawing // coded is the codestream the encoder produced, and it is filled in only // when the recipe named the picture size. Left out, the picture is chosen @@ -424,7 +432,7 @@ func chooseSize(r format.Request, label string, q int) (memo, error) { break } } - return memo{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}, nil + return memo{drawing: drawing{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}}, nil } // measuredSize walks the ladder coding each step, and takes the first that @@ -433,7 +441,7 @@ func chooseSize(r format.Request, label string, q int) (memo, error) { func measuredSize(r format.Request, label string, q int) (memo, error) { var smallest memo for _, step := range sizeLadder { - m, err := coded(memo{width: step.width, height: step.height, quality: q, seed: r.Seed, label: label}) + m, err := coded(r.Measured, drawing{width: step.width, height: step.height, quality: q, seed: r.Seed, label: label}) if err != nil { return memo{}, err } @@ -460,17 +468,24 @@ func namedSize(r format.Request, label string, q int) (memo, error) { if err := checkJointLimits(w, h); err != nil { return memo{}, err } - return coded(memo{width: w, height: h, quality: q, seed: r.Seed, label: label}) + return coded(r.Measured, drawing{width: w, height: h, quality: q, seed: r.Seed, label: label}) } // coded fills in the codestream for a picture that has been settled. -func coded(m memo) (memo, error) { - b, err := encode(picture(m), m.quality) +// +// Once in a walk to the smallest file, whose later rounds ask for the same +// picture: the bytes the first round coded are the bytes the plan carries. +func coded(measured *format.Measured, d drawing) (memo, error) { + b, err := format.Measure(measured, d, codePicture) if err != nil { return memo{}, err } - m.coded = b - return m, nil + return memo{drawing: d, coded: b}, nil +} + +// codePicture is the picture d draws, coded. +func codePicture(d drawing) ([]byte, error) { + return encode(picture(d), d.quality) } // checkJointLimits asks the registry's own declaration about a pair of @@ -524,7 +539,7 @@ func (generator) Write(ctx context.Context, w io.Writer, p format.Plan) error { if coded == nil { // Planning chose the picture without coding it, so this is where the // work actually happens. - b, err := encode(picture(m), m.quality) + b, err := codePicture(m.drawing) if err != nil { return err } diff --git a/internal/format/jxl/measure.go b/internal/format/jxl/measure.go index d4763274..bf77bb5e 100644 --- a/internal/format/jxl/measure.go +++ b/internal/format/jxl/measure.go @@ -20,8 +20,7 @@ package jxl // label is passed in rather than derived, because its length moves with the // size of the file asked for and the ceilings have to cover the longest one. func FileSizeFor(width, height, quality int, seed uint64, label string) (int, error) { - m := memo{width: width, height: height, quality: quality, seed: seed, label: label} - coded, err := encode(picture(m), quality) + coded, err := codePicture(drawing{width: width, height: height, quality: quality, seed: seed, label: label}) if err != nil { return 0, err } diff --git a/internal/format/jxl/picture.go b/internal/format/jxl/picture.go index 5ead09b4..17c28e80 100644 --- a/internal/format/jxl/picture.go +++ b/internal/format/jxl/picture.go @@ -16,7 +16,7 @@ import ( // picture builds the image for one file: a gradient that moves with the seed, // and the label burned into the top of it when there is room. -func picture(m memo) *image.RGBA { +func picture(m drawing) *image.RGBA { off := int(m.seed % 256) img := image.NewRGBA(image.Rect(0, 0, m.width, m.height)) diff --git a/internal/format/measured.go b/internal/format/measured.go new file mode 100644 index 00000000..98cc361a --- /dev/null +++ b/internal/format/measured.go @@ -0,0 +1,63 @@ +package format + +// Measured is what one walk to the smallest file of a format has measured, +// kept for the rounds after it. +// +// The walk (Descriptor.smallest) asks Plan at nought, takes the minimum the +// refusal names and asks again there. A picture with its width and height set +// encodes itself in Plan to know its length, and its label does not carry the +// size, so both rounds encoded the same picture: two encodes where one would +// do, 94% of planning the picture-sizes preset (docs/SMALLEST-ONE-ENCODE-2026-11-18.md). +// The second round now takes what the first measured. +// +// One per walk, made by the walk, and gone with it. A walk is one goroutine - +// the files of a batch plan side by side, each with a walk of its own - so +// nothing here is shared and nothing needs a lock. A request outside a walk +// carries none, and Measure then measures every time, as every plan did before. +type Measured struct { + kept []measurement +} + +// measurement is one value measured for one key. +type measurement struct { + of, is any +} + +// Measure is measure(of), from what an earlier round of the same walk kept for +// an equal of, or measured now and kept for the rounds after. m may be nil. +// +// of has to hold everything measure reads, and that is what makes a value kept +// for it safe to hand back: the same function of the same input. So measure is +// a function of the format's package named here, never a closure that could +// read something of not holding - internal/guard holds every call to that. +// A format whose plan writes the bytes it measured (avif, jxl, ico) would +// otherwise write another picture without a word. +// +// A failed measurement is not kept, so the next round tries again and fails +// the same way. +func Measure[K comparable, V any](m *Measured, of K, measure func(K) (V, error)) (V, error) { + if v, ok := recall[V](m, of); ok { + return v, nil + } + v, err := measure(of) + if err != nil || m == nil { + return v, err + } + m.kept = append(m.kept, measurement{of: of, is: v}) + return v, nil +} + +// recall is what m kept for an of equal to this one, if it kept anything. +// A nil m kept nothing. +func recall[V any](m *Measured, of any) (V, bool) { + var none V + if m == nil { + return none, false + } + for _, k := range m.kept { + if v, ok := k.is.(V); ok && k.of == of { + return v, true + } + } + return none, false +} diff --git a/internal/format/otlp/properties.go b/internal/format/otlp/properties.go index bf0ec8b2..2af0adeb 100644 --- a/internal/format/otlp/properties.go +++ b/internal/format/otlp/properties.go @@ -120,7 +120,7 @@ func fileProperties() []format.Property { }, { Name: Start, Kind: format.PropertyText, - Shape: "a moment in UTC such as 2026-08-01T12:00:00Z", + Shape: "a moment in UTC such as `2026-08-01T12:00:00Z`", Default: defaultStart, Detail: "The moment the first span or log record is dated, and the moment a service writing metrics started. The later ones follow it at the rate or every interval. Change it when the system that receives the file refuses or hides data that is too old.", }, diff --git a/internal/format/pdf/properties.go b/internal/format/pdf/properties.go index cb0774ec..c5759c05 100644 --- a/internal/format/pdf/properties.go +++ b/internal/format/pdf/properties.go @@ -21,7 +21,7 @@ const anyText = "any text" // dateText is what a date accepts. The three ways a date may be written are // the ones dateShape reads, and none leaves the date out. -const dateText = "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none" +const dateText = "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`" var properties = []format.Property{ { diff --git a/internal/format/picture/picture.go b/internal/format/picture/picture.go index 12ea803c..8d013854 100644 --- a/internal/format/picture/picture.go +++ b/internal/format/picture/picture.go @@ -58,7 +58,7 @@ func Properties(group string, d Details) []format.Property { }, { Name: Format, Kind: format.PropertyText, - Shape: "the id of a picture format, such as png or jpg", + Shape: "the id of a picture format, such as `png` or `jpg`", Default: DefaultFormat, Detail: d.Format, Group: group, diff --git a/internal/format/placeholder/settings.go b/internal/format/placeholder/settings.go index b95a524a..02bf2381 100644 --- a/internal/format/placeholder/settings.go +++ b/internal/format/placeholder/settings.go @@ -55,7 +55,7 @@ const MaxText = 100 // shapeColour is what a colour has to look like, said once for both colours - // the site translates it as one term. -const shapeColour = "a colour such as cccccc or ccc" +const shapeColour = "a colour such as `cccccc` or `ccc`" // Group is the heading the four settings of a placeholder stand under on both // surfaces. content stands above it rather than in it, beside the width and diff --git a/internal/format/png/cut.go b/internal/format/png/cut.go index 639ecbb4..f632c21c 100644 --- a/internal/format/png/cut.go +++ b/internal/format/png/cut.go @@ -28,7 +28,7 @@ import ( // milliseconds to encode. func writeForACut(ctx context.Context, w io.Writer, m memo, whole int64) error { if !m.bodyKnown { - body, err := encodedBodySize(m) + body, err := encodedBodySize(m.drawing) if err != nil { return err } @@ -51,7 +51,7 @@ func writeForACut(ctx context.Context, w io.Writer, m memo, whole int64) error { return writePaddingChunk(ctx, w, paddingChunk, m.seed, front-chunkOverhead) }} holder := &format.TailHolder{W: split, Keep: iendSize} - if err := encode(holder, m); err != nil { + if err := encode(holder, m.drawing); err != nil { return err } if holder.Written != m.body { diff --git a/internal/format/png/png.go b/internal/format/png/png.go index 5b40e944..3369fa06 100644 --- a/internal/format/png/png.go +++ b/internal/format/png/png.go @@ -114,7 +114,11 @@ func init() { type generator struct{} -type memo struct { +// drawing is everything the picture is drawn and encoded from, and nothing +// else. picture and encode read only this, so it is the whole of what a +// length measured in one round of a walk to the smallest file is kept under +// for the next (format.Measure). +type drawing struct { width, height int seed uint64 label string @@ -122,6 +126,10 @@ type memo struct { // with this file's numbers in them. A test picture has neither. look placeholder.Settings text string +} + +type memo struct { + drawing // body is the number of bytes the encoded picture takes before the closing // chunk. Worked out during planning so that a size this format cannot // reach is refused before any file exists. @@ -333,7 +341,7 @@ func (generator) Write(ctx context.Context, w io.Writer, p format.Plan) error { // and let everything before them stream straight out. Nothing is buffered // beyond that, which matters because a picture can be very large. holder := &format.TailHolder{W: w, Keep: iendSize} - if err := encode(holder, m); err != nil { + if err := encode(holder, m.drawing); err != nil { return err } @@ -407,7 +415,8 @@ var sizeLadder = [][2]int{ {40, 30}, {20, 15}, {8, 6}, {4, 3}, {2, 2}, {1, 1}, } -// chooseSize settles the picture size and measures what it encodes to. +// chooseSize settles the picture size and measures what it encodes to - once +// in a walk to the smallest file, whose later rounds ask for the same picture. // // When the recipe names width and height, those are used and the size is // either reachable or an error. When it does not, the ladder is walked from @@ -416,7 +425,7 @@ var sizeLadder = [][2]int{ // big for it. func chooseSize(r format.Request, label string, look placeholder.Settings) (memo, error) { at := func(w, h int) memo { - return memo{width: w, height: h, seed: r.Seed, label: label, look: look, text: look.Expand(r.Number, w, h)} + return memo{drawing: drawing{width: w, height: h, seed: r.Seed, label: label, look: look, text: look.Expand(r.Number, w, h)}} } _, wSet := r.Properties["width"] _, hSet := r.Properties["height"] @@ -439,7 +448,7 @@ func chooseSize(r format.Request, label string, look placeholder.Settings) (memo return memo{}, err } m := at(w, h) - body, err := encodedBodySize(m) + body, err := format.Measure(r.Measured, m.drawing, encodedBodySize) if err != nil { return memo{}, err } @@ -478,7 +487,7 @@ func chooseSize(r format.Request, label string, look placeholder.Settings) (memo var smallest memo for _, rung := range sizeLadder { m := at(rung[0], rung[1]) - body, err := encodedBodySize(m) + body, err := format.Measure(r.Measured, m.drawing, encodedBodySize) if err != nil { return memo{}, err } @@ -498,7 +507,7 @@ func chooseSize(r format.Request, label string, look placeholder.Settings) (memo // picture builds the image. Deterministic from the seed, and compressible, so // that the encoded result is small next to any realistic requested size and // the padding chunk carries the difference. -func picture(m memo) image.Image { +func picture(m drawing) image.Image { img := image.NewRGBA(image.Rect(0, 0, m.width, m.height)) if m.look.Placeholder() { placeholder.Draw(img, m.look.Look(m.text, m.label)) @@ -529,7 +538,7 @@ func picture(m memo) image.Image { return img } -func encode(w io.Writer, m memo) error { +func encode(w io.Writer, m drawing) error { enc := stdpng.Encoder{CompressionLevel: stdpng.DefaultCompression} return enc.Encode(w, picture(m)) } @@ -542,7 +551,7 @@ func encode(w io.Writer, m memo) error { // doubles that for pictures of that size. At the default 640x480 it is a // couple of milliseconds. Nothing is held in memory - the bytes are counted // and dropped. -func encodedBodySize(m memo) (int64, error) { +func encodedBodySize(m drawing) (int64, error) { holder := &format.TailHolder{W: io.Discard, Keep: iendSize} if err := encode(holder, m); err != nil { return 0, err @@ -567,7 +576,7 @@ func encodedBodySize(m memo) (int64, error) { // matches format.Register, which panics on the same class, and a build that // cannot state its own minimum fails at start rather than at every use. func minimumBytes() int64 { - body, err := encodedBodySize(memo{width: 1, height: 1}) + body, err := encodedBodySize(drawing{width: 1, height: 1}) if err != nil { panic(fmt.Sprintf("png: the smallest picture cannot be encoded, so the minimum size of a file cannot be worked out: %v", err)) } diff --git a/internal/guard/boundaryresolution_test.go b/internal/guard/boundaryresolution_test.go index 995b5a79..79745068 100644 --- a/internal/guard/boundaryresolution_test.go +++ b/internal/guard/boundaryresolution_test.go @@ -58,6 +58,7 @@ func TestALinkInsideTheDirectoryPointingBackInsideItIsNotAnEscape(t *testing.T) } out := filepath.Join(root, "out") plantLink(t, actual, out) + requireNewNamesThroughLink(t, out) if code, _, errOut := run(t, "generate", "--format", "txt", "--size", "1kb", "--count", "1", diff --git a/internal/guard/duration_test.go b/internal/guard/duration_test.go index 06688601..1cb09b6e 100644 --- a/internal/guard/duration_test.go +++ b/internal/guard/duration_test.go @@ -166,9 +166,13 @@ func TestADurationSettingTakesALengthInsideItsRangeAndSaysSo(t *testing.T) { t.Errorf("%q is inside 33ms to 24h and was refused: %s", ok, bad) } } + // The empty field marks the examples and the default as values to type + // (O358), and the refusal is a sentence of the engine without marks - the + // same words either way. const want = "a length of time from 33ms to 24h, such as 10s, 1m30s or 500ms" - if got := p.Allowed(); got != want+", default 10s" { - t.Errorf("an empty field says %q, expected %q", got, want+", default 10s") + const marked = "a length of time from 33ms to 24h, such as `10s`, `1m30s` or `500ms`" + if got := p.Allowed(); got != marked+", default `10s`" { + t.Errorf("an empty field says %q, expected %q", got, marked+", default `10s`") } for _, bad := range []string{"32ms", "24h1ms", "10", "banana", "-1s"} { why := p.Allows(bad) @@ -188,7 +192,7 @@ func TestADurationSettingTakesALengthInsideItsRangeAndSaysSo(t *testing.T) { t.Errorf("the window says %q and tfg formats says %q", got, p.Allowed()) } unbounded := format.Property{Name: "duration", Kind: format.PropertyDuration} - if got := parts.Allowed(unbounded); got != unbounded.Allowed() || got != "a length of time such as 10s, 1m30s or 500ms" { + if got := parts.Allowed(unbounded); got != unbounded.Allowed() || got != "a length of time such as `10s`, `1m30s` or `500ms`" { t.Errorf("without a range the window says %q and tfg formats says %q", got, unbounded.Allowed()) } } diff --git a/internal/guard/guitext_test.go b/internal/guard/guitext_test.go index 34ab57bc..be26d765 100644 --- a/internal/guard/guitext_test.go +++ b/internal/guard/guitext_test.go @@ -119,10 +119,15 @@ var notWords = map[string]string{ `"."`: "the working directory, when the system will not say which one it is", `"tfg-out"`: "the folder the window offers to write into. A directory name rather than " + "prose, and translating it would move where somebody's files land", - `". "`: "what joins two sentences the declaration already carries", - `"png"`: "a format id in a comment example rather than a label", - `"uxtheme.dll"`: "a Windows library this program loads, a file name and not a word", - `"kernel32.dll"`: "a Windows library this program loads, a file name and not a word", + `". "`: "what joins two sentences the declaration already carries", + `"png"`: "a format id in a comment example rather than a label", + `"uxtheme.dll"`: "a Windows library this program loads, a file name and not a word", + `"kernel32.dll"`: "a Windows library this program loads, a file name and not a word", + `"dwmapi.dll"`: "a Windows library this program loads for the dark title bar, a file name and not a word", + `"DwmSetWindowAttribute"`: "the Win32 entry point that asks for the dark title bar, looked up by name, " + + "an identifier and not a word", + `"DwmGetWindowAttribute"`: "the Win32 entry point that reads the title bar back, looked up by name, " + + "an identifier and not a word", `"user32.dll"`: "a Windows library this program loads for the dialog it shows when it has no window, a file name and not a word", `"GetProcAddress"`: "the Win32 entry point looked up by name, an identifier and not a word", `"MessageBoxW"`: "the Win32 entry point that shows a system dialog, looked up by name, an identifier and not a word", diff --git a/internal/guard/hintvalues_test.go b/internal/guard/hintvalues_test.go new file mode 100644 index 00000000..bd8ae331 --- /dev/null +++ b/internal/guard/hintvalues_test.go @@ -0,0 +1,169 @@ +package guard + +import ( + "bytes" + "context" + "flag" + "fmt" + "slices" + "strings" + "testing" + + "github.com/donislawdev/TestingFilesGenerator/internal/cli" + "github.com/donislawdev/TestingFilesGenerator/internal/core" + "github.com/donislawdev/TestingFilesGenerator/internal/damage" + "github.com/donislawdev/TestingFilesGenerator/internal/format" + _ "github.com/donislawdev/TestingFilesGenerator/internal/format/all" + "github.com/donislawdev/TestingFilesGenerator/internal/preset" + "github.com/donislawdev/TestingFilesGenerator/internal/tool" + _ "github.com/donislawdev/TestingFilesGenerator/internal/tool/all" +) + +// The start of a setting's explanation - what it takes, its default and when +// it applies - marks the values a person types, as the sentences after it do: +// the owner's decision of 2026-11-18, everywhere and on the command line too +// (O358, docs/HINT-VALUES-2026-11-18.md). Before it, `groups` read "group names +// separated by commas, or all, default all" above a sentence that marked all. + +// TestEveryValueASettingTakesIsMarked reads what every setting of every format, +// preset, damage and tool takes, as tfg formats prints it, and asks each value +// a person types in it to stand between backticks: every choice, the default, +// true and false, and in a condition the setting and its values. A value +// holding a backtick of its own could not be marked at all, so that is asked +// too, and so is a mark left without its partner. +// +// The canaries are the phrase as it read before the decision, three values of +// a choice with a default, none of them marked, and the same phrase with the +// choices marked and the default not: the default is one of the choices, and +// the choice marked earlier must not answer for it. The phrase marked in full +// has to pass, or the check finds faults that are not there. +func TestEveryValueASettingTakesIsMarked(t *testing.T) { + canary := format.Property{Name: "x", Kind: format.PropertyChoice, Choices: []string{"a", "b"}, Default: "a"} + for phrase, want := range map[string]int{ + "one of: a, b, default a": 3, + "one of: `a`, `b`, default a": 1, + "one of: `a`, `b`, default `a`": 0, + } { + if got := unmarkedValues(canary, phrase); len(got) != want { + t.Fatalf("canary: a choice of a and b with the default a, read in %q, gave %d fault(s) where %d were due: %q", + phrase, len(got), want, got) + } + } + + checked := 0 + check := func(owner string, props []format.Property) { + for _, p := range props { + phrase := p.Allowed() + if !p.OnlyWhen.IsZero() { + phrase += ", " + p.OnlyWhen.Describe() + } + for _, fault := range unmarkedValues(p, phrase) { + t.Errorf("%s %s: %s", owner, p.Name, fault) + } + checked++ + } + } + for _, d := range format.All() { + check("format "+d.ID, d.Properties) + } + for _, p := range preset.All() { + check("preset "+p.ID, p.Parameters) + } + for _, d := range damage.All() { + check("damage "+d.ID, d.Parameters) + } + for _, d := range tool.All() { + check("tool "+d.ID, d.Settings) + } + if checked < 150 { + t.Fatalf("%d settings read - 200 were declared on 2026-11-18, so the registries were not filled here", checked) + } +} + +// unmarkedValues is each value of p that phrase does not mark, each value that +// holds a backtick, and a mark in phrase left without its partner. The default +// is asked for in its own clause, "default" and the value marked, because it +// is often one of the choices and a choice marked earlier would answer for it. +func unmarkedValues(p format.Property, phrase string) []string { + values := slices.Clone(p.Choices) + if p.Kind == format.PropertyBool { + values = append(values, "true", "false") + } + if !p.OnlyWhen.IsZero() { + values = append(append(values, p.OnlyWhen.Setting), p.OnlyWhen.Values...) + } + marked := make([]string, len(values)) + for i, v := range values { + marked[i] = core.Literal(v) + } + if p.Default != "" { + values = append(values, p.Default) + marked = append(marked, "default "+core.Literal(p.Default)) + } + var faults []string + for i, v := range values { + switch { + case strings.Contains(v, core.Backtick): + faults = append(faults, fmt.Sprintf("the value %q holds a backtick, so no mark can carry it", v)) + case !strings.Contains(phrase, marked[i]): + faults = append(faults, fmt.Sprintf("%q is not marked in %q", v, phrase)) + } + } + if strings.Count(phrase, core.Backtick)%2 != 0 { + faults = append(faults, fmt.Sprintf("a mark is left without its partner in %q", phrase)) + } + return faults +} + +// TestTheHelpOfAFlagKeepsTheMarksOfItsValues asks the help a command prints +// for its flags to keep the backticks of a usage as they are written. +// +// flag.PrintDefaults takes the first word of a usage written between backticks +// for the name of the flag's value, prints it after the flag and drops the +// marks. A preset's settings are flags of generate, and their usage marks +// values: on 2026-11-18 "tfg generate --preset picture-sizes" with a flag it +// does not know printed "-groups screens", with screens the one value bare. +// +// The canary is that habit itself, on a set of one flag: printed by +// PrintDefaults, the check has to find the marks lost. Then the real command, +// the help it prints when a flag is wrong. +func TestTheHelpOfAFlagKeepsTheMarksOfItsValues(t *testing.T) { + fs := flag.NewFlagSet("canary", flag.ContinueOnError) + fs.String("groups", "", "group names, or `all`. Leave it at `all`, or name `screens`.") + var plain bytes.Buffer + fs.SetOutput(&plain) + fs.PrintDefaults() + if len(flagMarksLost(plain.String(), "groups", []string{"all", "screens"})) == 0 { + t.Fatalf("canary: PrintDefaults kept every mark of the usage, so this check cannot see one dropped:\n%s", plain.String()) + } + + var out, errOut bytes.Buffer + if code := cli.Run(context.Background(), []string{"generate", "--preset", "picture-sizes", "--no-such-flag"}, &out, &errOut); code != cli.ExitUsage { + t.Fatalf("a flag generate does not know ended %d rather than %d, so its help was not asked for:\n%s", code, cli.ExitUsage, errOut.String()) + } + for _, lost := range flagMarksLost(errOut.String(), "groups", []string{"all", "screens", "avatars", "social"}) { + t.Error(lost) + } +} + +// flagMarksLost is what the help of one flag lost of its marks: the line of the +// flag naming a value rather than its type, and each value printed bare. +func flagMarksLost(help, name string, values []string) []string { + var lost []string + head := " -" + name + " " + at := strings.Index(help, head) + if at < 0 { + return []string{fmt.Sprintf("the help names no -%s:\n%s", name, help)} + } + line, _, _ := strings.Cut(help[at:], "\n") + if strings.TrimPrefix(line, head) != "string" { + lost = append(lost, fmt.Sprintf("-%s is printed as %q, a value taken for the name of its type", name, line)) + } + usage, _, _ := strings.Cut(help[at+len(line)+1:], "\n -") + for _, v := range values { + if !strings.Contains(usage, core.Literal(v)) { + lost = append(lost, fmt.Sprintf("%q is printed without its marks under -%s: %s", v, name, strings.TrimSpace(usage))) + } + } + return lost +} diff --git a/internal/guard/linkclaim_test.go b/internal/guard/linkclaim_test.go new file mode 100644 index 00000000..e5956e90 --- /dev/null +++ b/internal/guard/linkclaim_test.go @@ -0,0 +1,113 @@ +package guard + +import ( + "errors" + "io/fs" + "os" + "path/filepath" + "testing" +) + +// requireNewNamesThroughLink stops a case that writes into a directory reached +// through a link, on a host whose file system refuses every new name there. +// +// Measured on 2026-11-18 (O286, tools/probes/linklock): on Windows, a process +// that runs under the file system write virtualization of a packaged app asks +// for a new name in a directory under AppData reached through a symbolic link +// and is told ERROR_FILE_EXISTS, while nothing holds that name and the same +// name in the real directory is free. Every run claims its lock that way, so a +// run through the link is refused with "another run is already writing" and +// the case reads as a regression of ours. The same request succeeds outside +// that virtualization, and inside it when the directory is outside AppData. +// +// The system is asked directly rather than through core.CreateNew, so that a +// refusal of ours still reaches the case and goes red there. A refusal of a +// name nothing holds is the host: a skip off CI and a failure on it, by the +// rule plantLink follows. Any other refusal is a failure everywhere. +func requireNewNamesThroughLink(t *testing.T, dir string) { + t.Helper() + requireNewNamesThroughLinkWith(t, claimAndGiveBack, os.Getenv("CI"), dir) +} + +// claimAndGiveBack takes a new name the way a run's lock is taken, then gives +// it back, so the case finds the directory as it left it. +func claimAndGiveBack(path string) error { + f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o666) + if err != nil { + return err + } + return errors.Join(f.Close(), os.Remove(path)) +} + +func requireNewNamesThroughLinkWith(t linkReporter, claim func(string) error, ci, dir string) { + t.Helper() + path := filepath.Join(dir, "tfg-new-name-probe") + err := claim(path) + if err == nil { + return + } + if !hostRefusesAFreeName(err, path) { + t.Fatalf("taking a new name through the link at %s: %v", path, err) + return + } + why := "this host refuses a new name in a directory reached through a link (%v) while nothing holds it, " + + "so no run can write there and this case did not run. Measured under the file system write " + + "virtualization of a packaged app (O286) - run it from a terminal, or with TMP outside AppData" + if !linkCasesMaySkip(ci) { + t.Fatalf(why+".\nOn CI a case that did not run must not look like one that passed.", err) + return + } + t.Skipf(why, err) +} + +// hostRefusesAFreeName says whether the system answered "already there" for a +// name that nothing holds. A name somebody does hold is a real refusal. +func hostRefusesAFreeName(err error, path string) bool { + if !errors.Is(err, fs.ErrExist) { + return false + } + _, look := os.Lstat(path) + return errors.Is(look, fs.ErrNotExist) +} + +// What this defends. A host that refuses a free name through a link skips the +// two cases that write through one off CI and fails them on CI. A name that is +// really held, or any other refusal, fails everywhere - a skip there would +// hide a defect of ours behind the host. +func TestACaseWritingThroughALinkSkipsOnlyWhereTheHostRefusesAFreeName(t *testing.T) { + free, taken := t.TempDir(), t.TempDir() + if err := os.WriteFile(filepath.Join(taken, "tfg-new-name-probe"), nil, 0o600); err != nil { + t.Fatalf("taking the name: %v", err) + } + refused := &fs.PathError{Op: "open", Path: "x", Err: fs.ErrExist} + denied := &fs.PathError{Op: "open", Path: "x", Err: fs.ErrPermission} + + cases := []struct { + held bool + err error + ci string + want string + why string + }{ + {false, nil, "true", "made", "a name the host gives needs nothing said about it"}, + {false, refused, "", "skipped", "off CI a host that refuses a free name is not a defect of ours"}, + {false, refused, "true", "failed", "on CI no refusal may hide a case"}, + {true, refused, "", "failed", "a name that is really held is a real refusal, whatever the host"}, + {false, denied, "", "failed", "a refusal that is not about the name is a defect"}, + } + for _, c := range cases { + dir := free + if c.held { + dir = taken + } + r := &linkRecorder{} + requireNewNamesThroughLinkWith(r, func(string) error { return c.err }, c.ci, dir) + if got := r.outcome(); got != c.want { + t.Errorf("with %v, the name held %v and CI=%q the case %s, want %s.\n"+ + "Reason: %s.\n"+ + "What to do: a skip is green, so a wider skip stops the cases that write through a link "+ + "from being checked without anything going red. Narrow it back.", + c.err, c.held, c.ci, got, c.want, c.why) + } + } +} diff --git a/internal/guard/literals_test.go b/internal/guard/literals_test.go index 384ac93f..e78ee876 100644 --- a/internal/guard/literals_test.go +++ b/internal/guard/literals_test.go @@ -218,6 +218,10 @@ func TestEveryValueToTypeIsShownAsAValue(t *testing.T) { for _, p := range preset.All() { for _, param := range p.Parameters { wanted[p.ID] = append(wanted[p.ID], core.Literals(param.Detail)...) + // And what it takes: its choices, its default and the values its + // shape names (O358). The site's words for a size or a length of + // time are its own and shorter, so a size names 2mb alone. + wanted[p.ID] = append(wanted[p.ID], siteTakes(param)...) } } published := map[string]int{} @@ -312,15 +316,33 @@ func declaredDescriptions() map[string]string { "Seed": text.DetailSeed(), "Smallest why": text.SmallestNeedsTheSides(), } + // The start of every explanation as the window words it - what a setting + // takes, its choices and its default, marked since O358. for _, d := range format.All() { for _, p := range d.Properties { out[d.ID+"."+p.Name] = p.Detail + out[d.ID+"."+p.Name+" takes"] = parts.Allowed(p) } } for _, p := range preset.All() { for _, param := range p.Parameters { out["preset "+p.ID+"."+param.Name] = param.Detail + out["preset "+p.ID+"."+param.Name+" takes"] = parts.Allowed(param) } } return out } + +// siteTakes is the values the settings table of the site shows as code for p: +// each choice, the default, the values its shape marks, and 2mb for a size. +func siteTakes(p format.Property) []string { + out := slices.Clone(p.Choices) + if p.Default != "" { + out = append(out, p.Default) + } + out = append(out, core.Literals(p.Shape)...) + if p.Kind == format.PropertySize { + out = append(out, "2mb") + } + return out +} diff --git a/internal/guard/mutation/canary.py b/internal/guard/mutation/canary.py new file mode 100644 index 00000000..027a192d --- /dev/null +++ b/internal/guard/mutation/canary.py @@ -0,0 +1,83 @@ +"""The canary of a mutation run: a file that cannot compile, planted on purpose. + +Every BROKEN verdict rests on the runner telling a tree that does not build +from a guard that failed. The canary proves that on every run, before the +first entry: it plants a file the compiler must refuse and demands BROKEN +with the compiler's own complaint about that file. + +It is a new file rather than a change to an existing one, because existing +code moves. A canary pointing at code that moved stops every run before its +first entry, and on a pull request that reads as a part that did not report +(O366). A new file points at nothing in the code, so no refactor leaves it +behind. What it still needs from the tree is asked by fault(), which reads +text only, so the plan of a run and staleness.py ask it too. +""" +from pathlib import Path + +# label, file, what the file holds, guard. The file sits in a package every +# guard builds, under a name nothing in the project uses. Any guard does as +# the guard, because the tree fails to build before a test is chosen. +CANARY = ( + "canary: a file that cannot compile must report BROKEN", + "internal/core/zz_mutation_canary.go", + "package core\n\nfunc init() {\n\tvar orphan int\n}\n", + "TestOurOwnGeneratorsHaveNotDrifted", +) + +GUARDS = "internal/guard" + + +class Unreadable(Exception): + """A file the canary's checks need could not be read as UTF-8 text.""" + + +def text(path: Path, root: Path) -> str: + """The text of path, or Unreadable naming it relative to root. + + Raised rather than skipped, so a file nobody can read is the fault said + instead of a traceback with no verdict, and is not taken for a file that + lacks what was looked for. + """ + try: + return path.read_text(encoding="utf-8") + except (OSError, UnicodeError) as err: + raise Unreadable(f"{path.relative_to(root).as_posix()} cannot be read - {err}") from err + + +def module(root: Path) -> str: + """The module path go.mod declares, or an empty string. Unreadable when go.mod cannot be read.""" + lines = text(root / "go.mod", root).splitlines() + return next((line.split()[1] for line in lines if line.startswith("module ") and len(line.split()) == 2), "") + + +def fault(root: Path) -> str: + """Why the canary cannot be planted in the tree at root, or an empty string.""" + try: + return planting_fault(root) + except Unreadable as err: + return f"{err}, so where the canary belongs cannot be checked" + + +def planting_fault(root: Path) -> str: + """fault(), with a file that cannot be read raised as Unreadable.""" + _label, rel, body, _test = CANARY + path = root / rel + home = Path(rel).parent.as_posix() + if path.exists(): + return f"{rel} is already there, so planting the canary would overwrite it" + if not path.parent.is_dir(): + return f"{home} is gone, so there is no package to plant the canary in" + clause = body.split("\n", 1)[0] + sources = [g for g in path.parent.glob("*.go") if not g.name.endswith("_test.go")] + if not any(clause in text(g, root).splitlines() for g in sources): + return f"no file in {home} says {clause!r}, so the canary would not belong to its package" + if not (root / "go.mod").exists(): + return "there is no go.mod, so nothing says which guards import the canary's package" + declared = module(root) + if not declared: + return "go.mod declares no module, so nothing says which guards import the canary's package" + imported = f'"{declared}/{home}"' + guards = (root / GUARDS).glob("*_test.go") + if not any(imported in text(g, root) for g in guards): + return f"no guard imports {home}, so a canary there would not stop the guards from building" + return "" diff --git a/internal/guard/mutation/entries.py b/internal/guard/mutation/entries.py index de6b5e95..c51223e7 100644 --- a/internal/guard/mutation/entries.py +++ b/internal/guard/mutation/entries.py @@ -538,7 +538,7 @@ ( "the version in the file properties drifts from the one the program reports", "internal/version/version.go", - 'const Version = "0.5.0"', + 'const Version = "0.6.0-rc1"', 'const Version = "0.1.0"', "TestBothBinariesCarryTheirVersionAndAuthor", ), @@ -3641,7 +3641,7 @@ # "text, default 1B,1kb,1mb" for a setting that wants a list of sizes - # the declaration knew that and had nowhere to put it. "a text setting goes back to describing itself as text", - "internal/format/format.go", + "internal/format/allowed.go", "\t\twhat = p.Shape", '\t\twhat = "text"', "TestNoTextSettingDescribesItselfAsText", @@ -5665,7 +5665,7 @@ # for size they used to be written out separately - so what a person # read depended on whether they had already typed something wrong. O64. "a size setting goes back to being described two ways", - "internal/format/format.go", + "internal/format/allowed.go", "\t\twhat = sizePhrase\n", "\t\twhat = \"a size written the way any size is, such as 2mb or a plain byte count\"\n", "TestASettingIsDescribedTheSameWayEmptyOrRefused", @@ -7432,8 +7432,8 @@ ( "planning codes the picture again, so previewing a large run costs what the run costs", "internal/format/avif/avif.go", - "\treturn memo{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}, nil", - "\treturn coded(memo{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label})", + "\treturn memo{drawing: drawing{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}}, nil", + "\treturn coded(r.Measured, drawing{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label})", "TestAvifPlanningDoesNotCodeThePicture", ), ( @@ -7537,8 +7537,8 @@ ( "JPEG XL planning codes the picture again, so previewing a large run costs what the run costs", "internal/format/jxl/jxl.go", - " return memo{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}, nil", - " return coded(memo{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label})", + " return memo{drawing: drawing{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label}}, nil", + " return coded(r.Measured, drawing{width: pick.width, height: pick.height, quality: q, seed: r.Seed, label: label})", "TestJxlPlanningDoesNotCodeThePicture", ), ( @@ -8155,8 +8155,8 @@ ( "Unreleased is left comparing from the release before the newest one", "CHANGELOG.md", + "[Unreleased]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.6.0-rc1...HEAD", "[Unreleased]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.5.0...HEAD", - "[Unreleased]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.4.0...HEAD", "TestEveryChangelogVersionHasItsLinkDefinition", ), ( @@ -9489,8 +9489,8 @@ # runs before the question is ever asked. "the window binary shows and runs before the seam", "internal/gui/run_cgo.go", - "\tcode := OpenOrRefuse(w, a.Run, SecondAttemptFor(launch, errOut).Try, func(why error) {", - "\tw.ShowAndRun()\n\tcode := OpenOrRefuse(w, a.Run, SecondAttemptFor(launch, errOut).Try, func(why error) {", + "\tcode := OpenOrRefuse(w, RunDark(a, w), SecondAttemptFor(launch, errOut).Try, func(why error) {", + "\tw.ShowAndRun()\n\tcode := OpenOrRefuse(w, RunDark(a, w), SecondAttemptFor(launch, errOut).Try, func(why error) {", "TestTheWindowBinaryOpensThroughTheRefusalSeam", ), ( @@ -13164,7 +13164,7 @@ ( "the window stops saying a setting's default where tfg formats says it", "internal/gui/parts/property.go", - "return text.AllowedWithDefault(what, p.Default)", + "return text.AllowedWithDefault(what, core.Literal(p.Default))", "return what", "TestTheWindowDescribesASettingAsTheCommandLineDoes", ), diff --git a/internal/guard/mutation/mutate.py b/internal/guard/mutation/mutate.py index 01975855..5c52f67b 100644 --- a/internal/guard/mutation/mutate.py +++ b/internal/guard/mutation/mutate.py @@ -25,12 +25,13 @@ import time from pathlib import Path +from canary import CANARY, fault as canary_fault from entries import MUTATIONS from pool import DEFAULT_WORKERS, TreeDamaged, TreesNotMade, drop_trees, make_trees from runner import ( record_proof, proofs_recorded, require_go, unbuilt_files, unjudged_reason, ROOT, Budget, TreeCorrupted, below_floor, free_bytes, measured_ceiling, - mutation_applied, no_room_for, run_test, time_cap_for, + mutation_applied, no_room_for, planted, run_test, time_cap_for, ) from selection import ( canary as selection_canary, changed_files, entries_at, guard_files, reached, @@ -38,21 +39,6 @@ ) -# The canary. A mutation that deliberately does not compile, so the detection -# of that case is exercised on every run rather than only on the day somebody -# writes a broken mutation by accident. -# -# Without it the BROKEN path is code nobody proves. That is the same gap this -# whole script exists to close, one level further in. -CANARY = ( - "canary: a mutation that cannot compile must report BROKEN", - "internal/core/label.go", - "func Label(formatID string, bytes int64, seed uint64) string {", - "func Label(formatID string, bytes int64, seed uint64) string {\n\tvar orphan int", - "TestOurOwnGeneratorsHaveNotDrifted", -) - - # How long building the guard binary in an unmutated tree may take. Generous, # because this is the cold build an entry must not pay for - 409.7 s on the # owner's machine with cgo - and what it guards against is a build that hangs. @@ -106,23 +92,31 @@ def first_complaint(output: str) -> str: def check_canary_in(tree) -> bool: - """True when a non compiling mutation is correctly reported as BROKEN. + """True when a tree that does not compile is correctly reported as BROKEN. Runs in a worker tree like every other entry, so the real repository is - never mutated - not even by the one entry that is meant to leave the tree + never touched - not even by the one entry that is meant to leave the tree unable to compile. The complaint has to come through as well, naming the - file and the variable the canary added, or a BROKEN below says nothing - about why. + planted file and its variable, or a BROKEN below says nothing about why. + A canary that cannot be planted is a verdict, not a crash: a run that + crashes here writes no report, and that reads as a part that did not + report (O366). A tree that cannot be rebuilt after a failed plant raises + OSError, and main stops the run with its report, because that tree is not + fit for the entries. """ - label, rel, old, new, test = CANARY - path = tree.file(rel) - original = path.read_bytes() - if old.encode() not in original: - print(f"SKIP {label}\n pattern not found in {rel} - the canary is stale") + label, rel, body, test = CANARY + stale = canary_fault(tree.path) + if stale: + print(f"SKIP {label}\n {stale} - the canary is stale") return False - with mutation_applied(path, original, original.replace(old.encode(), new.encode(), 1)): - result = run_test(test, tree.path) + try: + with planted(tree.file(rel), body.encode()): + result = run_test(test, tree.path) + except TreeCorrupted as damage: + tree.rebuild() + print(f"SKIP {label}\n {damage} - the worker tree was rebuilt") + return False if result.compiled: print(f"HOLE {label}\n a tree that does not compile was reported as compiling, " @@ -453,6 +447,14 @@ def chosen_entries(args: argparse.Namespace, say) -> list[int] | None: for fault in faults: say(f" {fault}") return None + # Asked here as well as before the first entry, because here is where a + # pull request sees it: the plan stops red, where a canary failing inside + # a part is only a warning on a pull request. + stale = canary_fault(ROOT) + if stale: + say(f"the canary cannot be planted, so no BROKEN verdict could be trusted and nothing was run:\n" + f" {stale}") + return None if not args.changed: return list(range(len(MUTATIONS))) changed = changed_files(ROOT, args.changed) @@ -525,7 +527,7 @@ def main() -> int: # Asked once, before anything is copied. The answer does not change while # the run goes, and refusing here costs a syscall where finding out the # hard way costs the whole run and a log ending in BROKEN lines. The - # canary mutates a file too, hence the extra entry. + # canary writes a file too, hence the extra entry. cramped = no_room_for(total + 1, workers) if cramped: print(f"not enough disk for this run\n {cramped}") @@ -564,7 +566,15 @@ def main() -> int: # The canary first and alone. It proves the BROKEN path works, and # every BROKEN verdict below is unreliable if it does not - so it is # worth the one entry it costs to run it before the others start. - canary_ok = check_canary_in(trees[0]) + try: + canary_ok = check_canary_in(trees[0]) + except OSError as error: + # Most likely the disk that refused the plant refusing the copy + # too. Said and written down, as a tree that could not be made is. + print(f"no entry was run - the canary's worker tree could not be rebuilt:\n {error}") + report["stopped"] = f"the canary's worker tree could not be rebuilt - {error}" + write_report(args.json, report) + return 2 outcomes, stopped = dispatch(chosen, trees, budget, deadline, unbuilt) diff --git a/internal/guard/mutation/runner.py b/internal/guard/mutation/runner.py index 80da29f6..a84fe365 100644 --- a/internal/guard/mutation/runner.py +++ b/internal/guard/mutation/runner.py @@ -359,7 +359,13 @@ def write_checked(path: Path, want: bytes, what: str) -> None: path.write_bytes(want) except OSError as err: raise TreeCorrupted(f"{path}: {what} could not be written - {err}") from err - got = path.read_bytes() + try: + got = path.read_bytes() + except OSError as err: + # The same answer as a failed write: what is on disk is unknown, and a + # bare OSError would leave the caller without its verdict and the run + # without its report. + raise TreeCorrupted(f"{path}: {what} was written but could not be read back - {err}") from err if got != want: raise TreeCorrupted( f"{path}: {what} was written but the file holds {len(got)} bytes " @@ -383,6 +389,27 @@ def mutation_applied(path: Path, original: bytes, mutant: bytes) -> Iterator[Non write_checked(path, original, "the original") +@contextlib.contextmanager +def planted(path: Path, body: bytes) -> Iterator[None]: + """Hold a new file on disk for the length of the block, then take it away. + + The canary's counterpart of mutation_applied. A file already there is + refused rather than overwritten, and the file is taken away in a finally, + because every entry after the canary on the same worker would otherwise + build against it and come back BROKEN. + """ + if path.exists(): + raise TreeCorrupted(f"{path}: already there, so planting a file would overwrite it") + try: + write_checked(path, body, "the planted file") + yield + finally: + try: + path.unlink(missing_ok=True) + except OSError as err: + raise TreeCorrupted(f"{path}: the planted file could not be taken away - {err}") from err + + class Baselines: """What every mutated file held when the run started. diff --git a/internal/guard/mutation/staleness.py b/internal/guard/mutation/staleness.py index 97d1598b..d2aaeeec 100644 --- a/internal/guard/mutation/staleness.py +++ b/internal/guard/mutation/staleness.py @@ -25,12 +25,18 @@ from pathlib import Path sys.path.insert(0, str(Path(__file__).parent)) +from canary import CANARY, fault as canary_fault # noqa: E402 from entries import MUTATIONS # noqa: E402 from pool import ROOT # noqa: E402 def main(): missing, doubled = [], [] + # The canary is not an entry, and every entry rests on it: when it cannot + # be planted, a run stops before its first entry (O366). + stale = canary_fault(ROOT) + if stale: + missing.append((CANARY[0], CANARY[1], stale)) for label, rel, old, _new, _test in MUTATIONS: path = ROOT / rel if not path.exists(): diff --git a/internal/guard/mutationcoverage_test.go b/internal/guard/mutationcoverage_test.go index 40c4bdf1..d0ffa1b4 100644 --- a/internal/guard/mutationcoverage_test.go +++ b/internal/guard/mutationcoverage_test.go @@ -259,6 +259,33 @@ var provenByProbe = map[string]string{ "and it asks that it reached the test job of ci.yml and the script that job hands its part to.", "TestAVerdictOfPartsRunsWhateverThePartsDid": "a canary of its own - the test job's verdict read with if: success() " + "has to be found wrong.", + "TestEveryValueASettingTakesIsMarked": "a canary of its own - a choice with a default, none of them marked, has " + + "to give three faults - and it asks that it read 150 settings or more. Broken by hand on 2026-11-18 by a default " + + "left bare in Allowed: red.", + "TestTheHelpOfAFlagKeepsTheMarksOfItsValues": "a canary of its own - a usage printed by flag.PrintDefaults has to " + + "be found to lose its marks. Broken by hand on 2026-11-18 by generate printing its flags with PrintDefaults: red.", + "TestTheSmallestPictureIsEncodedOnceWhileItIsPlanned": "a canary of its own - a walk whose generator drops what the " + + "walk kept has to be caught in jpg and png. Broken by hand on 2026-11-18 by a walk that makes no Measured: red in " + + "all six formats that encode while planning.", + "TestAWalkThatRemembersWritesTheBytesOfOneThatMeasuresAgain": "it asks that it reached ten picture formats and three " + + "placeholders. Broken by hand on 2026-11-18 by a Measure that hands back what it kept for another key: red in the " + + "walk without a size of jpg, png, gif and ico.", + "TestWindowsHoldsTheTitleBarDarkOnceAsked": "a canary of its own - a window nobody asked about has to read as " + + "not dark before the asked one may read as dark - and a window of none has to be refused. What it cannot see, the " + + "look of the bar, was measured on Windows Server 2025 on 2026-11-18: 243 before, 32 after.", + "TestTheTitleBarIsAskedForAgainAfterEveryChangeOfSettings": "a canary of its own - an ask made straight from the " + + "listener, before the toolkit's answer, has to leave the bar light. Broken by hand on 2026-11-18 by " + + "KeepTitleBarDark without fyne.Do: red. On a real window that day a build without KeepTitleBarDark left the bar " + + "light after the desktop went to dark apps and back, attribute 0 and caption 243, where the build with it kept 1 and 32.", + "TestACaseWritingThroughALinkSkipsOnlyWhereTheHostRefusesAFreeName": "a table of its own, asked of " + + "requireNewNamesThroughLinkWith rather than of the predicate, as TestACaseBuiltOnALinkSkipsOnlyOffCI is. Broken by " + + "hand on 2026-11-18 by every refusal counted as the host's and by the host's refusal skipped on CI: red both times. " + + "A probe that left its name behind turned TestADirectoryReachedThroughALinkStillWorks red.", + "TestAMeasurementIsKeptForAnEqualKeyOnly": "a table whose first row has to be measured, so the rows after it are not " + + "a Measure that never measures. Broken by hand on 2026-11-18 with the key comparison taken out: red.", + "TestEveryMeasurementIsAFunctionOfItsKeyAlone": "a table of canaries of its own - a closure, a variable and a method " + + "value have to be found, a function of the package not - and it asks that it reached jpg and avif. Broken by hand " + + "on 2026-11-18 by a closure in jpg's chooseSize: red.", "TestAGridAsksEveryPartOfAFieldForItsSizeOnce": "a canary of its own - a sentence behind a layout that asks it twice " + "has to be found - every counted thing asked exactly once, so a field the grid never reached is red too, and run on " + "2026-11-18 against the grid before the change: red, a field asked 5 times and a field in a group 15.", diff --git a/internal/guard/notelemetry_test.go b/internal/guard/notelemetry_test.go index 79ad65ad..0eaae12d 100644 --- a/internal/guard/notelemetry_test.go +++ b/internal/guard/notelemetry_test.go @@ -204,6 +204,7 @@ var allowedURLs = map[string]string{ var allowedLibraries = map[string]string{ "kernel32.dll": "free disk space, and GetProcAddress for the call below", "uxtheme.dll": "the dark window menu, called by ordinal - see darkmenus_windows.go", + "dwmapi.dll": "the dark title bar, one window attribute set and read back - see titlebar_windows.go", "user32.dll": "the system dialog shown when the toolkit could not open a window - see dialog_windows.go - and how far a notch of the mouse wheel scrolls, see wheel_windows.go", } @@ -323,6 +324,9 @@ var librariesLoadedByPath = map[string]approvedOperation{ "internal/gui/darkmenus_windows.go": {call: "syscall.LoadDLL", from: "systemLibraryPath", why: "the dark window menu, loaded from an absolute path under the system directory " + "because uxtheme.dll is not a KnownDLL - see systemLibraryPath there"}, + "internal/gui/titlebar_windows.go": {call: "syscall.LoadDLL", from: "systemLibraryPath", + why: "the dark title bar, loaded from an absolute path under the system directory " + + "because dwmapi.dll is not a KnownDLL either - the same answer as darkmenus_windows.go (O360)"}, // The second case, and the reason it is the safer answer is different: // the path is under the executable's own directory rather than the // system's, which is the trust the executable already carries, and a diff --git a/internal/guard/refusalwords_test.go b/internal/guard/refusalwords_test.go index 46df98ae..2012e46b 100644 --- a/internal/guard/refusalwords_test.go +++ b/internal/guard/refusalwords_test.go @@ -4,6 +4,7 @@ import ( "strings" "testing" + "github.com/donislawdev/TestingFilesGenerator/internal/core" "github.com/donislawdev/TestingFilesGenerator/internal/engine" "github.com/donislawdev/TestingFilesGenerator/internal/format" _ "github.com/donislawdev/TestingFilesGenerator/internal/format/all" @@ -34,7 +35,10 @@ func TestASettingIsDescribedTheSameWayEmptyOrRefused(t *testing.T) { // Allowed carries the default on the end, because it is read under // a field where the default is worth knowing. Allows never does - // somebody who typed a value is not choosing whether to. - want := p.Allowed() + // Allowed marks the values a person types (O358) and a refusal is + // a sentence of the engine without marks, so the words are what + // has to agree. + want := strings.ReplaceAll(p.Allowed(), core.Backtick, "") if cut := strings.Index(want, ", default "); cut >= 0 { want = want[:cut] } diff --git a/internal/guard/requestkey_test.go b/internal/guard/requestkey_test.go index 809faf4f..6b0fba33 100644 --- a/internal/guard/requestkey_test.go +++ b/internal/guard/requestkey_test.go @@ -29,6 +29,16 @@ func TestEveryFieldOfARequestIsInItsKey(t *testing.T) { field := typ.Field(i) var r format.Request v := reflect.ValueOf(&r).Elem().Field(i) + // What a walk to the smallest file measured changes how long a plan + // takes and never what it says, so it has to stay OUT of the key: in + // it, every walk would key its one answer apart from the next. + if field.Type == reflect.TypeOf(&format.Measured{}) { + v.Set(reflect.ValueOf(&format.Measured{})) + if got, _ := format.RequestKey("png", r); got != base { + t.Errorf("a request carrying %s has another key than an empty one, and what a walk measured changes no plan", field.Name) + } + continue + } switch field.Type.Kind() { case reflect.Int64, reflect.Int: v.SetInt(1) diff --git a/internal/guard/smallestonce_test.go b/internal/guard/smallestonce_test.go new file mode 100644 index 00000000..2e51037b --- /dev/null +++ b/internal/guard/smallestonce_test.go @@ -0,0 +1,365 @@ +package guard + +import ( + "context" + "crypto/sha256" + "errors" + "fmt" + "go/ast" + "go/parser" + "go/token" + "os" + "runtime" + "slices" + "strings" + "testing" + + "github.com/donislawdev/TestingFilesGenerator/internal/format" + _ "github.com/donislawdev/TestingFilesGenerator/internal/format/all" + pictures "github.com/donislawdev/TestingFilesGenerator/internal/format/picture" +) + +// The walk to the smallest file plans one picture a round at a time, and a +// picture with its width and height set encodes itself to know its length. It +// encoded the same picture in every round until 2026-11-18 - two encodes where +// one would do, 94% of planning the picture-sizes preset (O357, +// docs/SMALLEST-ONE-ENCODE-2026-11-18.md). Now a round takes what the one +// before it measured (format.Measure). The guards below hold the three things +// that has to stay true: the picture is encoded once, a walk that remembers +// writes the bytes of a walk that measures again, and what is remembered is +// remembered under everything it was measured from. + +// TestTheSmallestPictureIsEncodedOnceWhileItIsPlanned plans the smallest file +// of every picture format and asks that the walk cost, in bytes allocated, not +// much more than planning that one file at its size once. +// +// Allocation rather than time, because it is the same number on every run of +// one build: measured on 2026-11-18 at 256x192, a walk was 2.00 plans in each +// of the six formats that encode while planning, and 1.00 to 1.02 after. The +// four that work their length out by arithmetic (bmp, svg, tiff, webp) plan in +// a few kilobytes, which the 16 KiB of room covers. +// +// The canary is the same walk with every round measuring afresh, a generator +// that drops what the walk kept: it has to be caught in jpg and png, the two +// formats the presets of pictures default to, or the check cannot see a second +// encode at all. +func TestTheSmallestPictureIsEncodedOnceWhileItIsPlanned(t *testing.T) { + ctx := context.Background() + var caught []string + for _, id := range pictures.Formats() { + d, err := format.Get(id) + if err != nil { + t.Fatal(err) + } + r := smallestPictureRequest(false) + p, err := d.PlanSmallest(ctx, r) + if err != nil { + t.Fatalf("%s: the smallest file at 256x192 was refused, so there is no walk to measure: %v", id, err) + } + at := r + at.Bytes = p.Bytes + one := leastAllocated(t, id, func() error { _, err := d.Generator.Plan(at); return err }) + walk := leastAllocated(t, id, func() error { _, err := d.PlanSmallest(ctx, r); return err }) + forgetful := d + forgetful.Generator = forgettingWalk{d.Generator} + again := leastAllocated(t, id, func() error { _, err := forgetful.PlanSmallest(ctx, r); return err }) + + if tooDear(walk, one) { + t.Errorf("%s: the walk to the smallest file allocated %d B where planning that file once allocated %d B - "+ + "the picture is encoded in more than one round. A plan that encodes measures through format.Measure "+ + "with the request's Measured, keyed by everything the picture is drawn from", id, walk, one) + } + if tooDear(again, one) { + caught = append(caught, id) + } + } + for _, id := range []string{"jpg", "png"} { + if !slices.Contains(caught, id) { + t.Errorf("canary - a walk of %s whose every round measures afresh was not caught (caught: %v), so this check "+ + "cannot see a second encode", id, caught) + } + } +} + +// tooDear says a walk cost more than one plan and half another, with 16 KiB of +// room for a format whose plan is arithmetic. +func tooDear(walk, one uint64) bool { + return walk > one+one/2+16<<10 +} + +// forgettingWalk plans every round with nothing the walk kept, which is how a +// walk planned before it kept anything. +type forgettingWalk struct{ format.Generator } + +func (f forgettingWalk) Plan(r format.Request) (format.Plan, error) { + r.Measured = nil + return f.Generator.Plan(r) +} + +// leastAllocated is the fewest bytes two calls allocated, after one call that +// fills whatever a first call fills. +func leastAllocated(t *testing.T, id string, call func() error) uint64 { + t.Helper() + if err := call(); err != nil { + t.Fatalf("%s: %v", id, err) + } + least := ^uint64(0) + for i := 0; i < 2; i++ { + var before, after runtime.MemStats + runtime.ReadMemStats(&before) + if err := call(); err != nil { + t.Fatalf("%s: %v", id, err) + } + runtime.ReadMemStats(&after) + least = min(least, after.TotalAlloc-before.TotalAlloc) + } + return least +} + +// smallestPictureRequest asks for a 256x192 picture with its label, or for a +// placeholder when placeholder is set, as the walk to the smallest file is +// asked. +func smallestPictureRequest(placeholder bool) format.Request { + props := map[string]string{"width": "256", "height": "192"} + if placeholder { + props["content"] = "placeholder" + } + return format.Request{Label: true, Seed: 7, Number: 3, Properties: props} +} + +// TestAWalkThatRemembersWritesTheBytesOfOneThatMeasuresAgain plans the +// smallest file of every picture format twice - the walk as it runs, and the +// walk with every round measuring afresh - and writes both. Same size, same +// bytes. +// +// avif, jxl and ico write the bytes their plan coded, so a value remembered +// under a key that left out something the picture is drawn from would be +// another picture written without a word. jpg, png and gif encode again while +// writing and stop on a length the plan did not expect. The golden values pin +// the smallest file of png, jpg and svg only (generatorbytes_test.go), so this +// asks the other seven too, and a placeholder wherever a format draws one. +// +// With the width and height set every round draws the same picture, so only +// the walk without them - whose rounds measure different rungs of a ladder - +// can show a value handed back for another picture. Measured by hand on +// 2026-11-18: format.Measure with its key comparison taken out reddened that +// walk in jpg, png, gif and ico. +func TestAWalkThatRemembersWritesTheBytesOfOneThatMeasuresAgain(t *testing.T) { + ctx := context.Background() + formats, placeholders := pictures.Formats(), 0 + for _, id := range formats { + d, err := format.Get(id) + if err != nil { + t.Fatal(err) + } + forgetful := d + forgetful.Generator = forgettingWalk{d.Generator} + for _, shape := range []string{"256x192", "a placeholder", "no size"} { + placeholder := shape == "a placeholder" + if placeholder && !slices.Contains(d.PropertyNames(), "content") { + continue + } + r := smallestPictureRequest(placeholder) + if shape == "no size" { + // The ladder of sizes: the first round measures every rung + // down to one pixel, the second the rungs down to the one it + // takes. Rounds asking for different pictures are what a value + // handed back under another key would show in. + r.Properties = nil + } + remembered, err := d.PlanSmallest(ctx, r) + if err != nil { + t.Fatalf("%s at %s: %v", id, shape, err) + } + measured, err := forgetful.PlanSmallest(ctx, r) + if err != nil { + t.Fatalf("%s at %s, every round measuring afresh: %v", id, shape, err) + } + got, want := writtenSum(t, d, remembered), writtenSum(t, d, measured) + if remembered.Bytes != measured.Bytes || got != want { + t.Errorf("%s at %s: the walk that remembers planned %d B and wrote %s, the walk that measures again "+ + "%d B and %s - a round took a value measured for another picture", + id, shape, remembered.Bytes, got, measured.Bytes, want) + } + if placeholder { + placeholders++ + } + } + } + if len(formats) < 10 || placeholders < 3 { + t.Fatalf("asked %d picture formats and %d placeholders - ten formats and the placeholders of png, jpg and svg "+ + "were registered when this was written, so this stopped reaching some of them", len(formats), placeholders) + } +} + +// writtenSum writes the file p plans and returns its SHA-256. +func writtenSum(t *testing.T, d format.Descriptor, p format.Plan) string { + t.Helper() + h := sha256.New() + if err := d.Generator.Write(context.Background(), h, p); err != nil { + t.Fatalf("%s: writing the plan of %d B: %v", d.ID, p.Bytes, err) + } + return fmt.Sprintf("%x", h.Sum(nil)) +} + +// TestAMeasurementIsKeptForAnEqualKeyOnly asks format.Measure the four things +// a walk leans on: an equal key is measured once, another key is measured on +// its own, a failure is not kept, and a request outside a walk measures every +// time. +func TestAMeasurementIsKeptForAnEqualKeyOnly(t *testing.T) { + type key struct { + side int + seed uint64 + } + calls := 0 + double := func(k key) (int, error) { + calls++ + if k.side < 0 { + return 0, errors.New("no picture of a negative side") + } + return k.side * 2, nil + } + walk := &format.Measured{} + for _, c := range []struct { + name string + in *format.Measured + of key + want int + calls int + fails bool + }{ + {"first", walk, key{8, 1}, 16, 1, false}, + {"the same key again", walk, key{8, 1}, 16, 1, false}, + {"another seed", walk, key{8, 2}, 16, 2, false}, + {"another side", walk, key{9, 1}, 18, 3, false}, + {"a failure", walk, key{-1, 1}, 0, 4, true}, + {"the failure again", walk, key{-1, 1}, 0, 5, true}, + {"outside a walk", nil, key{8, 1}, 16, 6, false}, + {"outside a walk again", nil, key{8, 1}, 16, 7, false}, + } { + got, err := format.Measure(c.in, c.of, double) + if got != c.want || calls != c.calls || (err != nil) != c.fails { + t.Errorf("%s: got %d (%v) after %d measurements, want %d after %d", c.name, got, err, calls, c.want, c.calls) + } + } +} + +// TestEveryMeasurementIsAFunctionOfItsKeyAlone reads every call of +// format.Measure in the shipped code and asks that what it measures with is a +// function of its package named there - not a closure, not a variable, not a +// method value. +// +// A value is remembered under the key it was measured from, and that is safe +// only while the measuring reads nothing but the key. A closure can read a +// setting the key left out, and then a second round with another value of that +// setting takes the first round's picture. The types hold the rest: a format's +// drawing is what its picture and encode functions take, so a function of the +// drawing alone cannot see more. +// +// Read from the syntax, so a local variable holding a closure under the name +// of a function of the package would pass. Telling the two apart needs the +// type checker, which costs this guard more than that case is worth. +func TestEveryMeasurementIsAFunctionOfItsKeyAlone(t *testing.T) { + for _, c := range []struct { + name, src string + want int + }{ + {"a function of the package", "package p\nfunc f(d int) (int, error) { return d, nil }\nfunc g() { format.Measure(nil, 1, f) }", 0}, + {"a closure", "package p\nfunc g(q int) { format.Measure(nil, 1, func(d int) (int, error) { return d + q, nil }) }", 1}, + {"a variable", "package p\nfunc f(d int) (int, error) { return d, nil }\nfunc g() { h := f\n format.Measure(nil, 1, h) }", 1}, + {"a method value", "package p\ntype s struct{ q int }\nfunc (v s) f(d int) (int, error) { return d + v.q, nil }\nfunc g(v s) { format.Measure(nil, 1, v.f) }", 1}, + {"inside package format", "package format\nfunc g(q int) { Measure(nil, 1, func(d int) (int, error) { return q, nil }) }", 1}, + {"a type argument named", "package p\nfunc f(d int) (int, error) { return d, nil }\nfunc g() { format.Measure[int, int](nil, 1, f) }", 0}, + } { + faults, _, err := measureFaults("canary", []string{c.src}) + if err != nil || len(faults) != c.want { + t.Fatalf("canary %q: %d faults %q (%v), want %d - the check cannot be trusted with the real code", c.name, len(faults), faults, err, c.want) + } + } + + var faults, reached []string + for _, p := range packages(t) { + var srcs []string + for _, f := range p.files { + data, err := os.ReadFile(f) + if err != nil { + t.Fatal(err) + } + srcs = append(srcs, string(data)) + } + found, calls, err := measureFaults(p.rel, srcs) + if err != nil { + t.Fatal(err) + } + faults = append(faults, found...) + if calls > 0 { + reached = append(reached, p.rel) + } + } + for _, want := range []string{"internal/format/jpg", "internal/format/avif"} { + if !slices.Contains(reached, want) { + t.Fatalf("no call of format.Measure found in %s, which plans through one - this reached %v", want, reached) + } + } + if len(faults) > 0 { + t.Errorf("format.Measure is handed something other than a function of its package:\n %s\nName a function "+ + "that takes the format's drawing and nothing else, so what is remembered is what was measured.", + strings.Join(faults, "\n ")) + } +} + +// measureFaults parses the files of one package and returns each call of +// Measure - format.Measure, or Measure inside package format - whose third +// argument is not the name of a function declared in the package, and how many +// calls it read. +func measureFaults(rel string, srcs []string) (faults []string, calls int, err error) { + fset := token.NewFileSet() + var files []*ast.File + funcs := map[string]bool{} + for i, src := range srcs { + f, err := parser.ParseFile(fset, fmt.Sprintf("%s#%d", rel, i), src, 0) + if err != nil { + return nil, 0, err + } + files = append(files, f) + for _, decl := range f.Decls { + if fn, ok := decl.(*ast.FuncDecl); ok && fn.Recv == nil { + funcs[fn.Name.Name] = true + } + } + } + for _, f := range files { + inFormat := f.Name.Name == "format" + ast.Inspect(f, func(n ast.Node) bool { + call, ok := n.(*ast.CallExpr) + if !ok || len(call.Args) != 3 || !isMeasure(call.Fun, inFormat) { + return true + } + calls++ + if id, ok := call.Args[2].(*ast.Ident); !ok || !funcs[id.Name] { + faults = append(faults, fmt.Sprintf("%s: Measure at %s", rel, fset.Position(call.Pos()))) + } + return true + }) + } + return faults, calls, nil +} + +// isMeasure says fun names format.Measure, written from outside the package +// or from inside it. +func isMeasure(fun ast.Expr, inFormat bool) bool { + if idx, ok := fun.(*ast.IndexListExpr); ok { + fun = idx.X + } + if idx, ok := fun.(*ast.IndexExpr); ok { + fun = idx.X + } + switch f := fun.(type) { + case *ast.SelectorExpr: + pkg, ok := f.X.(*ast.Ident) + return ok && pkg.Name == "format" && f.Sel.Name == "Measure" + case *ast.Ident: + return inFormat && f.Name == "Measure" + } + return false +} diff --git a/internal/guard/symlinkescape_test.go b/internal/guard/symlinkescape_test.go index dafae1b3..4350bf96 100644 --- a/internal/guard/symlinkescape_test.go +++ b/internal/guard/symlinkescape_test.go @@ -295,6 +295,7 @@ func TestADirectoryReachedThroughALinkStillWorks(t *testing.T) { } linked := filepath.Join(root, "linked") plantLink(t, real, linked) + requireNewNamesThroughLink(t, linked) // Generate through the link, then verify and clean up through it. Every // path involved resolves inside, so all three have to behave normally. diff --git a/internal/guard/testdata/screens/about.png b/internal/guard/testdata/screens/about.png index aa67c41e..dd92f4f2 100644 Binary files a/internal/guard/testdata/screens/about.png and b/internal/guard/testdata/screens/about.png differ diff --git a/internal/guard/testdata/screens/about.xml b/internal/guard/testdata/screens/about.xml index d7bf5c39..18ecf231 100644 --- a/internal/guard/testdata/screens/about.xml +++ b/internal/guard/testdata/screens/about.xml @@ -47,7 +47,7 @@ - Testing Files Generator 0.5.0 + Testing Files Generator 0.6.0-rc1 diff --git a/internal/guard/titlebar_test.go b/internal/guard/titlebar_test.go new file mode 100644 index 00000000..9be3ffc7 --- /dev/null +++ b/internal/guard/titlebar_test.go @@ -0,0 +1,107 @@ +package guard + +import ( + "testing" + + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/test" + + "github.com/donislawdev/TestingFilesGenerator/internal/gui" + "github.com/donislawdev/TestingFilesGenerator/internal/gui/parts" +) + +// The title bar is asked for dark again after every change of settings, for +// the window it belongs to, and the ask lands after the toolkit's own answer. +// +// The toolkit answers each change by setting the title bar from the desktop's +// mode for apps, so a bar darkened once at start turns white again the first +// time somebody switches the desktop's mode with the window open (O360). Its +// listener is added when the loop starts (fyne v2.8.2, internal/driver/glfw, +// runGL), after the one KeepTitleBarDark adds, so an ask made straight from +// our listener is the one overwritten. The test driver runs fyne.Do at once, +// so this guard holds it back the way the loop does, until every listener of +// the change has run. +// +// The canary is that ask made straight from the listener: under the same two +// changes it has to leave the bar light. +func TestTheTitleBarIsAskedForAgainAfterEveryChangeOfSettings(t *testing.T) { + straight := func(s fyne.Settings, w fyne.Window, darken func(fyne.Window) bool) { + s.AddListener(func(fyne.Settings) { darken(w) }) + } + if _, asked, dark := titleBarAfterTwoChanges(t, straight); dark { + t.Fatalf("canary: an ask made straight from the listener left the bar dark after %d ask(s), "+ + "so the toolkit's answer was not the last word here and this guard cannot see the order", len(asked)) + } + + w, asked, dark := titleBarAfterTwoChanges(t, gui.KeepTitleBarDark) + if len(asked) != 2 || asked[0] != w || asked[1] != w { + t.Errorf("two changes of settings asked for the title bar %d time(s), of %v.\n"+ + "What to do: KeepTitleBarDark has to ask again after every change, because the toolkit "+ + "sets the bar from the desktop's mode on each of them.", len(asked), asked) + } + if !dark { + t.Error("the toolkit's answer to a change came after the ask, so the bar ended light.\n" + + "What to do: KeepTitleBarDark has to ask through fyne.Do, which the loop runs once every " + + "listener of the change, the toolkit's among them, has run.") + } + // A window of the toolkit's test driver has no native handle, and is left + // alone rather than asked about - on every system. + if gui.DarkTitleBar(w) { + t.Error("a window with no native handle answered that its title bar is dark") + } +} + +// titleBarAfterTwoChanges has keep look after a window, adds the toolkit's +// answer after it, as the loop does, and changes the settings twice, each +// followed by the work fyne.Do queued. It says the window, every ask, and +// whether the bar ended dark. Nothing may be asked before the first change. +func titleBarAfterTwoChanges(t *testing.T, keep func(fyne.Settings, fyne.Window, func(fyne.Window) bool)) ( + w fyne.Window, asked []fyne.Window, dark bool) { + t.Helper() + a := newTempTestApp(t) + w = test.NewTempWindow(t, nil) + loop := &heldDriver{Driver: a.Driver()} + // Put back by the clean-up of the application, which makes a new one. + fyne.SetCurrentApp(heldApp{App: a, driver: loop}) + keep(a.Settings(), w, func(x fyne.Window) bool { + asked = append(asked, x) + dark = true + return true + }) + // The toolkit's answer: the desktop's mode for apps, light here. + a.Settings().AddListener(func(fyne.Settings) { dark = false }) + if len(asked) != 0 { + t.Fatalf("the title bar was asked for %d time(s) before anything changed", len(asked)) + } + for range 2 { + a.Settings().SetTheme(parts.Theme()) + loop.drain() + } + return w, asked, dark +} + +// heldDriver is the test driver with fyne.Do held back until drain, as the +// toolkit's loop holds it until the work in hand is done. +type heldDriver struct { + fyne.Driver + queued []func() +} + +func (d *heldDriver) DoFromGoroutine(fn func(), _ bool) { d.queued = append(d.queued, fn) } + +func (d *heldDriver) drain() { + for len(d.queued) > 0 { + fn := d.queued[0] + d.queued = d.queued[1:] + fn() + } +} + +// heldApp is the test application handing out heldDriver, the driver fyne.Do +// asks the current application for. +type heldApp struct { + fyne.App + driver *heldDriver +} + +func (a heldApp) Driver() fyne.Driver { return a.driver } diff --git a/internal/guard/titlebar_windows_test.go b/internal/guard/titlebar_windows_test.go new file mode 100644 index 00000000..6fab88d3 --- /dev/null +++ b/internal/guard/titlebar_windows_test.go @@ -0,0 +1,62 @@ +//go:build windows + +package guard + +import ( + "syscall" + "testing" + "unsafe" + + "github.com/donislawdev/TestingFilesGenerator/internal/gui" +) + +// hiddenWindow is a top-level window of the system's own STATIC class that is +// never shown: no WS_VISIBLE, so nothing appears on the screen and nothing +// takes the keyboard while the guard asks Windows about its title bar. +func hiddenWindow(t *testing.T) uintptr { + t.Helper() + // user32.dll is a KnownDLL, so its name is safe to load by. + user32 := syscall.NewLazyDLL("user32.dll") + create := user32.NewProc("CreateWindowExW") + destroy := user32.NewProc("DestroyWindow") + class, err := syscall.UTF16PtrFromString("STATIC") + if err != nil { + t.Fatal(err) + } + const overlappedWindow = 0x00CF0000 // WS_OVERLAPPEDWINDOW, without WS_VISIBLE + hwnd, _, callErr := create.Call(0, uintptr(unsafe.Pointer(class)), 0, overlappedWindow, 0, 0, 200, 100, 0, 0, 0, 0) + if hwnd == 0 { + t.Fatalf("CreateWindowExW made no window: %v", callErr) + } + t.Cleanup(func() { _, _, _ = destroy.Call(hwnd) }) + return hwnd +} + +// Windows holds the title bar of a real window dark once the program asks. +// +// What is checked is what Windows keeps, read back with +// DwmGetWindowAttribute, and the reading is first made to say no: a window +// nobody asked about has to read as not dark, so a reading that always says +// yes cannot pass. A window of none is refused rather than crashed on. What the +// bar then looks like on a desktop set to light apps needs a window on a +// screen: measured on Windows Server 2025 on 2026-11-18, the caption went from +// (243, 243, 243) to dark (docs/TITLEBAR-DARK-2026-11-18.md). +func TestWindowsHoldsTheTitleBarDarkOnceAsked(t *testing.T) { + hwnd := hiddenWindow(t) + if gui.TitleBarHeldDark(hwnd) { + t.Fatal("a window nobody asked about reads as having a dark title bar, " + + "so the reading below would prove nothing") + } + if !gui.DarkenTitleBar(hwnd) { + t.Error("Windows did not hold the title bar of a real window dark after the program asked.\n" + + "Either dwmapi.dll would not load from the system directory, a call is missing, or this " + + "Windows does not know DWMWA_USE_IMMERSIVE_DARK_MODE (20). The window still works, with a " + + "title bar that follows the desktop's mode for apps.") + } + if !gui.TitleBarHeldDark(hwnd) { + t.Error("asked and answered dark, but a second reading says the title bar is not dark") + } + if gui.DarkenTitleBar(0) { + t.Error("no window at all answered that its title bar is dark - the call is not reaching Windows") + } +} diff --git a/internal/gui/darkmenus_windows.go b/internal/gui/darkmenus_windows.go index cc8377c6..1604ff20 100644 --- a/internal/gui/darkmenus_windows.go +++ b/internal/gui/darkmenus_windows.go @@ -16,9 +16,9 @@ import ( // theme against a dark application. // // That menu is drawn by Windows and not by us, and the attribute that darkens a -// title bar does not reach it. Fyne already sets DWMWA_USE_IMMERSIVE_DARK_MODE -// on the window - measured in the toolkit source at v2.8.0 - and that covers the -// caption and its buttons and nothing else. Menus, standard dialogs and +// title bar does not reach it. DWMWA_USE_IMMERSIVE_DARK_MODE covers the caption +// and its buttons and nothing else - titlebar_windows.go sets it, because the +// toolkit sets it only when the desktop is dark. Menus, standard dialogs and // scrollbars follow a separate, process wide setting. // // That setting is SetPreferredAppMode in uxtheme.dll, and three things about it @@ -41,7 +41,8 @@ import ( // set to, and a white menu is the one place that decision visibly breaks. // // ForceDark rather than AllowDark, and the difference matters here. AllowDark -// follows the desktop, which is what Fyne already does for the title bar. +// follows the desktop, which is what the toolkit does for the title bar on its +// own and why titlebar_windows.go exists. // ForceDark is dark regardless, which is what this program is. const ( uxthemeSetPreferredAppMode = 135 diff --git a/internal/gui/icon/chickpea.rc b/internal/gui/icon/chickpea.rc index f92937a7..842b3aaf 100644 --- a/internal/gui/icon/chickpea.rc +++ b/internal/gui/icon/chickpea.rc @@ -38,8 +38,8 @@ * the fourth number of FILEVERSION is a zero rather than a build counter. */ 1 VERSIONINFO -FILEVERSION 0,5,0,0 -PRODUCTVERSION 0,5,0,0 +FILEVERSION 0,6,0,0 +PRODUCTVERSION 0,6,0,0 FILEOS 0x40004L FILETYPE 0x1L BEGIN @@ -49,12 +49,12 @@ BEGIN BEGIN VALUE "CompanyName", "DonislawDev" VALUE "FileDescription", "Generates test files for QA" - VALUE "FileVersion", "0.5.0" + VALUE "FileVersion", "0.6.0-rc1" VALUE "InternalName", "tfg-gui" VALUE "LegalCopyright", "Copyright (C) 2026 DonislawDev. GNU GPL version 3." VALUE "OriginalFilename", "tfg-gui.exe" VALUE "ProductName", "Testing Files Generator" - VALUE "ProductVersion", "0.5.0" + VALUE "ProductVersion", "0.6.0-rc1" END END BLOCK "VarFileInfo" diff --git a/internal/gui/parts/property.go b/internal/gui/parts/property.go index b48742d0..76df7042 100644 --- a/internal/gui/parts/property.go +++ b/internal/gui/parts/property.go @@ -456,9 +456,9 @@ func Allowed(p format.Property) string { what := allowedKind(p) switch { case p.Default != "" && what == "": - return text.AllowedDefault(p.Default) + return text.AllowedDefault(core.Literal(p.Default)) case p.Default != "": - return text.AllowedWithDefault(what, p.Default) + return text.AllowedWithDefault(what, core.Literal(p.Default)) } return what } @@ -469,7 +469,7 @@ func allowedKind(p format.Property) string { case format.PropertyInt: return allowedNumber(p) case format.PropertyChoice: - return text.AllowedOneOf(p.Choices) + return text.AllowedOneOf(core.LiteralEach(p.Choices)) case format.PropertyBool: return text.AllowedTrueOrFalse() case format.PropertySize: diff --git a/internal/gui/run_cgo.go b/internal/gui/run_cgo.go index ea07739f..a342085d 100644 --- a/internal/gui/run_cgo.go +++ b/internal/gui/run_cgo.go @@ -486,8 +486,9 @@ func run(launch Launch, errOut io.Writer) int { // standard error for whatever started this, and to a system dialog for // the person, because the window that would have carried it is what // failed - and it says what became of the renderer, when there is - // something to say. - code := OpenOrRefuse(w, a.Run, SecondAttemptFor(launch, errOut).Try, func(why error) { + // something to say. Run with the title bar dark, as the window under it + // always is - see RunDark. + code := OpenOrRefuse(w, RunDark(a, w), SecondAttemptFor(launch, errOut).Try, func(why error) { sentence := text.WindowRefused(CauseFrom(said.String())) fmt.Fprintln(errOut, sentence) body := sentence diff --git a/internal/gui/text/locale/en.json b/internal/gui/text/locale/en.json index df6821a0..6fb8e50a 100644 --- a/internal/gui/text/locale/en.json +++ b/internal/gui/text/locale/en.json @@ -16,13 +16,13 @@ }, "AllowedDuration": { "description": "The start of the sentence under a setting a format, a preset or a damage declares, saying what it takes. The values in it - true, 2mb, the numbers, the default, the names a recipe writes - stay as they are.", - "hash": "sha256-ae5b83872964", - "other": "a length of time such as 10s, 1m30s or 500ms" + "hash": "sha256-3d499c646dc1", + "other": "a length of time such as `10s`, `1m30s` or `500ms`" }, "AllowedDurationRange": { "description": "The start of the sentence under a setting a format, a preset or a damage declares, saying what it takes. The values in it - true, 2mb, the numbers, the default, the names a recipe writes - stay as they are. Carries these values, each of which has to stay spelled exactly that way: {{.Min}}, {{.Max}}.", - "hash": "sha256-7d64ac4c82ed", - "other": "a length of time from {{.Min}} to {{.Max}}, such as 10s, 1m30s or 500ms" + "hash": "sha256-bffa5ba42d17", + "other": "a length of time from {{.Min}} to {{.Max}}, such as `10s`, `1m30s` or `500ms`" }, "AllowedJointly": { "description": "A note under two settings of a format whose product has a ceiling. Of and By are the names a recipe writes and stay as they are. Carries these values, each of which has to stay spelled exactly that way: {{.Of}}, {{.By}}, {{.Max}}, {{.Unit}}, {{.Why}}.", @@ -46,13 +46,13 @@ }, "AllowedSize": { "description": "The start of the sentence under a setting a format, a preset or a damage declares, saying what it takes. The values in it - true, 2mb, the numbers, the default, the names a recipe writes - stay as they are.", - "hash": "sha256-ab006a92eb28", - "other": "a size such as 2mb, or a plain byte count" + "hash": "sha256-20e71c04e4c6", + "other": "a size such as `2mb`, or a plain byte count" }, "AllowedTrueOrFalse": { "description": "The start of the sentence under a setting a format, a preset or a damage declares, saying what it takes. The values in it - true, 2mb, the numbers, the default, the names a recipe writes - stay as they are.", - "hash": "sha256-ed50d4017aaf", - "other": "true or false" + "hash": "sha256-bc1d239f7000", + "other": "`true` or `false`" }, "AllowedWholeNumber": { "description": "The start of the sentence under a setting a format, a preset or a damage declares, saying what it takes. The values in it - true, 2mb, the numbers, the default, the names a recipe writes - stay as they are.", diff --git a/internal/gui/text/locale/pl.json b/internal/gui/text/locale/pl.json index 7b5eb2e0..467c5b53 100644 --- a/internal/gui/text/locale/pl.json +++ b/internal/gui/text/locale/pl.json @@ -2,14 +2,14 @@ "AboutLicenceBinds": { "hash": "sha256-e3b0c44298fc", "other": "To tłumaczenie jest informacyjne. Wiążący jest angielski tekst powyższej informacji i licencji GNU GPL." }, "AboutTagline": { "hash": "sha256-3677496ffba0", "other": "Generuj pliki testowe i wiedz, jak system pod testem powinien na nie zareagować." }, "AllowedDefault": { "hash": "sha256-22ad56774302", "other": "domyślnie {{.Default}}" }, - "AllowedDuration": { "hash": "sha256-ae5b83872964", "other": "czas trwania, na przykład 10s, 1m30s albo 500ms" }, - "AllowedDurationRange": { "hash": "sha256-7d64ac4c82ed", "other": "czas trwania od {{.Min}} do {{.Max}}, na przykład 10s, 1m30s albo 500ms" }, + "AllowedDuration": { "hash": "sha256-3d499c646dc1", "other": "czas trwania, na przykład `10s`, `1m30s` albo `500ms`" }, + "AllowedDurationRange": { "hash": "sha256-bffa5ba42d17", "other": "czas trwania od {{.Min}} do {{.Max}}, na przykład `10s`, `1m30s` albo `500ms`" }, "AllowedJointly": { "hash": "sha256-890007fb5262", "other": "{{.Of}} razy {{.By}} nie może przekroczyć {{.Max}} {{.Unit}}, bo {{.Why}}" }, "AllowedOneOf": { "hash": "sha256-96a180377b5d", "other": "jedna z wartości: {{.Values}}" }, "AllowedRange": { "hash": "sha256-430416192be6", "other": "liczba całkowita od {{.Min}} do {{.Max}}" }, "AllowedRangeOf": { "hash": "sha256-f52248fe6440", "other": "liczba {{.Unit}} od {{.Min}} do {{.Max}}" }, - "AllowedSize": { "hash": "sha256-ab006a92eb28", "other": "rozmiar, na przykład 2mb, albo sama liczba bajtów" }, - "AllowedTrueOrFalse": { "hash": "sha256-ed50d4017aaf", "other": "true albo false" }, + "AllowedSize": { "hash": "sha256-20e71c04e4c6", "other": "rozmiar, na przykład `2mb`, albo sama liczba bajtów" }, + "AllowedTrueOrFalse": { "hash": "sha256-bc1d239f7000", "other": "`true` albo `false`" }, "AllowedWholeNumber": { "hash": "sha256-24c327302769", "other": "liczba całkowita" }, "AllowedWholeNumberOf": { "hash": "sha256-3d353f1038c7", "other": "liczba {{.Unit}}" }, "AllowedWithDefault": { "hash": "sha256-a8076abaa30c", "other": "{{.What}}, domyślnie {{.Default}}" }, diff --git a/internal/gui/text/locale/registry/en.json b/internal/gui/text/locale/registry/en.json index 325b1fa0..a4e2b180 100644 --- a/internal/gui/text/locale/registry/en.json +++ b/internal/gui/text/locale/registry/en.json @@ -3319,25 +3319,25 @@ "hash": "sha256-62cb052ebc94", "other": "a checksum in hexadecimal" }, - "Shape.a colour such as cccccc or ccc": { + "Shape.a colour such as `cccccc` or `ccc`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-dacfc70e2e23", - "other": "a colour such as cccccc or ccc" + "hash": "sha256-6d6baef1ee53", + "other": "a colour such as `cccccc` or `ccc`" }, - "Shape.a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": { + "Shape.a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-a40bd1decdc9", - "other": "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none" + "hash": "sha256-d8f0b52f069d", + "other": "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`" }, - "Shape.a moment in UTC such as 2026-08-01T12:00:00Z": { + "Shape.a moment in UTC such as `2026-08-01T12:00:00Z`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-97f0219d13b4", - "other": "a moment in UTC such as 2026-08-01T12:00:00Z" + "hash": "sha256-55d08f72c053", + "other": "a moment in UTC such as `2026-08-01T12:00:00Z`" }, - "Shape.algorithm names separated by commas, or all": { + "Shape.algorithm names separated by commas, or `all`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-bba80a8dec88", - "other": "algorithm names separated by commas, or all" + "hash": "sha256-33a9134780e7", + "other": "algorithm names separated by commas, or `all`" }, "Shape.any text": { "description": "What the text in a box has to look like, in the sentence under it.", @@ -3354,15 +3354,15 @@ "hash": "sha256-cc1ca5dd954c", "other": "format ids separated by commas" }, - "Shape.format ids separated by commas, or all": { + "Shape.format ids separated by commas, or `all`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-48e97c935e5d", - "other": "format ids separated by commas, or all" + "hash": "sha256-d69f4fe98ba2", + "other": "format ids separated by commas, or `all`" }, - "Shape.group names separated by commas, or all": { + "Shape.group names separated by commas, or `all`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-68f92ad5bd2b", - "other": "group names separated by commas, or all" + "hash": "sha256-d3b510e50dba", + "other": "group names separated by commas, or `all`" }, "Shape.one line of up to 100 characters": { "description": "What the text in a box has to look like, in the sentence under it.", @@ -3374,15 +3374,15 @@ "hash": "sha256-f7e5e8c54e6f", "other": "sizes separated by commas" }, - "Shape.the id of a format, such as png or csv": { + "Shape.the id of a format, such as `png` or `csv`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-776e6545e346", - "other": "the id of a format, such as png or csv" + "hash": "sha256-24b6f15cf215", + "other": "the id of a format, such as `png` or `csv`" }, - "Shape.the id of a picture format, such as png or jpg": { + "Shape.the id of a picture format, such as `png` or `jpg`": { "description": "What the text in a box has to look like, in the sentence under it.", - "hash": "sha256-ea19ea70a8b7", - "other": "the id of a picture format, such as png or jpg" + "hash": "sha256-47e2c15131f6", + "other": "the id of a picture format, such as `png` or `jpg`" }, "Shape.the password, in plain text": { "description": "What the text in a box has to look like, in the sentence under it.", diff --git a/internal/gui/text/locale/registry/pl.json b/internal/gui/text/locale/registry/pl.json index afb55f0d..89c99cfa 100644 --- a/internal/gui/text/locale/registry/pl.json +++ b/internal/gui/text/locale/registry/pl.json @@ -663,19 +663,19 @@ "Question.text-encoding": { "hash": "sha256-766ce93a4d3c", "other": "Czy mój czytnik wie, w jakim kodowaniu jest plik, czy zgaduje?" }, "Question.upload-validation": { "hash": "sha256-950469ca4b3a", "other": "Czy mój formularz przesyłania plików przyjmuje to, co powinien, i odrzuca resztę?" }, "Shape.a checksum in hexadecimal": { "hash": "sha256-62cb052ebc94", "other": "suma kontrolna zapisana szesnastkowo" }, - "Shape.a colour such as cccccc or ccc": { "hash": "sha256-dacfc70e2e23", "other": "kolor, na przykład cccccc albo ccc" }, - "Shape.a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": { "hash": "sha256-a40bd1decdc9", "other": "data, np. 2024-02-29 albo 2024-02-29T13:45:00+02:00, albo none" }, - "Shape.a moment in UTC such as 2026-08-01T12:00:00Z": { "hash": "sha256-97f0219d13b4", "other": "chwila w UTC, np. 2026-08-01T12:00:00Z" }, - "Shape.algorithm names separated by commas, or all": { "hash": "sha256-bba80a8dec88", "other": "nazwy algorytmów rozdzielone przecinkami albo all" }, + "Shape.a colour such as `cccccc` or `ccc`": { "hash": "sha256-6d6baef1ee53", "other": "kolor, na przykład `cccccc` albo `ccc`" }, + "Shape.a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": { "hash": "sha256-d8f0b52f069d", "other": "data, np. `2024-02-29` albo `2024-02-29T13:45:00+02:00`, albo `none`" }, + "Shape.a moment in UTC such as `2026-08-01T12:00:00Z`": { "hash": "sha256-55d08f72c053", "other": "chwila w UTC, np. `2026-08-01T12:00:00Z`" }, + "Shape.algorithm names separated by commas, or `all`": { "hash": "sha256-33a9134780e7", "other": "nazwy algorytmów rozdzielone przecinkami albo `all`" }, "Shape.any text": { "hash": "sha256-06c83efcd22e", "other": "dowolny tekst" }, "Shape.extensions separated by commas": { "hash": "sha256-69f0be0e37e3", "other": "rozszerzenia rozdzielone przecinkami" }, "Shape.format ids separated by commas": { "hash": "sha256-cc1ca5dd954c", "other": "identyfikatory formatów rozdzielone przecinkami" }, - "Shape.format ids separated by commas, or all": { "hash": "sha256-48e97c935e5d", "other": "identyfikatory formatów rozdzielone przecinkami albo all" }, - "Shape.group names separated by commas, or all": { "hash": "sha256-68f92ad5bd2b", "other": "nazwy grup rozdzielone przecinkami albo all" }, + "Shape.format ids separated by commas, or `all`": { "hash": "sha256-d69f4fe98ba2", "other": "identyfikatory formatów rozdzielone przecinkami albo `all`" }, + "Shape.group names separated by commas, or `all`": { "hash": "sha256-d3b510e50dba", "other": "nazwy grup rozdzielone przecinkami albo `all`" }, "Shape.one line of up to 100 characters": { "hash": "sha256-4a7c0c62ca18", "other": "jeden wiersz do 100 znaków" }, "Shape.sizes separated by commas": { "hash": "sha256-f7e5e8c54e6f", "other": "rozmiary rozdzielone przecinkami" }, - "Shape.the id of a format, such as png or csv": { "hash": "sha256-776e6545e346", "other": "identyfikator formatu, na przykład png albo csv" }, - "Shape.the id of a picture format, such as png or jpg": { "hash": "sha256-ea19ea70a8b7", "other": "identyfikator formatu obrazka, na przykład png albo jpg" }, + "Shape.the id of a format, such as `png` or `csv`": { "hash": "sha256-24b6f15cf215", "other": "identyfikator formatu, na przykład `png` albo `csv`" }, + "Shape.the id of a picture format, such as `png` or `jpg`": { "hash": "sha256-47e2c15131f6", "other": "identyfikator formatu obrazka, na przykład `png` albo `jpg`" }, "Shape.the password, in plain text": { "hash": "sha256-eb266034b6a8", "other": "hasło, zwykłym tekstem" }, "Title.empty-and-minimal": { "hash": "sha256-4cdca50e33b5", "other": "Pliki puste i minimalne" }, "Title.filename-handling": { "hash": "sha256-314f9b08db3f", "other": "Obsługa nazw plików" }, diff --git a/internal/gui/text/screens.go b/internal/gui/text/screens.go index 1625951b..a0d3e759 100644 --- a/internal/gui/text/screens.go +++ b/internal/gui/text/screens.go @@ -410,7 +410,9 @@ func SettingsFor(formatID string) string { // What a setting takes, in the window's language - format.Property.Allowed put // together from these rather than read whole, because that sentence is English // and the command line prints it (D9). The values in it - true, 2mb, the -// default, the numbers - are what a recipe writes, and stay as they are. +// default, the numbers - are what a recipe writes, and stay as they are. The +// ones a person types stand between backticks, as in Property.Allowed: the +// examples here, the choices and the default in what the caller hands in. // // A guard puts every declared setting through both and asks for the same // English to the letter, so the window and tfg formats cannot come to describe @@ -430,7 +432,7 @@ func AllowedRangeOf(unit string, least, most int64) string { func AllowedOneOf(values []string) string { return sayf("AllowedOneOf", "one of: {{.Values}}", map[string]any{"Values": strings.Join(values, ", ")}) } -func AllowedTrueOrFalse() string { return say("AllowedTrueOrFalse", "true or false") } +func AllowedTrueOrFalse() string { return say("AllowedTrueOrFalse", "`true` or `false`") } // SwitchState is the state of a switch in words, for the places the window // says it rather than draws it: the line a folded section shows, and the @@ -443,13 +445,13 @@ func SwitchState(on bool) string { return say("SwitchOff", "off") } func AllowedSize() string { - return say("AllowedSize", "a size such as 2mb, or a plain byte count") + return say("AllowedSize", "a size such as `2mb`, or a plain byte count") } func AllowedDuration() string { - return say("AllowedDuration", "a length of time such as 10s, 1m30s or 500ms") + return say("AllowedDuration", "a length of time such as `10s`, `1m30s` or `500ms`") } func AllowedDurationRange(least, most string) string { - return sayf("AllowedDurationRange", "a length of time from {{.Min}} to {{.Max}}, such as 10s, 1m30s or 500ms", + return sayf("AllowedDurationRange", "a length of time from {{.Min}} to {{.Max}}, such as `10s`, `1m30s` or `500ms`", map[string]any{"Min": least, "Max": most}) } func AllowedDefault(value string) string { diff --git a/internal/gui/titlebar.go b/internal/gui/titlebar.go new file mode 100644 index 00000000..8295e2e2 --- /dev/null +++ b/internal/gui/titlebar.go @@ -0,0 +1,28 @@ +package gui + +import "fyne.io/fyne/v2" + +// KeepTitleBarDark asks for the title bar of w dark again after every change +// of the settings s. +// +// The toolkit answers every change of settings by setting the title bar from +// the desktop's mode for apps (fyne v2.8.2, internal/driver/glfw/loop.go, +// applyThemeToWindow), so a dark bar asked for once turns white again the +// first time the desktop's mode or the scale changes. Through fyne.Do, which +// on the toolkit's loop queues the call behind the change being handled, so +// it lands after the toolkit's own answer whichever listener was added first +// (O360, docs/TITLEBAR-DARK-2026-11-18.md). +func KeepTitleBarDark(s fyne.Settings, w fyne.Window, darken func(fyne.Window) bool) { + s.AddListener(func(fyne.Settings) { fyne.Do(func() { darken(w) }) }) +} + +// RunDark is run for a window that is kept dark: the title bar asked for once +// the window is shown and so has one, right before the loop starts, and again +// after every change of settings. Handed to OpenOrRefuse in place of a.Run. +func RunDark(a fyne.App, w fyne.Window) func() { + KeepTitleBarDark(a.Settings(), w, DarkTitleBar) + return func() { + DarkTitleBar(w) + a.Run() + } +} diff --git a/internal/gui/titlebar_other.go b/internal/gui/titlebar_other.go new file mode 100644 index 00000000..88f35ab7 --- /dev/null +++ b/internal/gui/titlebar_other.go @@ -0,0 +1,13 @@ +//go:build !windows + +package gui + +import "fyne.io/fyne/v2" + +// DarkTitleBar leaves the title bar to the system away from Windows and says +// so - the owner's decision of 2026-11-18 (O360). macOS draws it in the +// appearance the system is set to. On Linux it is drawn by the window manager +// or by the client's decorations, and on GNOME 50 the window goes through +// XWayland, whose frames ignored a request for the dark variant - measured in +// docs/TITLEBAR-DARK-2026-11-18.md, section 9. +func DarkTitleBar(fyne.Window) bool { return false } diff --git a/internal/gui/titlebar_windows.go b/internal/gui/titlebar_windows.go new file mode 100644 index 00000000..32f6d4ab --- /dev/null +++ b/internal/gui/titlebar_windows.go @@ -0,0 +1,105 @@ +//go:build windows + +package gui + +import ( + "syscall" + "unsafe" + + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/driver" +) + +// Asking Windows to draw the title bar dark, as the window under it always is. +// +// Reported by the owner on 2026-11-18 (O360): on a Windows set to light apps +// the window is dark and its title bar white. The toolkit sets the same +// attribute itself, from the desktop's mode for apps - dark only when +// AppsUseLightTheme is 0 (fyne v2.8.2, internal/driver/glfw/window_windows.go, +// setDarkMode and isDark) - when it creates the window and after every change +// of settings. So this is asked once the window is shown and again after each +// change, KeepTitleBarDark. +// +// Measured on Windows Server 2025 with light apps, on 2026-11-18: before this, +// the attribute 0 and the caption (243, 243, 243), the same as Notepad's. +// +// DWMWA_USE_IMMERSIVE_DARK_MODE, a BOOL - four bytes. Microsoft documents it +// from Windows 11 build 22000, Windows 10 takes it from 20H1, and an older +// Windows answers an error and keeps its bar - where this program was before +// any of this existed. +const dwmUseImmersiveDarkMode = 20 + +// DarkTitleBar asks Windows to draw the title bar of w dark and says whether +// Windows now holds it so. A window with no native handle - not created yet, +// or one of the toolkit's test driver - is left alone and answers false. +func DarkTitleBar(w fyne.Window) bool { + native, ok := w.(driver.NativeWindow) + if !ok { + return false + } + dark := false + native.RunNative(func(context any) { + if c, ok := context.(driver.WindowsWindowContext); ok { + dark = DarkenTitleBar(c.HWND) + } + }) + return dark +} + +// DarkenTitleBar sets the attribute on the window behind hwnd, then reads it +// back, and says whether Windows holds it set. The read is the answer rather +// than the set call's success, because what matters is what Windows keeps. +// +// Exported so a guard can ask it of a real window of its own: the title bar +// is drawn by Windows, outside anything a picture of the canvas can reach. +func DarkenTitleBar(hwnd uintptr) bool { + on := int32(1) + set := withDwm(hwnd, "DwmSetWindowAttribute", func(set *syscall.Proc) bool { + r, _, _ := set.Call(hwnd, dwmUseImmersiveDarkMode, uintptr(unsafe.Pointer(&on)), unsafe.Sizeof(on)) + return r == 0 + }) + return set && TitleBarHeldDark(hwnd) +} + +// TitleBarHeldDark says whether Windows holds the title bar of the window +// behind hwnd dark. False when it cannot be asked, so a guard can demand both +// answers of it: false for a window nobody asked, true once asked. +func TitleBarHeldDark(hwnd uintptr) bool { + held := int32(0) + read := withDwm(hwnd, "DwmGetWindowAttribute", func(get *syscall.Proc) bool { + r, _, _ := get.Call(hwnd, dwmUseImmersiveDarkMode, uintptr(unsafe.Pointer(&held)), unsafe.Sizeof(held)) + return r == 0 + }) + return read && held == 1 +} + +// withDwm finds call in dwmapi.dll, hands it to use, and gives the library +// back. False for a window of none, or when the library or the call is +// missing. +// +// dwmapi.dll by an absolute path under the system directory, for the reason +// darkmenus_windows.go gives for uxtheme.dll: it is not a KnownDLL either (37 +// entries, measured 2026-11-18), so a name would be looked for beside the +// program first. Loaded for each call and released after it rather than kept: +// the toolkit holds the same library for as long as the window is open, so +// this moves a count up and down, and a library kept for the process would +// need a guard against two first calls at once. +func withDwm(hwnd uintptr, call string, use func(*syscall.Proc) bool) bool { + if hwnd == 0 { + return false + } + path, err := systemLibraryPath("dwmapi.dll") + if err != nil { + return false + } + lib, err := syscall.LoadDLL(path) + if err != nil { + return false + } + defer func() { _ = lib.Release() }() + proc, err := lib.FindProc(call) + if err != nil { + return false + } + return use(proc) +} diff --git a/internal/preset/emptyandminimal.go b/internal/preset/emptyandminimal.go index 4477cfb2..578f5b42 100644 --- a/internal/preset/emptyandminimal.go +++ b/internal/preset/emptyandminimal.go @@ -40,7 +40,7 @@ func init() { Parameters: []format.Property{ { Name: "formats", Kind: format.PropertyText, - Shape: "format ids separated by commas, or all", + Shape: "format ids separated by commas, or `all`", Default: everyFormat, Detail: "Which formats the set is built from. Leave it at `all` for every format " + "this build has, or name the ones your system accepts.", diff --git a/internal/preset/picturesizes.go b/internal/preset/picturesizes.go index 9a587f64..d168891e 100644 --- a/internal/preset/picturesizes.go +++ b/internal/preset/picturesizes.go @@ -56,7 +56,7 @@ func init() { Parameters: []format.Property{ { Name: "groups", Kind: format.PropertyText, - Shape: "group names separated by commas, or all", + Shape: "group names separated by commas, or `all`", Default: everyGroup, Detail: "Which sizes the set holds: `screens` for the sizes of screens, `avatars` for profile pictures " + "and `social` for covers, banners, posts and thumbnails. Leave it at `all` for every one of them.", diff --git a/internal/site/presets.go b/internal/site/presets.go index ee940575..c2cf14a3 100644 --- a/internal/site/presets.go +++ b/internal/site/presets.go @@ -182,8 +182,10 @@ type PresetPage struct { // SettingRow is one line of the settings table. type SettingRow struct { - Flag string - Takes string + Flag string + // Takes is what the setting accepts, with every value to type in + // (withCode), as Detail. + Takes template.HTML Default string // Detail is the sentence about the setting, with every value to type in // (withCode). @@ -288,7 +290,7 @@ func (v view) settingRows(f PresetFacts, text PresetText) ([]SettingRow, error) if !ok { return nil, fmt.Errorf("the setting --%s of the preset %q has no sentence written in %s", s.Name, f.ID, v.Lang.Code) } - out = append(out, SettingRow{Flag: s.Name, Takes: takes, Default: s.Default, Detail: withCode(detail), Placeholder: s.Placeholder}) + out = append(out, SettingRow{Flag: s.Name, Takes: withCode(takes), Default: s.Default, Detail: withCode(detail), Placeholder: s.Placeholder}) } for _, r := range f.Reads { takes, err := v.Word("readTakes." + r.Name) @@ -299,7 +301,7 @@ func (v view) settingRows(f PresetFacts, text PresetText) ([]SettingRow, error) if err != nil { return nil, err } - out = append(out, SettingRow{Flag: r.Name, Takes: takes, Default: r.Default, Detail: withCode(detail)}) + out = append(out, SettingRow{Flag: r.Name, Takes: withCode(takes), Default: r.Default, Detail: withCode(detail)}) } return out, nil } diff --git a/internal/site/view.go b/internal/site/view.go index e5784de6..19502681 100644 --- a/internal/site/view.go +++ b/internal/site/view.go @@ -210,10 +210,18 @@ func (v view) DamageList() ([]DamageRow, error) { // The numbers come from the registry and the words from the language file. A // kind or a unit the language has no word for is an error rather than a gap, // which is what stops an English noun appearing on a Polish page. +// +// A value to type stands between backticks, as tfg formats prints it - each +// choice here, and the examples a language file writes into a term - and the +// page shows it as code (withCode). func (v view) AllowedOf(p Property) (string, error) { switch p.Kind { case "choice": - return strings.Join(p.Choices, ", "), nil + marked := make([]string, len(p.Choices)) + for i, c := range p.Choices { + marked[i] = "`" + c + "`" + } + return strings.Join(marked, ", "), nil case "int": if p.Min == 0 && p.Max == 0 { return v.Term("int") diff --git a/internal/tool/checksum/checksum.go b/internal/tool/checksum/checksum.go index 067b42ce..74adaad4 100644 --- a/internal/tool/checksum/checksum.go +++ b/internal/tool/checksum/checksum.go @@ -84,7 +84,7 @@ func init() { Settings: []format.Property{ { Name: SettingAlgorithm, Kind: format.PropertyText, Default: "sha256", - Shape: "algorithm names separated by commas, or all", + Shape: "algorithm names separated by commas, or `all`", Detail: "Which checksums to work out: md5, sha1, sha256, sha512 or crc32. " + "Only sha256 and sha512 still show that nobody changed the file on purpose. " + "crc32 is the one ZIP and PNG use, not the one cksum prints.", diff --git a/internal/version/version.go b/internal/version/version.go index 8b57f5fd..571f00ff 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -8,8 +8,9 @@ package version // explain a hash mismatch after an upgrade. // // Set to 0.1.0 by the owner on 2026-08-02, raised to 0.2.0 on 2026-08-28, to -// 0.3.0-rc1 on 2026-09-03, to 0.3.0 on 2026-09-09, to 0.4.0 on 2026-09-25 and -// to 0.5.0 on 2026-10-20, every one of them by the owner. It stopped being an internal number the day 0.1.0 was published: this +// 0.3.0-rc1 on 2026-09-03, to 0.3.0 on 2026-09-09, to 0.4.0 on 2026-09-25, to +// 0.5.0 on 2026-10-20 and to 0.6.0-rc1 on 2026-11-18, every one of them by +// the owner. It stopped being an internal number the day 0.1.0 was published: this // is what somebody compares their build against when a hash they stored months // ago does not match. // @@ -34,6 +35,11 @@ package version // the 26 changed. The settings of html and eml that moved bytes on the way to // this release were never in one, so they are listed under Added. // +// 0.6.0-rc1 is a release candidate, and the owner put it out without the +// release check: what it moves is said under Breaking, and the comparison of +// every format with the published 0.5.0 is the check 0.6.0 itself goes +// through. +// // The absence of a suffix is a decision rather than tidying up. The release // workflow marks a release as a prerelease when the TAG NAME carries a hyphen, // which is what kept 0.3.0-rc1 off the front page and out of "latest" while it @@ -45,7 +51,7 @@ package version // anything. The entries that shipped as 0.3.0-rc1 were folded into the 0.3.0 // section on 2026-09-09 for the same reason the version has one place: someone // upgrading from 0.2.0 needs one list of what changed, not two. -const Version = "0.5.0" +const Version = "0.6.0-rc1" // LicenceNotice is what "tfg license" prints and what the window's about // screen shows. diff --git a/web/content/ar/site.json b/web/content/ar/site.json index fdaa9bc6..4fc97aef 100644 --- a/web/content/ar/site.json +++ b/web/content/ar/site.json @@ -267,9 +267,9 @@ "oracleNone": "غير منطبق", "int": "أي عدد صحيح", "choice": "واحد من مجموعة ثابتة", - "bool": "صحيح أو خاطئ", - "size": "حجم مثل 2mb", - "duration": "مدة مثل 10s", + "bool": "`true` أو `false`", + "size": "حجم مثل `2mb`", + "duration": "مدة مثل `10s`", "text": "نص", "pixels": "بكسل", "paragraphs": "فقرات", @@ -287,17 +287,17 @@ "files": "ملفات", "sizes separated by commas": "أحجام مفصولة بفواصل", "format ids separated by commas": "معرّفات صيغ مفصولة بفواصل", - "format ids separated by commas, or all": "معرّفات صيغ مفصولة بفواصل، أو all", - "group names separated by commas, or all": "أسماء مجموعات مفصولة بفواصل، أو all", + "format ids separated by commas, or `all`": "معرّفات صيغ مفصولة بفواصل، أو `all`", + "group names separated by commas, or `all`": "أسماء مجموعات مفصولة بفواصل، أو `all`", "extensions separated by commas": "امتدادات مفصولة بفواصل", - "the id of a format, such as png or csv": "معرّف صيغة، مثل png أو csv", - "the id of a picture format, such as png or jpg": "معرّف صيغة صورة، مثل png أو jpg", + "the id of a format, such as `png` or `csv`": "معرّف صيغة، مثل `png` أو `csv`", + "the id of a picture format, such as `png` or `jpg`": "معرّف صيغة صورة، مثل `png` أو `jpg`", "one line of up to 100 characters": "سطر واحد من 100 حرف كحد أقصى", - "a colour such as cccccc or ccc": "لون مثل cccccc أو ccc", + "a colour such as `cccccc` or `ccc`": "لون مثل `cccccc` أو `ccc`", "the password, in plain text": "كلمة المرور، كنص عادي", "any text": "أي نص", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "تاريخ مثل 2024-02-29 أو 2024-02-29T13:45:00+02:00، أو none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "لحظة بالتوقيت العالمي المنسق مثل 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "تاريخ مثل `2024-02-29` أو `2024-02-29T13:45:00+02:00`، أو `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "لحظة بالتوقيت العالمي المنسق مثل `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/cs/site.json b/web/content/cs/site.json index acd99cf6..bb8f25aa 100644 --- a/web/content/cs/site.json +++ b/web/content/cs/site.json @@ -266,9 +266,9 @@ "oracleNone": "nelze použít", "int": "libovolné celé číslo", "choice": "jedna z pevné množiny", - "bool": "pravda nebo nepravda", - "size": "velikost, například 2mb", - "duration": "délka, například 10s", + "bool": "`true` nebo `false`", + "size": "velikost, například `2mb`", + "duration": "délka, například `10s`", "text": "text", "pixels": "pixelů", "paragraphs": "odstavců", @@ -286,17 +286,17 @@ "files": "souborů", "sizes separated by commas": "velikosti oddělené čárkami", "format ids separated by commas": "id formátů oddělená čárkami", - "format ids separated by commas, or all": "id formátů oddělená čárkami, nebo all", - "group names separated by commas, or all": "názvy skupin oddělené čárkami, nebo all", + "format ids separated by commas, or `all`": "id formátů oddělená čárkami, nebo `all`", + "group names separated by commas, or `all`": "názvy skupin oddělené čárkami, nebo `all`", "extensions separated by commas": "přípony oddělené čárkami", - "the id of a format, such as png or csv": "id formátu, například png nebo csv", - "the id of a picture format, such as png or jpg": "id obrázkového formátu, například png nebo jpg", + "the id of a format, such as `png` or `csv`": "id formátu, například `png` nebo `csv`", + "the id of a picture format, such as `png` or `jpg`": "id obrázkového formátu, například `png` nebo `jpg`", "one line of up to 100 characters": "jeden řádek o nejvýše 100 znacích", - "a colour such as cccccc or ccc": "barva, například cccccc nebo ccc", + "a colour such as `cccccc` or `ccc`": "barva, například `cccccc` nebo `ccc`", "the password, in plain text": "heslo ve formě prostého textu", "any text": "libovolný text", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "datum, například 2024-02-29 nebo 2024-02-29T13:45:00+02:00, nebo none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "okamžik v UTC, například 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "datum, například `2024-02-29` nebo `2024-02-29T13:45:00+02:00`, nebo `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "okamžik v UTC, například `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/de/site.json b/web/content/de/site.json index 58f96489..32ca609e 100644 --- a/web/content/de/site.json +++ b/web/content/de/site.json @@ -266,9 +266,9 @@ "oracleNone": "nicht zutreffend", "int": "jede ganze Zahl", "choice": "eine aus einer festen Auswahl", - "bool": "wahr oder falsch", - "size": "eine Größe wie 2mb", - "duration": "eine Dauer wie 10s", + "bool": "`true` oder `false`", + "size": "eine Größe wie `2mb`", + "duration": "eine Dauer wie `10s`", "text": "Text", "pixels": "Pixel", "paragraphs": "Absätze", @@ -286,17 +286,17 @@ "files": "Dateien", "sizes separated by commas": "Größen, durch Kommas getrennt", "format ids separated by commas": "Format-IDs, durch Kommas getrennt", - "format ids separated by commas, or all": "Format-IDs, durch Kommas getrennt, oder all", - "group names separated by commas, or all": "Gruppennamen, durch Kommas getrennt, oder all", + "format ids separated by commas, or `all`": "Format-IDs, durch Kommas getrennt, oder `all`", + "group names separated by commas, or `all`": "Gruppennamen, durch Kommas getrennt, oder `all`", "extensions separated by commas": "Endungen, durch Kommas getrennt", - "the id of a format, such as png or csv": "die ID eines Formats, etwa png oder csv", - "the id of a picture format, such as png or jpg": "die ID eines Bildformats, etwa png oder jpg", + "the id of a format, such as `png` or `csv`": "die ID eines Formats, etwa `png` oder `csv`", + "the id of a picture format, such as `png` or `jpg`": "die ID eines Bildformats, etwa `png` oder `jpg`", "one line of up to 100 characters": "eine Zeile mit bis zu 100 Zeichen", - "a colour such as cccccc or ccc": "eine Farbe wie cccccc oder ccc", + "a colour such as `cccccc` or `ccc`": "eine Farbe wie `cccccc` oder `ccc`", "the password, in plain text": "das Passwort im Klartext", "any text": "beliebiger Text", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "ein Datum wie 2024-02-29 oder 2024-02-29T13:45:00+02:00, oder none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "ein Zeitpunkt in UTC wie 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "ein Datum wie `2024-02-29` oder `2024-02-29T13:45:00+02:00`, oder `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "ein Zeitpunkt in UTC wie `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/en/site.json b/web/content/en/site.json index 51ece9d0..4283a806 100644 --- a/web/content/en/site.json +++ b/web/content/en/site.json @@ -261,9 +261,9 @@ "oracleNone": "not applicable", "int": "any whole number", "choice": "one of a fixed set", - "bool": "true or false", - "size": "a size such as 2mb", - "duration": "a length of time such as 10s", + "bool": "`true` or `false`", + "size": "a size such as `2mb`", + "duration": "a length of time such as `10s`", "text": "text", "pixels": "pixels", "paragraphs": "paragraphs", @@ -281,17 +281,17 @@ "files": "files", "sizes separated by commas": "sizes separated by commas", "format ids separated by commas": "format ids separated by commas", - "format ids separated by commas, or all": "format ids separated by commas, or all", - "group names separated by commas, or all": "group names separated by commas, or all", + "format ids separated by commas, or `all`": "format ids separated by commas, or `all`", + "group names separated by commas, or `all`": "group names separated by commas, or `all`", "extensions separated by commas": "extensions separated by commas", - "the id of a format, such as png or csv": "the id of a format, such as png or csv", - "the id of a picture format, such as png or jpg": "the id of a picture format, such as png or jpg", + "the id of a format, such as `png` or `csv`": "the id of a format, such as `png` or `csv`", + "the id of a picture format, such as `png` or `jpg`": "the id of a picture format, such as `png` or `jpg`", "one line of up to 100 characters": "one line of up to 100 characters", - "a colour such as cccccc or ccc": "a colour such as cccccc or ccc", + "a colour such as `cccccc` or `ccc`": "a colour such as `cccccc` or `ccc`", "the password, in plain text": "the password, in plain text", "any text": "any text", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "a moment in UTC such as 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "a moment in UTC such as `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/es/site.json b/web/content/es/site.json index 937fdbcb..2504cbc6 100644 --- a/web/content/es/site.json +++ b/web/content/es/site.json @@ -266,9 +266,9 @@ "oracleNone": "no aplicable", "int": "cualquier número entero", "choice": "uno de un conjunto fijo", - "bool": "verdadero o falso", - "size": "un tamaño como 2mb", - "duration": "una duración como 10s", + "bool": "`true` o `false`", + "size": "un tamaño como `2mb`", + "duration": "una duración como `10s`", "text": "texto", "pixels": "píxeles", "paragraphs": "párrafos", @@ -286,17 +286,17 @@ "files": "archivos", "sizes separated by commas": "tamaños separados por comas", "format ids separated by commas": "ids de formato separados por comas", - "format ids separated by commas, or all": "ids de formato separados por comas, o all", - "group names separated by commas, or all": "nombres de grupo separados por comas, o all", + "format ids separated by commas, or `all`": "ids de formato separados por comas, o `all`", + "group names separated by commas, or `all`": "nombres de grupo separados por comas, o `all`", "extensions separated by commas": "extensiones separadas por comas", - "the id of a format, such as png or csv": "el id de un formato, como png o csv", - "the id of a picture format, such as png or jpg": "el id de un formato de imagen, como png o jpg", + "the id of a format, such as `png` or `csv`": "el id de un formato, como `png` o `csv`", + "the id of a picture format, such as `png` or `jpg`": "el id de un formato de imagen, como `png` o `jpg`", "one line of up to 100 characters": "una línea de hasta 100 caracteres", - "a colour such as cccccc or ccc": "un color como cccccc o ccc", + "a colour such as `cccccc` or `ccc`": "un color como `cccccc` o `ccc`", "the password, in plain text": "la contraseña, en texto plano", "any text": "cualquier texto", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "una fecha como 2024-02-29 o 2024-02-29T13:45:00+02:00, o none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "un instante en UTC como 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "una fecha como `2024-02-29` o `2024-02-29T13:45:00+02:00`, o `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "un instante en UTC como `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/fr/site.json b/web/content/fr/site.json index 6026381e..0ed9307c 100644 --- a/web/content/fr/site.json +++ b/web/content/fr/site.json @@ -266,9 +266,9 @@ "oracleNone": "sans objet", "int": "tout nombre entier", "choice": "une valeur d'un ensemble fixe", - "bool": "vrai ou faux", - "size": "une taille comme 2mb", - "duration": "une durée comme 10s", + "bool": "`true` ou `false`", + "size": "une taille comme `2mb`", + "duration": "une durée comme `10s`", "text": "texte", "pixels": "pixels", "paragraphs": "paragraphes", @@ -286,17 +286,17 @@ "files": "fichiers", "sizes separated by commas": "tailles séparées par des virgules", "format ids separated by commas": "identifiants de format séparés par des virgules", - "format ids separated by commas, or all": "identifiants de format séparés par des virgules, ou all", - "group names separated by commas, or all": "noms de groupe séparés par des virgules, ou all", + "format ids separated by commas, or `all`": "identifiants de format séparés par des virgules, ou `all`", + "group names separated by commas, or `all`": "noms de groupe séparés par des virgules, ou `all`", "extensions separated by commas": "extensions séparées par des virgules", - "the id of a format, such as png or csv": "l'identifiant d'un format, par exemple png ou csv", - "the id of a picture format, such as png or jpg": "l'identifiant d'un format d'image, par exemple png ou jpg", + "the id of a format, such as `png` or `csv`": "l'identifiant d'un format, par exemple `png` ou `csv`", + "the id of a picture format, such as `png` or `jpg`": "l'identifiant d'un format d'image, par exemple `png` ou `jpg`", "one line of up to 100 characters": "une ligne de 100 caractères au plus", - "a colour such as cccccc or ccc": "une couleur comme cccccc ou ccc", + "a colour such as `cccccc` or `ccc`": "une couleur comme `cccccc` ou `ccc`", "the password, in plain text": "le mot de passe, en clair", "any text": "n'importe quel texte", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "une date comme 2024-02-29 ou 2024-02-29T13:45:00+02:00, ou none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "un instant en UTC comme 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "une date comme `2024-02-29` ou `2024-02-29T13:45:00+02:00`, ou `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "un instant en UTC comme `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/hi/site.json b/web/content/hi/site.json index 1ddd053c..d0951b72 100644 --- a/web/content/hi/site.json +++ b/web/content/hi/site.json @@ -266,9 +266,9 @@ "oracleNone": "लागू नहीं", "int": "कोई भी पूर्ण संख्या", "choice": "एक तय समूह में से एक", - "bool": "सही या गलत", - "size": "2mb जैसा आकार", - "duration": "10s जैसी अवधि", + "bool": "`true` या `false`", + "size": "`2mb` जैसा आकार", + "duration": "`10s` जैसी अवधि", "text": "टेक्स्ट", "pixels": "पिक्सेल", "paragraphs": "अनुच्छेद", @@ -286,17 +286,17 @@ "files": "फ़ाइलें", "sizes separated by commas": "अल्पविराम से अलग किए गए आकार", "format ids separated by commas": "अल्पविराम से अलग किए गए फ़ॉर्मैट id", - "format ids separated by commas, or all": "अल्पविराम से अलग किए गए फ़ॉर्मैट id, या all", - "group names separated by commas, or all": "अल्पविराम से अलग किए गए समूह नाम, या all", + "format ids separated by commas, or `all`": "अल्पविराम से अलग किए गए फ़ॉर्मैट id, या `all`", + "group names separated by commas, or `all`": "अल्पविराम से अलग किए गए समूह नाम, या `all`", "extensions separated by commas": "अल्पविराम से अलग किए गए एक्सटेंशन", - "the id of a format, such as png or csv": "किसी फ़ॉर्मैट का id, जैसे png या csv", - "the id of a picture format, such as png or jpg": "किसी चित्र फ़ॉर्मैट का id, जैसे png या jpg", + "the id of a format, such as `png` or `csv`": "किसी फ़ॉर्मैट का id, जैसे `png` या `csv`", + "the id of a picture format, such as `png` or `jpg`": "किसी चित्र फ़ॉर्मैट का id, जैसे `png` या `jpg`", "one line of up to 100 characters": "अधिकतम 100 वर्णों की एक पंक्ति", - "a colour such as cccccc or ccc": "कोई रंग, जैसे cccccc या ccc", + "a colour such as `cccccc` or `ccc`": "कोई रंग, जैसे `cccccc` या `ccc`", "the password, in plain text": "पासवर्ड, सादे टेक्स्ट में", "any text": "कोई भी टेक्स्ट", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "2024-02-29 या 2024-02-29T13:45:00+02:00 जैसी तारीख, या none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "2026-08-01T12:00:00Z जैसा UTC का एक क्षण" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "`2024-02-29` या `2024-02-29T13:45:00+02:00` जैसी तारीख, या `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "`2026-08-01T12:00:00Z` जैसा UTC का एक क्षण" }, "faq": [ { diff --git a/web/content/id/site.json b/web/content/id/site.json index 24373c64..54bd5ad3 100644 --- a/web/content/id/site.json +++ b/web/content/id/site.json @@ -266,9 +266,9 @@ "oracleNone": "tidak berlaku", "int": "bilangan bulat apa pun", "choice": "salah satu dari himpunan tetap", - "bool": "benar atau salah", - "size": "ukuran seperti 2mb", - "duration": "durasi seperti 10s", + "bool": "`true` atau `false`", + "size": "ukuran seperti `2mb`", + "duration": "durasi seperti `10s`", "text": "teks", "pixels": "piksel", "paragraphs": "paragraf", @@ -286,17 +286,17 @@ "files": "file", "sizes separated by commas": "ukuran dipisahkan koma", "format ids separated by commas": "id format dipisahkan koma", - "format ids separated by commas, or all": "id format dipisahkan koma, atau all", - "group names separated by commas, or all": "nama grup dipisahkan koma, atau all", + "format ids separated by commas, or `all`": "id format dipisahkan koma, atau `all`", + "group names separated by commas, or `all`": "nama grup dipisahkan koma, atau `all`", "extensions separated by commas": "ekstensi dipisahkan koma", - "the id of a format, such as png or csv": "id sebuah format, misalnya png atau csv", - "the id of a picture format, such as png or jpg": "id sebuah format gambar, misalnya png atau jpg", + "the id of a format, such as `png` or `csv`": "id sebuah format, misalnya `png` atau `csv`", + "the id of a picture format, such as `png` or `jpg`": "id sebuah format gambar, misalnya `png` atau `jpg`", "one line of up to 100 characters": "satu baris berisi paling banyak 100 karakter", - "a colour such as cccccc or ccc": "warna seperti cccccc atau ccc", + "a colour such as `cccccc` or `ccc`": "warna seperti `cccccc` atau `ccc`", "the password, in plain text": "kata sandi, dalam teks biasa", "any text": "teks apa pun", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "tanggal seperti 2024-02-29 atau 2024-02-29T13:45:00+02:00, atau none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "waktu dalam UTC seperti 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "tanggal seperti `2024-02-29` atau `2024-02-29T13:45:00+02:00`, atau `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "waktu dalam UTC seperti `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/it/site.json b/web/content/it/site.json index 59641f29..7a5de0e4 100644 --- a/web/content/it/site.json +++ b/web/content/it/site.json @@ -266,9 +266,9 @@ "oracleNone": "non applicabile", "int": "qualsiasi numero intero", "choice": "uno di un insieme fisso", - "bool": "vero o falso", - "size": "una dimensione come 2mb", - "duration": "una durata come 10s", + "bool": "`true` o `false`", + "size": "una dimensione come `2mb`", + "duration": "una durata come `10s`", "text": "testo", "pixels": "pixel", "paragraphs": "paragrafi", @@ -286,17 +286,17 @@ "files": "file", "sizes separated by commas": "dimensioni separate da virgole", "format ids separated by commas": "id di formato separati da virgole", - "format ids separated by commas, or all": "id di formato separati da virgole, oppure all", - "group names separated by commas, or all": "nomi di gruppo separati da virgole, oppure all", + "format ids separated by commas, or `all`": "id di formato separati da virgole, oppure `all`", + "group names separated by commas, or `all`": "nomi di gruppo separati da virgole, oppure `all`", "extensions separated by commas": "estensioni separate da virgole", - "the id of a format, such as png or csv": "l'id di un formato, come png o csv", - "the id of a picture format, such as png or jpg": "l'id di un formato di immagine, come png o jpg", + "the id of a format, such as `png` or `csv`": "l'id di un formato, come `png` o `csv`", + "the id of a picture format, such as `png` or `jpg`": "l'id di un formato di immagine, come `png` o `jpg`", "one line of up to 100 characters": "una riga di al massimo 100 caratteri", - "a colour such as cccccc or ccc": "un colore come cccccc o ccc", + "a colour such as `cccccc` or `ccc`": "un colore come `cccccc` o `ccc`", "the password, in plain text": "la password, in chiaro", "any text": "qualsiasi testo", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "una data come 2024-02-29 o 2024-02-29T13:45:00+02:00, oppure none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "un istante in UTC come 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "una data come `2024-02-29` o `2024-02-29T13:45:00+02:00`, oppure `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "un istante in UTC come `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/ja/site.json b/web/content/ja/site.json index f10c44e6..dfd316e6 100644 --- a/web/content/ja/site.json +++ b/web/content/ja/site.json @@ -266,9 +266,9 @@ "oracleNone": "該当なし", "int": "任意の整数", "choice": "決まった候補のいずれか", - "bool": "真または偽", - "size": "2mbのようなサイズ", - "duration": "10sのような長さ", + "bool": "`true` または `false`", + "size": "`2mb`のようなサイズ", + "duration": "`10s`のような長さ", "text": "テキスト", "pixels": "ピクセル", "paragraphs": "段落", @@ -286,17 +286,17 @@ "files": "ファイル", "sizes separated by commas": "カンマ区切りのサイズ", "format ids separated by commas": "カンマ区切りの形式ID", - "format ids separated by commas, or all": "カンマ区切りの形式ID、またはall", - "group names separated by commas, or all": "カンマ区切りのグループ名、またはall", + "format ids separated by commas, or `all`": "カンマ区切りの形式ID、または`all`", + "group names separated by commas, or `all`": "カンマ区切りのグループ名、または`all`", "extensions separated by commas": "カンマ区切りの拡張子", - "the id of a format, such as png or csv": "pngやcsvなどの形式のID", - "the id of a picture format, such as png or jpg": "pngやjpgなどの画像形式のID", + "the id of a format, such as `png` or `csv`": "`png`や`csv`などの形式のID", + "the id of a picture format, such as `png` or `jpg`": "`png`や`jpg`などの画像形式のID", "one line of up to 100 characters": "100文字以内の1行", - "a colour such as cccccc or ccc": "cccccc や ccc のような色", + "a colour such as `cccccc` or `ccc`": "`cccccc` や `ccc` のような色", "the password, in plain text": "パスワード(平文)", "any text": "任意のテキスト", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "2024-02-29や2024-02-29T13:45:00+02:00のような日付、またはnone", - "a moment in UTC such as 2026-08-01T12:00:00Z": "2026-08-01T12:00:00ZのようなUTCの時刻" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "`2024-02-29`や`2024-02-29T13:45:00+02:00`のような日付、または`none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "`2026-08-01T12:00:00Z`のようなUTCの時刻" }, "faq": [ { diff --git a/web/content/ko/site.json b/web/content/ko/site.json index 5420d011..1960edc9 100644 --- a/web/content/ko/site.json +++ b/web/content/ko/site.json @@ -266,9 +266,9 @@ "oracleNone": "해당 없음", "int": "임의의 정수", "choice": "정해진 집합 중 하나", - "bool": "참 또는 거짓", - "size": "2mb와 같은 크기", - "duration": "10s와 같은 길이", + "bool": "`true` 또는 `false`", + "size": "`2mb`와 같은 크기", + "duration": "`10s`와 같은 길이", "text": "텍스트", "pixels": "픽셀", "paragraphs": "단락", @@ -286,17 +286,17 @@ "files": "파일", "sizes separated by commas": "쉼표로 구분한 크기", "format ids separated by commas": "쉼표로 구분한 형식 id", - "format ids separated by commas, or all": "쉼표로 구분한 형식 id 또는 all", - "group names separated by commas, or all": "쉼표로 구분한 그룹 이름 또는 all", + "format ids separated by commas, or `all`": "쉼표로 구분한 형식 id 또는 `all`", + "group names separated by commas, or `all`": "쉼표로 구분한 그룹 이름 또는 `all`", "extensions separated by commas": "쉼표로 구분한 확장자", - "the id of a format, such as png or csv": "png나 csv 같은 형식의 id", - "the id of a picture format, such as png or jpg": "png나 jpg 같은 이미지 형식의 id", + "the id of a format, such as `png` or `csv`": "`png`나 `csv` 같은 형식의 id", + "the id of a picture format, such as `png` or `jpg`": "`png`나 `jpg` 같은 이미지 형식의 id", "one line of up to 100 characters": "최대 100자의 한 줄", - "a colour such as cccccc or ccc": "cccccc 또는 ccc 같은 색", + "a colour such as `cccccc` or `ccc`": "`cccccc` 또는 `ccc` 같은 색", "the password, in plain text": "암호(평문)", "any text": "임의의 텍스트", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "2024-02-29 또는 2024-02-29T13:45:00+02:00 같은 날짜, 또는 none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "2026-08-01T12:00:00Z 같은 UTC 시각" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "`2024-02-29` 또는 `2024-02-29T13:45:00+02:00` 같은 날짜, 또는 `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "`2026-08-01T12:00:00Z` 같은 UTC 시각" }, "faq": [ { diff --git a/web/content/nl/site.json b/web/content/nl/site.json index d847e35d..cd5381c0 100644 --- a/web/content/nl/site.json +++ b/web/content/nl/site.json @@ -266,9 +266,9 @@ "oracleNone": "niet van toepassing", "int": "elk geheel getal", "choice": "een uit een vaste verzameling", - "bool": "waar of onwaar", - "size": "een grootte zoals 2mb", - "duration": "een duur zoals 10s", + "bool": "`true` of `false`", + "size": "een grootte zoals `2mb`", + "duration": "een duur zoals `10s`", "text": "tekst", "pixels": "pixels", "paragraphs": "alinea's", @@ -286,17 +286,17 @@ "files": "bestanden", "sizes separated by commas": "groottes gescheiden door komma's", "format ids separated by commas": "formaat-id's gescheiden door komma's", - "format ids separated by commas, or all": "formaat-id's gescheiden door komma's, of all", - "group names separated by commas, or all": "groepsnamen gescheiden door komma's, of all", + "format ids separated by commas, or `all`": "formaat-id's gescheiden door komma's, of `all`", + "group names separated by commas, or `all`": "groepsnamen gescheiden door komma's, of `all`", "extensions separated by commas": "extensies gescheiden door komma's", - "the id of a format, such as png or csv": "de id van een formaat, zoals png of csv", - "the id of a picture format, such as png or jpg": "de id van een afbeeldingsformaat, zoals png of jpg", + "the id of a format, such as `png` or `csv`": "de id van een formaat, zoals `png` of `csv`", + "the id of a picture format, such as `png` or `jpg`": "de id van een afbeeldingsformaat, zoals `png` of `jpg`", "one line of up to 100 characters": "één regel van maximaal 100 tekens", - "a colour such as cccccc or ccc": "een kleur zoals cccccc of ccc", + "a colour such as `cccccc` or `ccc`": "een kleur zoals `cccccc` of `ccc`", "the password, in plain text": "het wachtwoord, als platte tekst", "any text": "willekeurige tekst", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "een datum zoals 2024-02-29 of 2024-02-29T13:45:00+02:00, of none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "een moment in UTC zoals 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "een datum zoals `2024-02-29` of `2024-02-29T13:45:00+02:00`, of `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "een moment in UTC zoals `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/pl/site.json b/web/content/pl/site.json index e1bf9897..3b3cfb9b 100644 --- a/web/content/pl/site.json +++ b/web/content/pl/site.json @@ -261,9 +261,9 @@ "oracleNone": "nie dotyczy", "int": "dowolna liczba całkowita", "choice": "jedna z ustalonych wartości", - "bool": "prawda albo fałsz", - "size": "rozmiar, na przykład 2mb", - "duration": "czas trwania, na przykład 10s", + "bool": "`true` albo `false`", + "size": "rozmiar, na przykład `2mb`", + "duration": "czas trwania, na przykład `10s`", "text": "tekst", "pixels": "pikseli", "paragraphs": "akapitów", @@ -281,17 +281,17 @@ "files": "plików", "sizes separated by commas": "rozmiary rozdzielone przecinkami", "format ids separated by commas": "identyfikatory formatów rozdzielone przecinkami", - "format ids separated by commas, or all": "identyfikatory formatów rozdzielone przecinkami albo all", - "group names separated by commas, or all": "nazwy grup rozdzielone przecinkami albo all", + "format ids separated by commas, or `all`": "identyfikatory formatów rozdzielone przecinkami albo `all`", + "group names separated by commas, or `all`": "nazwy grup rozdzielone przecinkami albo `all`", "extensions separated by commas": "rozszerzenia rozdzielone przecinkami", - "the id of a format, such as png or csv": "identyfikator formatu, na przykład png albo csv", - "the id of a picture format, such as png or jpg": "identyfikator formatu obrazka, na przykład png albo jpg", + "the id of a format, such as `png` or `csv`": "identyfikator formatu, na przykład `png` albo `csv`", + "the id of a picture format, such as `png` or `jpg`": "identyfikator formatu obrazka, na przykład `png` albo `jpg`", "one line of up to 100 characters": "jeden wiersz do 100 znaków", - "a colour such as cccccc or ccc": "kolor, na przykład cccccc albo ccc", + "a colour such as `cccccc` or `ccc`": "kolor, na przykład `cccccc` albo `ccc`", "the password, in plain text": "hasło, zwykłym tekstem", "any text": "dowolny tekst", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "data, np. 2024-02-29 albo 2024-02-29T13:45:00+02:00, albo none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "chwila w UTC, np. 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "data, np. `2024-02-29` albo `2024-02-29T13:45:00+02:00`, albo `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "chwila w UTC, np. `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/pt-BR/site.json b/web/content/pt-BR/site.json index 5f3849dc..e2285a0c 100644 --- a/web/content/pt-BR/site.json +++ b/web/content/pt-BR/site.json @@ -266,9 +266,9 @@ "oracleNone": "não se aplica", "int": "qualquer número inteiro", "choice": "um de um conjunto fixo", - "bool": "verdadeiro ou falso", - "size": "um tamanho como 2mb", - "duration": "uma duração como 10s", + "bool": "`true` ou `false`", + "size": "um tamanho como `2mb`", + "duration": "uma duração como `10s`", "text": "texto", "pixels": "pixels", "paragraphs": "parágrafos", @@ -286,17 +286,17 @@ "files": "arquivos", "sizes separated by commas": "tamanhos separados por vírgulas", "format ids separated by commas": "ids de formato separados por vírgulas", - "format ids separated by commas, or all": "ids de formato separados por vírgulas, ou all", - "group names separated by commas, or all": "nomes de grupo separados por vírgulas, ou all", + "format ids separated by commas, or `all`": "ids de formato separados por vírgulas, ou `all`", + "group names separated by commas, or `all`": "nomes de grupo separados por vírgulas, ou `all`", "extensions separated by commas": "extensões separadas por vírgulas", - "the id of a format, such as png or csv": "o id de um formato, como png ou csv", - "the id of a picture format, such as png or jpg": "o id de um formato de imagem, como png ou jpg", + "the id of a format, such as `png` or `csv`": "o id de um formato, como `png` ou `csv`", + "the id of a picture format, such as `png` or `jpg`": "o id de um formato de imagem, como `png` ou `jpg`", "one line of up to 100 characters": "uma linha de até 100 caracteres", - "a colour such as cccccc or ccc": "uma cor como cccccc ou ccc", + "a colour such as `cccccc` or `ccc`": "uma cor como `cccccc` ou `ccc`", "the password, in plain text": "a senha, em texto simples", "any text": "qualquer texto", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "uma data como 2024-02-29 ou 2024-02-29T13:45:00+02:00, ou none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "um instante em UTC como 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "uma data como `2024-02-29` ou `2024-02-29T13:45:00+02:00`, ou `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "um instante em UTC como `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/ro/site.json b/web/content/ro/site.json index 9c00c618..2bbb0df6 100644 --- a/web/content/ro/site.json +++ b/web/content/ro/site.json @@ -266,9 +266,9 @@ "oracleNone": "nu se aplică", "int": "orice număr întreg", "choice": "unul dintr-un set fix", - "bool": "adevărat sau fals", - "size": "o dimensiune precum 2mb", - "duration": "o durată precum 10s", + "bool": "`true` sau `false`", + "size": "o dimensiune precum `2mb`", + "duration": "o durată precum `10s`", "text": "text", "pixels": "pixeli", "paragraphs": "paragrafe", @@ -286,17 +286,17 @@ "files": "fișiere", "sizes separated by commas": "dimensiuni separate prin virgule", "format ids separated by commas": "id-uri de format separate prin virgule", - "format ids separated by commas, or all": "id-uri de format separate prin virgule, sau all", - "group names separated by commas, or all": "nume de grupuri separate prin virgule, sau all", + "format ids separated by commas, or `all`": "id-uri de format separate prin virgule, sau `all`", + "group names separated by commas, or `all`": "nume de grupuri separate prin virgule, sau `all`", "extensions separated by commas": "extensii separate prin virgule", - "the id of a format, such as png or csv": "id-ul unui format, de exemplu png sau csv", - "the id of a picture format, such as png or jpg": "id-ul unui format de imagine, de exemplu png sau jpg", + "the id of a format, such as `png` or `csv`": "id-ul unui format, de exemplu `png` sau `csv`", + "the id of a picture format, such as `png` or `jpg`": "id-ul unui format de imagine, de exemplu `png` sau `jpg`", "one line of up to 100 characters": "un singur rând de cel mult 100 de caractere", - "a colour such as cccccc or ccc": "o culoare precum cccccc sau ccc", + "a colour such as `cccccc` or `ccc`": "o culoare precum `cccccc` sau `ccc`", "the password, in plain text": "parola, în text simplu", "any text": "orice text", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "o dată precum 2024-02-29 sau 2024-02-29T13:45:00+02:00, sau none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "un moment în UTC precum 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "o dată precum `2024-02-29` sau `2024-02-29T13:45:00+02:00`, sau `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "un moment în UTC precum `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/ru/site.json b/web/content/ru/site.json index df4d565a..afd72780 100644 --- a/web/content/ru/site.json +++ b/web/content/ru/site.json @@ -266,9 +266,9 @@ "oracleNone": "не применимо", "int": "любое целое число", "choice": "одно значение из фиксированного набора", - "bool": "истина или ложь", - "size": "размер, например 2mb", - "duration": "длительность, например 10s", + "bool": "`true` или `false`", + "size": "размер, например `2mb`", + "duration": "длительность, например `10s`", "text": "текст", "pixels": "пикселей", "paragraphs": "абзацев", @@ -286,17 +286,17 @@ "files": "файлов", "sizes separated by commas": "размеры через запятую", "format ids separated by commas": "id форматов через запятую", - "format ids separated by commas, or all": "id форматов через запятую или all", - "group names separated by commas, or all": "названия групп через запятую или all", + "format ids separated by commas, or `all`": "id форматов через запятую или `all`", + "group names separated by commas, or `all`": "названия групп через запятую или `all`", "extensions separated by commas": "расширения через запятую", - "the id of a format, such as png or csv": "id формата, например png или csv", - "the id of a picture format, such as png or jpg": "id формата изображения, например png или jpg", + "the id of a format, such as `png` or `csv`": "id формата, например `png` или `csv`", + "the id of a picture format, such as `png` or `jpg`": "id формата изображения, например `png` или `jpg`", "one line of up to 100 characters": "одна строка не длиннее 100 символов", - "a colour such as cccccc or ccc": "цвет, например cccccc или ccc", + "a colour such as `cccccc` or `ccc`": "цвет, например `cccccc` или `ccc`", "the password, in plain text": "пароль открытым текстом", "any text": "любой текст", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "дата вида 2024-02-29 или 2024-02-29T13:45:00+02:00, либо none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "момент в UTC вида 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "дата вида `2024-02-29` или `2024-02-29T13:45:00+02:00`, либо `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "момент в UTC вида `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/th/site.json b/web/content/th/site.json index 767466cc..a5ef9630 100644 --- a/web/content/th/site.json +++ b/web/content/th/site.json @@ -266,9 +266,9 @@ "oracleNone": "ไม่เกี่ยวข้อง", "int": "จำนวนเต็มใดก็ได้", "choice": "หนึ่งในชุดค่าที่กำหนดไว้", - "bool": "จริงหรือเท็จ", - "size": "ขนาด เช่น 2mb", - "duration": "ระยะเวลา เช่น 10s", + "bool": "`true` หรือ `false`", + "size": "ขนาด เช่น `2mb`", + "duration": "ระยะเวลา เช่น `10s`", "text": "ข้อความ", "pixels": "พิกเซล", "paragraphs": "ย่อหน้า", @@ -286,17 +286,17 @@ "files": "ไฟล์", "sizes separated by commas": "ขนาดที่คั่นด้วยจุลภาค", "format ids separated by commas": "รหัสรูปแบบที่คั่นด้วยจุลภาค", - "format ids separated by commas, or all": "รหัสรูปแบบที่คั่นด้วยจุลภาค หรือ all", - "group names separated by commas, or all": "ชื่อกลุ่มที่คั่นด้วยจุลภาค หรือ all", + "format ids separated by commas, or `all`": "รหัสรูปแบบที่คั่นด้วยจุลภาค หรือ `all`", + "group names separated by commas, or `all`": "ชื่อกลุ่มที่คั่นด้วยจุลภาค หรือ `all`", "extensions separated by commas": "นามสกุลที่คั่นด้วยจุลภาค", - "the id of a format, such as png or csv": "รหัสของรูปแบบ เช่น png หรือ csv", - "the id of a picture format, such as png or jpg": "รหัสของรูปแบบรูปภาพ เช่น png หรือ jpg", + "the id of a format, such as `png` or `csv`": "รหัสของรูปแบบ เช่น `png` หรือ `csv`", + "the id of a picture format, such as `png` or `jpg`": "รหัสของรูปแบบรูปภาพ เช่น `png` หรือ `jpg`", "one line of up to 100 characters": "หนึ่งบรรทัด ไม่เกิน 100 ตัวอักษร", - "a colour such as cccccc or ccc": "สี เช่น cccccc หรือ ccc", + "a colour such as `cccccc` or `ccc`": "สี เช่น `cccccc` หรือ `ccc`", "the password, in plain text": "รหัสผ่านในรูปข้อความธรรมดา", "any text": "ข้อความใดก็ได้", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "วันที่ เช่น 2024-02-29 หรือ 2024-02-29T13:45:00+02:00 หรือ none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "เวลาใน UTC เช่น 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "วันที่ เช่น `2024-02-29` หรือ `2024-02-29T13:45:00+02:00` หรือ `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "เวลาใน UTC เช่น `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/tr/site.json b/web/content/tr/site.json index 22f264f0..6b98872d 100644 --- a/web/content/tr/site.json +++ b/web/content/tr/site.json @@ -266,9 +266,9 @@ "oracleNone": "uygulanamaz", "int": "herhangi bir tam sayı", "choice": "sabit bir kümeden biri", - "bool": "doğru veya yanlış", - "size": "2mb gibi bir boyut", - "duration": "10s gibi bir süre", + "bool": "`true` veya `false`", + "size": "`2mb` gibi bir boyut", + "duration": "`10s` gibi bir süre", "text": "metin", "pixels": "piksel", "paragraphs": "paragraf", @@ -286,17 +286,17 @@ "files": "dosya", "sizes separated by commas": "virgülle ayrılmış boyutlar", "format ids separated by commas": "virgülle ayrılmış biçim kimlikleri", - "format ids separated by commas, or all": "virgülle ayrılmış biçim kimlikleri veya all", - "group names separated by commas, or all": "virgülle ayrılmış grup adları veya all", + "format ids separated by commas, or `all`": "virgülle ayrılmış biçim kimlikleri veya `all`", + "group names separated by commas, or `all`": "virgülle ayrılmış grup adları veya `all`", "extensions separated by commas": "virgülle ayrılmış uzantılar", - "the id of a format, such as png or csv": "png ya da csv gibi bir biçimin kimliği", - "the id of a picture format, such as png or jpg": "png ya da jpg gibi bir görüntü biçiminin kimliği", + "the id of a format, such as `png` or `csv`": "`png` ya da `csv` gibi bir biçimin kimliği", + "the id of a picture format, such as `png` or `jpg`": "`png` ya da `jpg` gibi bir görüntü biçiminin kimliği", "one line of up to 100 characters": "en fazla 100 karakterlik tek satır", - "a colour such as cccccc or ccc": "cccccc veya ccc gibi bir renk", + "a colour such as `cccccc` or `ccc`": "`cccccc` veya `ccc` gibi bir renk", "the password, in plain text": "parola, düz metin olarak", "any text": "herhangi bir metin", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "2024-02-29 veya 2024-02-29T13:45:00+02:00 gibi bir tarih, veya none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "2026-08-01T12:00:00Z gibi UTC'de bir an" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "`2024-02-29` veya `2024-02-29T13:45:00+02:00` gibi bir tarih, veya `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "`2026-08-01T12:00:00Z` gibi UTC'de bir an" }, "faq": [ { diff --git a/web/content/uk/site.json b/web/content/uk/site.json index 85f20b6e..f36190d9 100644 --- a/web/content/uk/site.json +++ b/web/content/uk/site.json @@ -266,9 +266,9 @@ "oracleNone": "не застосовується", "int": "будь-яке ціле число", "choice": "одне зі значень фіксованого набору", - "bool": "істина або хибність", - "size": "розмір, наприклад 2mb", - "duration": "тривалість, наприклад 10s", + "bool": "`true` або `false`", + "size": "розмір, наприклад `2mb`", + "duration": "тривалість, наприклад `10s`", "text": "текст", "pixels": "пікселів", "paragraphs": "абзаців", @@ -286,17 +286,17 @@ "files": "файлів", "sizes separated by commas": "розміри через кому", "format ids separated by commas": "id форматів через кому", - "format ids separated by commas, or all": "id форматів через кому або all", - "group names separated by commas, or all": "назви груп через кому або all", + "format ids separated by commas, or `all`": "id форматів через кому або `all`", + "group names separated by commas, or `all`": "назви груп через кому або `all`", "extensions separated by commas": "розширення через кому", - "the id of a format, such as png or csv": "id формату, наприклад png або csv", - "the id of a picture format, such as png or jpg": "id формату зображення, наприклад png або jpg", + "the id of a format, such as `png` or `csv`": "id формату, наприклад `png` або `csv`", + "the id of a picture format, such as `png` or `jpg`": "id формату зображення, наприклад `png` або `jpg`", "one line of up to 100 characters": "один рядок до 100 символів", - "a colour such as cccccc or ccc": "колір, наприклад cccccc або ccc", + "a colour such as `cccccc` or `ccc`": "колір, наприклад `cccccc` або `ccc`", "the password, in plain text": "пароль відкритим текстом", "any text": "будь-який текст", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "дата на кшталт 2024-02-29 або 2024-02-29T13:45:00+02:00, або none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "момент в UTC на кшталт 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "дата на кшталт `2024-02-29` або `2024-02-29T13:45:00+02:00`, або `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "момент в UTC на кшталт `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/vi/site.json b/web/content/vi/site.json index 9abbfa0b..e1064205 100644 --- a/web/content/vi/site.json +++ b/web/content/vi/site.json @@ -266,9 +266,9 @@ "oracleNone": "không áp dụng", "int": "số nguyên bất kỳ", "choice": "một trong một tập cố định", - "bool": "đúng hoặc sai", - "size": "kích thước như 2mb", - "duration": "thời lượng như 10s", + "bool": "`true` hoặc `false`", + "size": "kích thước như `2mb`", + "duration": "thời lượng như `10s`", "text": "văn bản", "pixels": "pixel", "paragraphs": "đoạn văn", @@ -286,17 +286,17 @@ "files": "tệp", "sizes separated by commas": "các kích thước cách nhau bằng dấu phẩy", "format ids separated by commas": "các id định dạng cách nhau bằng dấu phẩy", - "format ids separated by commas, or all": "các id định dạng cách nhau bằng dấu phẩy, hoặc all", - "group names separated by commas, or all": "các tên nhóm cách nhau bằng dấu phẩy, hoặc all", + "format ids separated by commas, or `all`": "các id định dạng cách nhau bằng dấu phẩy, hoặc `all`", + "group names separated by commas, or `all`": "các tên nhóm cách nhau bằng dấu phẩy, hoặc `all`", "extensions separated by commas": "các phần mở rộng cách nhau bằng dấu phẩy", - "the id of a format, such as png or csv": "id của một định dạng, chẳng hạn png hoặc csv", - "the id of a picture format, such as png or jpg": "id của một định dạng hình ảnh, chẳng hạn png hoặc jpg", + "the id of a format, such as `png` or `csv`": "id của một định dạng, chẳng hạn `png` hoặc `csv`", + "the id of a picture format, such as `png` or `jpg`": "id của một định dạng hình ảnh, chẳng hạn `png` hoặc `jpg`", "one line of up to 100 characters": "một dòng tối đa 100 ký tự", - "a colour such as cccccc or ccc": "một màu như cccccc hoặc ccc", + "a colour such as `cccccc` or `ccc`": "một màu như `cccccc` hoặc `ccc`", "the password, in plain text": "mật khẩu, ở dạng văn bản thuần", "any text": "văn bản bất kỳ", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "ngày như 2024-02-29 hoặc 2024-02-29T13:45:00+02:00, hoặc none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "thời điểm theo UTC như 2026-08-01T12:00:00Z" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "ngày như `2024-02-29` hoặc `2024-02-29T13:45:00+02:00`, hoặc `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "thời điểm theo UTC như `2026-08-01T12:00:00Z`" }, "faq": [ { diff --git a/web/content/zh-Hans/site.json b/web/content/zh-Hans/site.json index 8bf0d15c..7dc66bf6 100644 --- a/web/content/zh-Hans/site.json +++ b/web/content/zh-Hans/site.json @@ -266,9 +266,9 @@ "oracleNone": "不适用", "int": "任意整数", "choice": "固定集合中的一个", - "bool": "真或假", - "size": "形如 2mb 的大小", - "duration": "形如 10s 的时长", + "bool": "`true` 或 `false`", + "size": "形如 `2mb` 的大小", + "duration": "形如 `10s` 的时长", "text": "文本", "pixels": "像素", "paragraphs": "段落", @@ -286,17 +286,17 @@ "files": "个文件", "sizes separated by commas": "以逗号分隔的大小", "format ids separated by commas": "以逗号分隔的格式 id", - "format ids separated by commas, or all": "以逗号分隔的格式 id,或 all", - "group names separated by commas, or all": "以逗号分隔的组名,或 all", + "format ids separated by commas, or `all`": "以逗号分隔的格式 id,或 `all`", + "group names separated by commas, or `all`": "以逗号分隔的组名,或 `all`", "extensions separated by commas": "以逗号分隔的扩展名", - "the id of a format, such as png or csv": "格式的 id,例如 png 或 csv", - "the id of a picture format, such as png or jpg": "图片格式的 id,例如 png 或 jpg", + "the id of a format, such as `png` or `csv`": "格式的 id,例如 `png` 或 `csv`", + "the id of a picture format, such as `png` or `jpg`": "图片格式的 id,例如 `png` 或 `jpg`", "one line of up to 100 characters": "一行,最多 100 个字符", - "a colour such as cccccc or ccc": "颜色,例如 cccccc 或 ccc", + "a colour such as `cccccc` or `ccc`": "颜色,例如 `cccccc` 或 `ccc`", "the password, in plain text": "明文密码", "any text": "任意文本", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "形如 2024-02-29 或 2024-02-29T13:45:00+02:00 的日期,或 none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "形如 2026-08-01T12:00:00Z 的 UTC 时刻" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "形如 `2024-02-29` 或 `2024-02-29T13:45:00+02:00` 的日期,或 `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "形如 `2026-08-01T12:00:00Z` 的 UTC 时刻" }, "faq": [ { diff --git a/web/content/zh-Hant/site.json b/web/content/zh-Hant/site.json index 796a8bf8..aa77f6c5 100644 --- a/web/content/zh-Hant/site.json +++ b/web/content/zh-Hant/site.json @@ -266,9 +266,9 @@ "oracleNone": "不適用", "int": "任意整數", "choice": "固定集合中的其中一個", - "bool": "真或假", - "size": "形如 2mb 的大小", - "duration": "形如 10s 的時長", + "bool": "`true` 或 `false`", + "size": "形如 `2mb` 的大小", + "duration": "形如 `10s` 的時長", "text": "文字", "pixels": "像素", "paragraphs": "段落", @@ -286,17 +286,17 @@ "files": "個檔案", "sizes separated by commas": "以逗號分隔的大小", "format ids separated by commas": "以逗號分隔的格式 id", - "format ids separated by commas, or all": "以逗號分隔的格式 id,或 all", - "group names separated by commas, or all": "以逗號分隔的組名,或 all", + "format ids separated by commas, or `all`": "以逗號分隔的格式 id,或 `all`", + "group names separated by commas, or `all`": "以逗號分隔的組名,或 `all`", "extensions separated by commas": "以逗號分隔的副檔名", - "the id of a format, such as png or csv": "格式的 id,例如 png 或 csv", - "the id of a picture format, such as png or jpg": "圖片格式的 id,例如 png 或 jpg", + "the id of a format, such as `png` or `csv`": "格式的 id,例如 `png` 或 `csv`", + "the id of a picture format, such as `png` or `jpg`": "圖片格式的 id,例如 `png` 或 `jpg`", "one line of up to 100 characters": "一行,最多 100 個字元", - "a colour such as cccccc or ccc": "顏色,例如 cccccc 或 ccc", + "a colour such as `cccccc` or `ccc`": "顏色,例如 `cccccc` 或 `ccc`", "the password, in plain text": "明文密碼", "any text": "任意文字", - "a date such as 2024-02-29 or 2024-02-29T13:45:00+02:00, or none": "形如 2024-02-29 或 2024-02-29T13:45:00+02:00 的日期,或 none", - "a moment in UTC such as 2026-08-01T12:00:00Z": "形如 2026-08-01T12:00:00Z 的 UTC 時刻" + "a date such as `2024-02-29` or `2024-02-29T13:45:00+02:00`, or `none`": "形如 `2024-02-29` 或 `2024-02-29T13:45:00+02:00` 的日期,或 `none`", + "a moment in UTC such as `2026-08-01T12:00:00Z`": "形如 `2026-08-01T12:00:00Z` 的 UTC 時刻" }, "faq": [ { diff --git a/web/public/404.html b/web/public/404.html index ded87916..5949866a 100644 --- a/web/public/404.html +++ b/web/public/404.html @@ -58,7 +58,7 @@

That page is not here

The address you followed does not