Skip to content

feat(layout): headline figures on an edge sheet, and its kicker in capitals - #3128

Merged
jgregoriorincon merged 6 commits into
opengeos:mainfrom
jgregoriorincon:feat/3104-edge-figures
Nov 27, 2026
Merged

jgregoriorincon merged 6 commits into
opengeos:mainfrom
jgregoriorincon:feat/3104-edge-figures

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Part 2 of #3104, and the fix for #3126.

  • layout.publication takes "figures" on an edge sheet: up to three {"value", "label"}, the label optional, in columns of one width between the map and the footer's rule. The value is large and bold, the label small under it, both in the paper's ink (light on a dark paper). The map is shorter by the band's height.
  • A value or a label may hold layer statistic tokens ([Feature]: A layout text shows a layer's count, sum, mean, min or max #2853): the text keeps the token and wraps as it is drawn.
  • Anything else is refused: more than three, a value that is missing, empty or not text, a label that isn't text, or another key in a figure. As "paper" and "kicker", "figures" ([] too) is refused with the other styles and on figures. Without figures, or with [], an edge sheet is as before.
  • When the texts leave the map less than its minimum height, the error now names the figures too, if there are any.
  • [Bug]: An edge sheet's kicker writes the map's name in lower case #3126: an edge sheet's kicker that holds a token now has its case set to upper, so what {map}, {crs} or a statistic fills in is drawn in capitals, and its box is measured in capitals. A saved project with such a kicker requires layout-text-block, the existing capability for a text's case; a kicker without tokens sets no case.
  • No new field, capability or schema change.
  • A shorter map places its surrounds as any shorter frame does. On the A4 sheet below, the legend becomes taller than a quarter of the frame, so the existing veil applies and the surrounds group outside the extent; "veil": false keeps the map unveiled.

Surfaces: one more parameter of layout.publication, so the desktop app, the browser, the command line, Python, scripts, plugins, the Assistant and MCP get it through the command (its help and the print-layout skill name it), in the same single undo step. The ribbon's menu and the wizard take no figures. The phone needs nothing of its own.

Testing

  • New tests in crates/engine/src/tests/layout_edge.rs, written before the code and seen failing: one to three figures and none, their columns and order, statistic tokens, refused values, light and dark paper, every sheet size, a sheet with no room left for the map, refusal with the other styles and on figures, and the kicker's capitals and box with {map} and a statistic.
  • cargo fmt, clippy with -D warnings, cargo nextest (10059 passed, 29 skipped), doctests, cargo xtask layers and the schema check. The two commits after that run change only when the kicker's case is set, and tidy its tests; on them, the edge and publication tests, clippy on the engine and cargo fmt.
  • Headless ui_shot replay on main and on this branch: an A4 portrait sheet on a light paper and an A3 landscape one on #0B1B2B, exported as PNG.

UI evidence

Before (main, which leaves "figures" out) and after.

A4 portrait, light paper, kicker {map} · day 22:

3104b-a4-pair.png

A3 landscape on #0B1B2B, kicker {map}:

3104b-a3-pair.png

Related issue

Closes #3104
Closes #3126

Summary by CodeRabbit

  • New Features
    • Edge-style publication sheets can display up to three headline figures beneath the map, each with an optional label. Figure text can include layer statistics, and the layout adjusts map height to fit the figures.
    • Headline figures are available only on edge-style sheets. If there isn’t enough room, the layout reports that the figures may need shortening.
  • Documentation
    • Updated the layout guide with details about headline figures, their formatting, and their availability on edge-style sheets.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The layout.publication command adds optional headline figures for edge-style sheets. It validates figure values and labels, supports layer-statistic tokens, and places figures beneath the map. Kicker measurement and rendering handle uppercase text.

Changes: Edge Publication Figures

Layer / File(s) Summary
Figure input and text substitution
crates/engine/command-surface.txt, crates/engine/src/cmd/layout.rs, crates/engine/src/cmd/layout/publication/texts.rs, crates/engine/src/cmd/layout/publication/mod.rs, crates/engine/src/tests/layout_edge.rs, crates/assistant/skills/print-layout/SKILL.md, docs/user-guide/layouts.md
The command contract and documentation describe up to three figures, each with a required value and optional label. Parsing validates the input, and figure text is included in statistic substitution. Other styles reject the option.
Figure placement and layout sizing
crates/engine/src/cmd/layout/publication/mod.rs, crates/engine/src/cmd/layout/publication/sheet.rs, crates/engine/src/tests/layout_edge.rs
Edge layouts place figures in equal-width columns between the map and footer rule. Figure height reduces available map height, and insufficient-room errors mention figures. Tests cover figure geometry, colors, fit, and tokenized text.
Kicker uppercase measurement and rendering
crates/engine/src/cmd/layout/publication/mod.rs, crates/engine/src/tests/layout_edge.rs
Kicker measurement uses uppercase text. Token-bearing kickers use uppercase rendering when their stored text is not already uppercase. Tests cover token casing and measured height.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant PublicationCommand
  participant HeadlineFiguresParser
  participant EdgeLayout
  Caller->>PublicationCommand: Provide figures to layout.publication
  PublicationCommand->>HeadlineFiguresParser: Validate values and labels
  HeadlineFiguresParser-->>PublicationCommand: Return parsed figure pairs
  PublicationCommand->>EdgeLayout: Pass figure text with statistic substitutions
  EdgeLayout-->>Caller: Produce edge layout with figures beneath the map
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: m-hollis-1, giswqs

Merge Risk: Minimal · up to 567a9

The change adds optional headline figures to edge-style publication layouts and leaves layouts without figures as they were. It has test coverage for the main paths, and no concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two changes in the PR: headline figures on an edge sheet for layout.publication, and the kicker set in capitals. It matches the raw summary, the objectives (#3104 and #3126), and t…
Description check Passed The description follows the repository template. It has Summary, Testing, UI evidence, and Related issue sections. Summary explains the figures feature, the kicker fix, the refusal rules, and the comm…
Linked Issues check Passed [#3104, figures objective] The change adds the optional figures parameter to layout.publication for edge sheets. headline_figures in publication/texts.rs parses up to three {value, label} en…
Out of Scope Changes check Passed All changed files relate to #3104 (figures) or #3126 (kicker case). command-surface.txt, the cmd/layout.rs parameter docs, and print-layout SKILL.md document the new parameter for the command-ba…
Full details: Title check

Explanation

The title names the two changes in the PR: headline figures on an edge sheet for layout.publication, and the kicker set in capitals. It matches the raw summary, the objectives (#3104 and #3126), and the description. Its scope is specific and it follows conventional commit form. Its length of 75 characters is acceptable.

Full details: Description check

Explanation

The description follows the repository template. It has Summary, Testing, UI evidence, and Related issue sections. Summary explains the figures feature, the kicker fix, the refusal rules, and the command surfaces. Testing lists new tests and the commands run. UI evidence includes before and after screenshots for both changed layouts. Related issue lists Closes #3104 and Closes #3126. The template's no-visible-UI line is replaced correctly, since the PR changes visible rendering.

Full details: Linked Issues check

Explanation

[#3104, figures objective] The change adds the optional figures parameter to layout.publication for edge sheets. headline_figures in publication/texts.rs parses up to three {value, label} entries. It requires a nonblank text value, accepts an optional text or null label, rejects other keys, and applies the publication text length limit. publication/mod.rs lays values and labels out in equal-width columns between the map and the footer rule, and it reduces the map height by the band height. Values and labels pass through text-statistic substitution, so layer tokens are kept and wrapped. Tests in crates/engine/src/tests/layout_edge.rs cover zero to three figures, column order, tokens, refused inputs, light and dark paper, every sheet size, and a sheet with no map room. The rejection test covers figures with paper, kicker, other styles, and figure layouts. The edge style, paper, and kicker already exist on the base, so this PR does not reimplement them.

[#3126, kicker objective] When an edge kicker holds {map} or a statistic token, the case is set to upper. Its box is measured in capitals. A kicker without tokens sets no case. Saved projects with such a kicker require the existing layout-text-block capability, and no new field or schema change is introduced.

Limits: this verdict rests on the whole-PR summary, the listed tests, and the changes since the previous review (kicker case scope and test tidying). Source hunks were not reread in this pass. No contradiction was found.

Full details: Out of Scope Changes check

Explanation

All changed files relate to #3104 (figures) or #3126 (kicker case). command-surface.txt, the cmd/layout.rs parameter docs, and print-layout SKILL.md document the new parameter for the command-based surfaces named in the PR. texts.rs and publication/mod.rs implement the figure parsing, layout, and kicker case. sheet.rs updates the Style::Edge doc comment. docs/user-guide/layouts.md documents the option, which #3104 requests. layout_edge.rs holds the tests for both issues. No unrelated behavior, schema, capability, or project-state change appears in the summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the figures in a row,
Three neat columns settle underneath.
Map tokens find their values as they flow,
The kicker wears its capitals with ease.
Then down the page the footer draws a line,
And rabbit ears approve the layout’s sign.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6727cd94-2433-4f9e-9c00-5ecaf1c56151
Commits

Reviewing files that changed from the base of the PR and between 0935a22 and 567a9ed.

Files selected for processing: 3

  • crates/engine/src/cmd/layout/publication/mod.rs
  • crates/engine/src/cmd/layout/publication/sheet.rs
  • crates/engine/src/tests/layout_edge.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs: None found. I checked the figure columns and the room check, the header-size and token handling in texts.rs, the kicker's measured width against the renderer's order (tokens expand first, then TextCase::apply), and the shape errors for figures (wrong type, too many, missing or blank value, unknown key, over 2000 characters). Each refusal returns an error and writes nothing.

Security: None found. The new input is bounded (at most three figures, 2000 characters each via within), and no path or external service is involved.

Performance: None found. The added statistic pass is one statistic_figures call per publication, the same as for the title and other texts.

Quality:

  • publication/mod.rs:606 (confidence: medium): a kicker with a lone brace and no token gets TextCase::Upper, which contradicts the comment "a kicker without tokens sets no case". It adds a layout-text-block requirement for no visible gain. Posted inline.
  • Nit, not posted: the assistant/skills/print-layout/SKILL.md line is very long; the paragraph wraps badly for a reader. Left for the release quality pass.

AGENTS.md: No breaks found. Command surface and help text are updated, and the command-surface.txt entry matches. There is no change to saved fields, so no schema change is needed. The kicker's case is covered by the existing layout-text-block capability. The refusal list and the Reach-every-surface notes match what the diff does. The docs and skill were updated with the command.

Twins checked: layout.publication is the only command that takes paper, kicker or figures, so the refusal list is the only twin to keep in step. The layout's layout.page, layout.new and the ribbon wizard don't take these keys. The publication's kicker path and the editorial/title paths use the same broken and wrap_as helpers, so they were checked together. The renderer's TextCase path was checked against the new measurement.

Prior concerns: There were no earlier review threads on this PR, so none were left alone.

Change size

Compared with main (merge base cb2b87f to PR head 0935a22). Whole PR, not the latest push.

Measure Value
Files changed 7 (0 added, 7 modified, 0 removed, 0 renamed)
Size before 306.3 KB
Size after 318.2 KB
Total size change +11.9 KB
Path Before After Change
crates/engine/src/tests/layout_edge.rs 8.9 KB 16.0 KB +7.1 KB
crates/engine/src/cmd/layout/publication/mod.rs 128.0 KB 131.1 KB +3.1 KB
crates/engine/src/cmd/layout/publication/texts.rs 7.9 KB 9.1 KB +1.1 KB
docs/user-guide/layouts.md 79.0 KB 79.2 KB +0.2 KB
crates/engine/src/cmd/layout.rs 52.2 KB 52.4 KB +0.2 KB
crates/assistant/skills/print-layout/SKILL.md 4.6 KB 4.7 KB +0.1 KB
crates/engine/command-surface.txt 25.7 KB 25.7 KB +9 B

@jgregoriorincon
jgregoriorincon marked this pull request as draft November 27, 2026 18:09
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the base AGENTS.md, the PR metadata and the prior review thread, and checked the surrounding code: capitals, broken, Broken, the kicker and figure layout, headline_figures, the capability check (text_uses_block), the renderer's case-then-wrap order, and the new tests and their helpers. I could not compile or run tests here (no shell), so compile and test results are from reading only.

Bugs: None found. The kicker case logic is sound. *text != text.to_uppercase() sets Upper only when a token has lowercase text, and the renderer applies case after filling tokens and before wrapping, so the measured widths match what is drawn. The capability check reads case.kept(), so the new layout-text-block requirement follows from the saved element.

Security: None found. No new input path bypasses within, and the new code uses get/as_* with no indexing or unwrap in non-test code.

Performance: None found. The figure band is three columns at most, and statistic_figures runs once over a list that is now slightly longer.

Quality (low priority, for the release quality pass):

  • crates/engine/src/cmd/layout/publication/sheet.rs:89 (not in the diff, so no inline comment): the Style::Edge doc still says the sheet has "a kicker and the title over it, the footer unboxed under a thin rule". It should mention the headline figures. Confidence: high. Category: quality.
  • landscape_suits (publication/mod.rs:58) estimates the edge map's room without the figure band, so the automatic orientation can ignore the space the figures take. This is a heuristic, not a wrong result, and the PR's own note about shorter maps covers the placement. Confidence: low. Category: quality.
  • headline_figures_never_squeeze_the_map_away (tests/layout_edge.rs) accepts either an Ok or an Err result for the long label, so it pins the map's room only on the Ok branch. Confidence: medium. Category: quality.

AGENTS.md: No breaks found. The checks I made:

  • No unwrap, expect or panic! in non-test code; the panic! calls are in tests.
  • command-surface.txt matches the new figures? position in the command's parameter order.
  • The schema is unchanged, and the new element names are plain text elements, so no new schema field.
  • The desktop-only and wasm rules do not apply; nothing here is platform-specific.
  • The surfaces the PR names (command help, the print-layout skill, the layouts guide) are updated.

Twins checked:

  • The section headings (sections) also use capitals. They leave a {map} token in its own case on purpose, as the comment at mod.rs:285 says, so they are not the same bug as the kicker.
  • The wizard (publicationwizard/style.rs) describes the style only and takes no figures, as the PR states.
  • The figures key is refused with other styles and on figures, as paper and kicker are.

Prior reviews: One earlier thread, on the Day {22 case (resolved and outdated). The author answered it in 62349eb, and I confirmed the current code addresses it, so I did not re-post it. Concerns left alone: 1.

Change size

Compared with the base branch: the whole PR against main (merge base cb2b87f to PR head 62349eb).

Files changed Added Modified Removed Renamed Size before Size after Total change
7 0 7 0 0 306.3 KB 318.4 KB +12.0 KB
Path Size before Size after Size change
crates/engine/src/tests/layout_edge.rs 8.9 KB 16.1 KB +7.2 KB
crates/engine/src/cmd/layout/publication/mod.rs 128.0 KB 131.2 KB +3.2 KB
crates/engine/src/cmd/layout/publication/texts.rs 7.9 KB 9.1 KB +1.1 KB
docs/user-guide/layouts.md 79.0 KB 79.2 KB +215 B
crates/engine/src/cmd/layout.rs 52.2 KB 52.4 KB +198 B
crates/assistant/skills/print-layout/SKILL.md 4.6 KB 4.7 KB +124 B
crates/engine/command-surface.txt 25.7 KB 25.7 KB +9 B

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3128/
Web app https://preview.rustgis.app/pr-3128/app/
Commit 567a9ed

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon marked this pull request as ready for review November 27, 2026 18:42
@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the summary of the review of 62349eb:

  • Style::Edge's doc comment now names the headline figures (567a9ed).
  • landscape_suits is unchanged: it estimates a fixed height for every sheet's texts and measures none of them, the figure band included.
  • The long-label test still accepts either outcome: a large sheet may keep the map its room. The refusal is pinned on all three sizes by the assertion after it, and the figures' room by the tests on every sheet size.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the base-branch AGENTS.md, and the surrounding code: the figure and kicker layout, token handling in drawn/broken, the renderer's case ordering, the layout-text-block capability gate, and the long-word wrapping. I found no bugs or security issues. I could not compile or run the tests here (no shell), so this rests on reading the code.

Bugs: none found. Checked:

  • Figure geometry: the band sits between the map's bottom and the footer rule, and room() refuses a map that would be too short.
  • Statistic and {map} tokens in figure values and labels go through the same fill/drawn/broken path as other texts.
  • The kicker's case is applied by the renderer after token substitution (textbox.rs drawn_text), so {count:…} survives.
  • A statistic can only draw digits, so the "no case when nothing to raise" test is safe.
  • The layout-text-block requirement is computed from the saved elements, so the kicker's new case is covered without a schema change.
  • Long words are broken to the column width, so a narrow figure column can't overflow.

Security: none found. Hostile input is refused rather than cut: a non-array, more than three entries, an unknown key, a non-string value, and text over MAX_PUBLICATION_TEXT all return errors. No unwrap, no panics in non-test code.

Performance: none found. The figure work is bounded by three entries of at most 2,000 characters each.

Quality:

  • texts.rs:19: nit on the SHAPE error wording, with a suggestion. Posted inline. Category: quality.

AGENTS.md: no breaks found. command-surface.txt is updated for the new figures key, and the ribbon and wizard surfaces are not expected to take it. There is no schema change because no saved field is added, and the kicker case uses an existing field. No layer data is copied, and no platform-specific code is touched.

Twins checked:

  • The only publication command is layout.publication. The data-adding and project-opening families are not touched.
  • The headings in mod.rs (lines 287 and 785) use the same capitals(&fill(…)) pattern. Their comment says the live tokens keep their case on purpose, so they are not part of [Bug]: An edge sheet's kicker writes the map's name in lower case #3126.
  • No wasm-only branch changed.

Earlier concerns: one prior thread exists (the kicker's Day {22 case). It is resolved, the author answered it, and the code now matches the answer, so I did not raise it again. I left no other earlier concerns alone.

Change size

Compared with the base branch (merge base cb2b87f to PR head 567a9ed), the whole PR.

Files changed Added Modified Removed Renamed Size before Size after Total change
8 0 8 0 0 314.0 KB 326.1 KB +12.1 KB
Path Size before Size after Size change
crates/engine/src/tests/layout_edge.rs 8.9 KB 16.1 KB +7.2 KB
crates/engine/src/cmd/layout/publication/mod.rs 128.0 KB 131.2 KB +3.2 KB
crates/engine/src/cmd/layout/publication/texts.rs 7.9 KB 9.1 KB +1.1 KB
docs/user-guide/layouts.md 79.0 KB 79.2 KB +215 B
crates/engine/src/cmd/layout.rs 52.2 KB 52.4 KB +198 B
crates/assistant/skills/print-layout/SKILL.md 4.6 KB 4.7 KB +124 B
crates/engine/src/cmd/layout/publication/sheet.rs 7.7 KB 7.7 KB +47 B
crates/engine/command-surface.txt 25.7 KB 25.7 KB +9 B

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 27, 2026
Merged via the queue into opengeos:main with commit 5960ad8 Nov 27, 2026
30 checks passed
@jgregoriorincon
jgregoriorincon deleted the feat/3104-edge-figures branch November 27, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant