Skip to content

feat(layout): Publication Layout on every page size New Layout offers (#2309) - #2333

Merged
jgregoriorincon merged 3 commits into
opengeos:mainfrom
jgregoriorincon:feat/2309-publication-page-sizes
Nov 17, 2026
Merged

jgregoriorincon merged 3 commits into
opengeos:mainfrom
jgregoriorincon:feat/2309-publication-page-sizes

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Publication Layout (layout.publication) made sheets on A4, A3 and A2 only. It now makes them on every page size New Layout offers: Letter, Legal, Tabloid and A5 to A0, portrait and landscape, in all six styles. The styles already scale with the sheet's short side, so no size needed its own design.

  • Engine: the sheet profiles are built once from map::layout::PAGES (portrait, then landscape), followed by the journal and thesis figures, so a page size added there is a publication sheet too. A size alone ("letter", "a0", …) is turned to the area's shape, as "a4" is; an unknown profile's message lists every size.
  • Menu: New Layout › Publication Layout lists the sizes as New Layout does (A4 (210 × 297 mm)), each opening its six styles under a Portrait heading and a Landscape heading, then the figures. It has 14 entries instead of 11 and is no deeper; listing all 18 sheets flat would run past the bottom of the screen. The size names, Portrait and Landscape are existing catalog strings, so no new strings are added. The old sheet labels (A4 portrait sheet, …) are no longer used; their catalog entries can be pruned.
  • Surfaces: desktop and browser (the same ribbon); the CLI, Python and the Assistant through layout.publication's profile and the print-layout skill. The touch interface has no Publication Layout menu.
  • The style buttons have the same names under both headings (Classic under Portrait and under Landscape). That is the cost of keeping each size one menu deep; the heading above each group says which orientation it makes.

Known limits, left for follow-ups:

  • On A5 portrait, a long legend can leave the map at a smaller scale with the veil. It is said, has its own test, and stays on the page.
  • Legend, scale bar and map label sizes don't grow with the sheet, as on A2 today.

Testing

  • checks.sh: fmt, clippy (engine, ui-egui, assistant), nextest (7462/7462 passed), doctests and layers all pass.
  • New and updated tests:
    • publication_sheets_follow_the_page_sizes: every PAGES size has its portrait and landscape sheet.
    • every_publication_profile_is_in_the_menu
    • a_publication_sheet_is_made_in_the_style_picked: a real click on A4 › Portrait › Panel and on Tabloid › Landscape › Classic.
    • publication_layouts_fit_their_pages, extended to A5 landscape, Legal, A0 and Letter.
    • a_publication_on_a5_portrait_keeps_its_legend_at_a_smaller_scale
    • Auto-orientation for "Tabloid", "a0", " a5 " and "letter".
  • Every sheet and figure that existed before (6 sheets × 6 styles + 5 figures) was exported with rustgis-cli from the sample project, as PDF and PNG, on this branch and on main, in Web Mercator and on the globe: all 82 files are byte-identical.
  • CI's Web app (wasm32) job passes.

UI evidence

Before:

image

After:

image

Related issue

Closes #2309

Summary by CodeRabbit

  • New Features
    • Publication layouts now support Letter, Legal, Tabloid, and A5 through A0, with portrait and landscape options. Sheet choices are organized by orientation, and labels show page dimensions.
    • Text sizing scales with the sheet’s short side, keeping text proportionate across page sizes.
  • Documentation
    • Updated layout guidance with the expanded sheet-size options and examples.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The publication profile catalog now generates portrait and landscape sheets for every page size, while retaining figure profiles. The layout command resolves size-only IDs and reports the expanded choices. Menus group sheet styles by page size and orientation. Tests and documentation cover the expanded options.

Changes: Publication Layout Profiles

Layer / File(s) Summary
Generate and resolve publication profiles
crates/engine/src/cmd/layout.rs, crates/engine/src/tests.rs, crates/assistant/skills/print-layout/SKILL.md, docs/user-guide/layouts.md
The engine generates portrait and landscape profiles for every page size and resolves size-only IDs. Unknown-profile errors list the expanded choices. Tests and documentation cover the available sizes, profile selection, and page bounds.
Group sheet choices by orientation
crates/ui-egui/src/ribbon.rs
The New Layout menu groups page sizes into portrait and landscape style choices. Figure profiles remain direct choices. The page-size menu uses the shared label formatter, and UI tests cover sheet and figure selection.

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

Change: Feature

Possibly related PRs

Suggested reviewers: giswqs, deniial00

Merge Risk: Minimal · up to c0300

This change adds portrait and landscape publication sheets for every page size, along with the menu grouping and documentation. No concrete merge-blocking risk was found, and existing layouts are reported as unchanged.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Publication Layout (layout.publication) now supports every page size that New Layout offers. It also carries the feat(layout) scope and the issue number. It matches th…
Description check Passed The description follows the template. It has Summary, Testing, UI evidence, and Related issue sections. The Summary explains the engine, menu, and surface changes and the known limits. Testing lists t…
Linked Issues check Passed Issue #2309 is the only directly linked issue, and it is open. Its coding requirements are met by the reviewed diff summary:

1. Sheets for every New Layout size, portrait and landscape, in six styles…
Out of Scope Changes check Passed All listed changes trace to #2309 or to supporting work for it:
- Engine (crates/engine/src/cmd/layout.rs): profile construction from PAGES, size-only resolution, unknown-profile message. The `PUB…
Full details: Title check

Explanation

The title names the main change: Publication Layout (layout.publication) now supports every page size that New Layout offers. It also carries the feat(layout) scope and the issue number. It matches the summary, objectives, and linked issue #2309, and does not describe unrelated work.

Full details: Description check

Explanation

The description follows the template. It has Summary, Testing, UI evidence, and Related issue sections. The Summary explains the engine, menu, and surface changes and the known limits. Testing lists the checks, new tests, and the byte-identical export comparison. UI evidence has before and after screenshots, which the template requires because the menu changed. Related issue reads Closes #2309. The description does not state the 'No visible UI change' line, but that line is not needed here because the PR changes the visible menu.

Full details: Linked Issues check

Explanation

Issue #2309 is the only directly linked issue, and it is open. Its coding requirements are met by the reviewed diff summary:

  1. Sheets for every New Layout size, portrait and landscape, in six styles: crates/engine/src/cmd/layout.rs builds PUBLICATION_PROFILES from map::layout::PAGES in both orientations, followed by the journal and thesis figures. Test publication_sheets_follow_the_page_sizes in crates/engine/src/tests.rs checks each page size.
  2. Size-only profiles ("letter", "a0", and so on) take the area's shape. Tests cover Tabloid, A0, whitespace-padded A5 and Letter. Unknown-profile errors list all supported sizes; the test expects Letter, Legal, Tabloid, A5 and A0 in the list.
  3. Menu: crates/ui-egui/src/ribbon.rs lists sizes with dimensions through the shared page-label formatter. Each size opens six styles under Portrait and Landscape headings, then the figures. The menu has 14 entries, which matches the issue's stated count. Tests every_publication_profile_is_in_the_menu and a_publication_sheet_is_made_in_the_style_picked cover this.
  4. Parity test: the profiles come from PAGES, so dimensions match by construction. Ribbon tests check portrait and landscape profiles for each page size.
  5. Fit tests: publication_layouts_fit_their_pages covers A5 landscape, Legal, A0 and Letter. a_publication_on_a5_portrait_keeps_its_legend_at_a_smaller_scale covers the A5 long-legend case.
  6. Skill and help: crates/assistant/skills/print-layout/SKILL.md and the command parameter documentation name the new sizes.

The touch interface is excluded by the issue scope and by the PR description. Limits in the PR description (A5 legend scale, fixed legend and label sizes) are stated as follow-ups. The issue does not require them. The assessment relies on the PR summary and the change summaries. No source inspection was made, so exact test bodies are not verified.

Full details: Out of Scope Changes check

Explanation

All listed changes trace to #2309 or to supporting work for it:

  • Engine (crates/engine/src/cmd/layout.rs): profile construction from PAGES, size-only resolution, unknown-profile message. The PUBLICATION_PROFILES change from const to LazyLock is needed to build profiles from PAGES.
  • Tests (crates/engine/src/tests.rs, crates/ui-egui/src/ribbon.rs): cover the new behavior.
  • Ribbon (crates/ui-egui/src/ribbon.rs): menu grouping. The shared page-label formatter also applies to the existing New Layout menus. This is a small side effect that keeps labels consistent. It does not change behavior beyond the label text, which the PR states.
  • Skill and command help (crates/assistant/skills/print-layout/SKILL.md): named in the issue.
  • Docs (docs/user-guide/layouts.md): describes the new sizes and the text sizing rule. Supporting documentation for the change.

No unrelated behavior change appears in the summaries. The PR states that existing sheets and figures export byte-identically, which limits regression risk outside the new sizes.

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 each page size with care,
Portrait and landscape profiles appear.
Six styles wait beneath each sheet,
Figures keep their own menu seat.
A5 to A0 join the queue,
Letter and Legal come there too.

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: d903e795-8e2e-498a-ae11-769ffa854474
Commits

Reviewing files that changed from the base of the PR and between 3ec01ad and c030010.

Files selected for processing: 5

  • crates/assistant/skills/print-layout/SKILL.md
  • crates/engine/src/cmd/layout.rs
  • crates/engine/src/tests.rs
  • crates/ui-egui/src/ribbon.rs
  • docs/user-guide/layouts.md

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

Comment thread crates/engine/src/cmd/layout.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, crash paths, or silent data loss. The findings below are minor, and I posted one grouped inline comment on crates/engine/src/cmd/layout.rs:376.

Bugs: None found. I checked the page-size lookup, lowercasing and trimming, the auto-orientation path (min/max are symmetric, so the page_w/page_h ordering does not matter), the unwrap_or(profile) fallback (unreachable, since every PAGES size has both sheets), the ribbon's &&str coercions, and the menu test's last() lookups.

Security: None. The profile parameter is only compared against the PAGES ids and the sheet list; there is no path or string interpolation into anything unsafe.

Performance: None. The LazyLock builds once, and the menu only searches sheets while it is open.

Quality (for the release quality pass, confidence high, low impact):

  • layout.rs:376: Box::leak in the LazyLock initializer turns the ids and labels into &'static str. It is bounded and runs once, but it is an unusual pattern. (Posted inline.)
  • layout.rs:373: the doc on the public PUBLICATION_PROFILES links to the private FIGURES, which triggers rustdoc's private_intra_doc_links. CI does not run cargo doc, so this is minor. (Posted inline.)
  • ribbon.rs page_label: format! with a translated name and numbers. AGENTS asks for i18n::fmt on messages. The old menu code had the same pattern, and this is a menu label, so this is low confidence.
  • ribbon.rs tests: the same label, such as A4 (210 × 297 mm), is in both New Layout and Publication Layout, and the tests use last() to pick the second one. This works, but it is fragile.

AGENTS.md (confidence high on the first, lower on the second):

  • The PR has no UI screenshots yet ("to follow"). AGENTS requires before and after screenshots for changed UI, and this PR changes the ribbon menu.
  • The testing notes do not mention the wasm build (RUSTFLAGS='-D warnings' cargo build --locked --target wasm32-unknown-unknown -p rustgis-web). The new code is not desktop-only, so I expect it to build, but the PR should say it was checked.
  • The PR says it is "three entries longer" than before. By my count the menu goes from 11 entries to 15 (9 size submenus, a separator, and 5 figures). Without the separator it is 14, which is three more. The wording is defensible, so this is a nit.

Checked and left alone: No prior review threads exist on this PR, so nothing was skipped as already raised.

Change size

Compared with main (merge base cff2d69 to PR head 8f5c14d). The whole PR, not the latest push.

Measure Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 3.63 MB
Size after 3.64 MB
Total size change +6.8 KB
File Before After Change
crates/engine/src/tests.rs 3.01 MB 3.02 MB +3.7 KB
crates/ui-egui/src/ribbon.rs 266.7 KB 269.0 KB +2.3 KB
crates/engine/src/cmd/layout.rs 313.5 KB 314.0 KB +558 B
docs/user-guide/layouts.md 49.7 KB 49.9 KB +203 B
crates/assistant/skills/print-layout/SKILL.md 3.2 KB 3.2 KB +82 B

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

Thanks. Fixed in c030010: the private doc link. Updated in the description: before/after screenshots, the wasm32 CI job, and the menu count (14 entries instead of 11). Kept: Box::leak (answered inline), format! in page_label (the existing pattern; the label has no words to translate), and the tests' last() (the duplicate label is New Layout's page and Publication Layout's sheet, as the test's comment says).

@jgregoriorincon
jgregoriorincon marked this pull request as ready for review November 17, 2026 10:46
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full 499-line diff, the PR metadata, the base-branch AGENTS.md, and the surrounding code in layout.rs, ribbon.rs, map/src/layout.rs and the i18n catalogs. I found no bugs, security issues, or performance problems. No inline comments were posted because nothing rose above nit level, so the nits are grouped here.

Bugs: None found. Checked: the PAGES tuple lookup, the &str == String comparison in publication_profile, auto-orientation for " a5 " / "Tabloid", and the PUBLICATION_PROFILES change from const to LazyLock. No other crate uses the old const, so nothing breaks at compile time. LazyLock is fine under the 1.90 MSRV and on wasm. (Confidence: high.)

Security: None. The only new input is the profile string, which is trimmed, lowercased, and matched against the fixed PAGES list before use. The unknown-profile error prints only the server-side size list. (Confidence: high.)

Performance: None. The LazyLock builds 18 small entries once per process. (Confidence: high.)

Quality (nits, left for the release quality pass):

  • ribbon.rs page_label uses format! around a translated size name. AGENTS.md asks for i18n::fmt in messages. The old code had the same pattern, and this is a menu label, so it is minor. (Confidence: medium.)
  • Each style button now appears twice in the menu, once under Portrait and once under Landscape, so accessible names repeat. The PR already acknowledges this. (Confidence: high that it is a cost, low that it is a defect.)
  • Question for the author, not a defect: sheet text scales with the short side, so A5's body text is about 0.7 times A4's. If A4's body is 7 pt, that is roughly 4.9 pt on A5, which may be small in print. The PR's known-limits list does not mention this. (Confidence: medium that it is small in print.)

AGENTS.md:

  • No unwrap, expect, panic!, or unsafe in non-test code. The unwrap_or_else(|| panic!…) calls are all in tests.
  • Silent-loss rule: the A5 portrait legend scale-down is reported through warnings and covered by a test that checks for the message.
  • The PR body names the surfaces it reaches: desktop, browser, CLI, Python, Assistant (skill and params), menu, and the touch interface (none). It states the way back is unchanged. Docs and the skill file are updated.
  • Screenshots are attached as before and after, as the rule requires.
  • Earlier threads: one thread from github-actions (the Box::leak pattern in the LazyLock, and a private intra-doc link to FIGURES) is already answered. I left the Box::leak point alone. The doc-link point is fixed at this head: the doc on PUBLICATION_PROFILES links only to the public PAGES. I left 1 earlier concern alone, and I did not re-raise it.

Change size

Compared: the whole PR against main (merge base cff2d69 to PR head c030010).

Measure Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 3.63 MB
Size after 3.64 MB
Total size change +6.8 KB
Path Before After Change
crates/engine/src/tests.rs 3.02 MB 3.02 MB +3.7 KB
crates/ui-egui/src/ribbon.rs 266.6 KB 269.0 KB +2.3 KB
crates/engine/src/cmd/layout.rs 313.5 KB 314.0 KB +573 B
docs/user-guide/layouts.md 49.7 KB 49.9 KB +203 B
crates/assistant/skills/print-layout/SKILL.md 3.2 KB 3.2 KB +82 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2333/
Web app https://preview.rustgis.app/pr-2333/app/
Commit c030010

GitHub Pages takes a minute or two to publish a new commit.

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 17, 2026
Merged via the queue into opengeos:main with commit 3828d77 Nov 17, 2026
26 of 27 checks passed
@jgregoriorincon
jgregoriorincon deleted the feat/2309-publication-page-sizes branch November 17, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Publication Layout on every page size New Layout offers: Letter, Legal, Tabloid, A5, A1 and A0

1 participant