Skip to content

Add An+B serialization alongside parse_nth - #78

Merged
liZe merged 2 commits into
Kozea:mainfrom
ScribleSean:sean/serialize-nth-56
Sep 18, 2026
Merged

liZe merged 2 commits into
Kozea:mainfrom
ScribleSean:sean/serialize-nth-56

Conversation

@ScribleSean

Copy link
Copy Markdown
Contributor

Closes #56.

Adds tinycss2.nth.serialize_nth(a, b) following the CSS Syntax An+B serialization algorithm. This gives callers the inverse of parse_nth, including canonical handling of zero coefficients and the omitted coefficient in n and -n. The function is documented in the existing An+B API section.

Includes canonical-output and parser round-trip tests. The full suite passes (17,022 tests) on macOS/Python3.14, along with Ruff and the Sphinx documentation build. Other platforms were not tested locally.

Prepared with Codex (GPT-6 family; exact serving variant was not recorded) assistance and an Antigravity gemini-3.1-pro-high candidate assessment. I personally reviewed and approved this work before submission.

@liZe

liZe commented Sep 18, 2026

Copy link
Copy Markdown
Member

Thanks for your pull request.

So, you used both GPT-6 and Gemini Pro to transform this:
Capture d’écran du 2026-09-18 10-18-53
into:
Capture d’écran du 2026-09-18 10-19-11

I appreciate your honesty, but I guess your brain would have probably been enough… or actually better. 😁

I changed a couple of things on top of your pull request. And I learned there was a sign format specification for f-strings on the way.

Philosophical questions of #77 (comment) still apply.

@liZe
liZe merged commit c73bf71 into Kozea:main Sep 18, 2026
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.

Add the <an+b> serializer

2 participants