Skip to content

[DOC] Improve CGI.escape* docs#15709

Merged
hsbt merged 1 commit into
ruby:masterfrom
zverok:update-cgi-escape-docs
Dec 24, 2025
Merged

[DOC] Improve CGI.escape* docs#15709
hsbt merged 1 commit into
ruby:masterfrom
zverok:update-cgi-escape-docs

Conversation

@zverok

@zverok zverok commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

After most of the CGI module was removed from Ruby, the module's docs now render thus:

image

This is, of course, just a typo in :stopdoc: directive, but if the directive is correct, the class would be just empty. Which, when some novice tries to understand some CGI.escapeHTML and where it is coming from, is not very friendly.

Changed it to render this way:

image

Also, made some tiny adjustments to CGI::Escape module docs (purely cosmetic ones).

@zverok zverok requested review from hsbt, jeremyevans and nobu December 23, 2025 20:20
@zverok zverok self-assigned this Dec 23, 2025
@github-actions

Copy link
Copy Markdown

The following files are maintained in the following upstream repositories:

Please file a pull request to the above instead. Thank you!

@zverok zverok force-pushed the update-cgi-escape-docs branch from 3fd9ff9 to 05e2a3b Compare December 23, 2025 20:24
Comment thread lib/cgi/escape.rb
# frozen_string_literal: true

# :stopdoc
# Since Ruby 4.0, \CGI is a small holder for various escaping methods, included from CGI::Escape

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: I understand we mostly avoid mentioning Ruby versions in docs, but I believe such a huge change deserves a reference. At least those coming to docs from previous versions of Ruby, might guess what happened; and newcomers who question the existence of the whole (somewhat unfamiliarly named) CGI module with only one nested, might catch a hint is "that's how it is now". But I am open to suggestions.

Comment thread lib/cgi/escape.rb
end
end

# Synonym for CGI.escapeElement(str)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "It is an alias for ..." is now rendered by RDoc by default, repeating it looked weird:

Image

@zverok

zverok commented Dec 23, 2025

Copy link
Copy Markdown
Contributor Author

Is the bot suggestion relevant here?.. I believe that ruby/cgi still maintains the whole CGI lib as it was, while cgi/escape.rb is maintained in the core repo?.. Or am I mistaken?

@hsbt hsbt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I have no idea how sync ruby/cgi and this file yet. I try to that after Ruby 4.0 release.

@hsbt hsbt merged commit 9154d72 into ruby:master Dec 24, 2025
50 checks passed
@zverok zverok added the Documentation Improvements to documentation. label Dec 24, 2025
@zverok zverok deleted the update-cgi-escape-docs branch December 24, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements to documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants