Bug #7110

CGI: Add support for HTML5 <header> tag

Added by Marcus Stollsteimer over 1 year ago. Updated over 1 year ago.

[ruby-core:47847]
Status:Closed
Priority:Normal
Assignee:Takeyuki FUJIOKA
Category:lib
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-09-28 trunk 37049) [i686-linux] Backport:

Description

=begin
These patches add the tag to CGI's HTML generation methods, finalizing the support of HTML5, see #6637.

Note that the old CGI#header method is renamed to CGI#http_header. CGI#header now generates a HTML5 header element.
=end

01_lib_cgi_rename_header_to_http_header.patch Magnifier - rename CGI#header to CGI#http_header (10.2 KB) Marcus Stollsteimer, 10/05/2012 10:22 PM

02_lib_cgi_add_html5_header_tag.patch Magnifier - add <header> tag and some tests (1.16 KB) Marcus Stollsteimer, 10/05/2012 10:22 PM


Related issues

Related to ruby-trunk - Feature #6637: Add HTML5 support to CGI Closed 06/24/2012
Related to ruby-trunk - Bug #7286: CGI#header が 1.9.3 と異なる挙動となっている Closed 11/06/2012

Associated revisions

Revision 37466
Added by Takeyuki FUJIOKA over 1 year ago

Sun Nov 4 20:41:28 2012 Takeyuki FUJIOKA xibbar@ruby-lang.org

  • lib/cgi.rb, lib/cgi/*/rb: rename CGI#header to CGI#http_header, add and update HTML5 tag generater. [Bug #7110] Patch provided by Marcus Stollsteimer, thank you !

History

#1 Updated by Yusuke Endoh over 1 year ago

  • Status changed from Open to Assigned

xibbar, are you willing to include this in 2.0.0?
If so, please commit it ASAP, before preview2 (planned at 1 Dec.) at the latest.

Yusuke Endoh mame@tsg.ne.jp

#2 Updated by Zachary Scott over 1 year ago

I think CGI#header should stay the same, and this method to product html5 compatible headers should be CGI#html_header

#3 Updated by Yusuke Endoh over 1 year ago

I recommend xibber to postpone this to next minor, if there is room to discuss anything about the spec of this feature (such as a method name).

Yusuke Endoh mame@tsg.ne.jp

#4 Updated by Yusuke Endoh over 1 year ago

Sorry, xibber -> xibbar.

#5 Updated by Marcus Stollsteimer over 1 year ago

I really think for the proposed patch 2.0 would be the best place.

@zzak:

I can not judge how big the impact of renaming CGI#header would be.

BUT: Your proposal would mean that the tag would have to be treated differently to all the other HTML tags (#h1, #form, #br, ...), which for the users of the tag maker would be a fairly unexpected behaviour.

Personally, I would prefer consistent behaviour for all tags.

In case the decision goes with introducing a special method for this single tag, I would suggest #headerelement (maybe #headertag) instead of #html_header, which to me rather signifies the doctype, html meta data, etc.

#6 Updated by Takeyuki FUJIOKA over 1 year ago

I think this function should be included in 2.0.0

So, I will commit.

Sorry late.

#7 Updated by Takeyuki FUJIOKA over 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r37466.
Marcus, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


Sun Nov 4 20:41:28 2012 Takeyuki FUJIOKA xibbar@ruby-lang.org

  • lib/cgi.rb, lib/cgi/*/rb: rename CGI#header to CGI#http_header, add and update HTML5 tag generater. [Bug #7110] Patch provided by Marcus Stollsteimer, thank you !

#8 Updated by Marcus Stollsteimer over 1 year ago

Perhaps a note should be added to NEWS, maybe something like

  • cgi
    • incompatible changes:
    • CGI#header has been renamed to CGI#http_header. CGI#header is now used by the HTML5 tag maker to create a element.

#9 Updated by Zachary Scott over 1 year ago

In my opinion compatibility is more important than consistency, but
ultimately it is up to xibbar.

Other ruby-core share this sentiment, see ruby-core:48469

#10 Updated by Zachary Scott over 1 year ago

In my opinion compatibility is more important than consistency, but
ultimately it is up to xibbar.

Other ruby-core share this sentiment, see ruby-core:48469

On Sun, Nov 4, 2012 at 9:15 AM, stomar (Marcus Stollsteimer)
redmine@ruby-lang.org wrote:

Issue #7110 has been updated by stomar (Marcus Stollsteimer).

Perhaps a note should be added to NEWS, maybe something like

  • cgi
    • incompatible changes:
    • CGI#header has been renamed to CGI#http_header. CGI#header is now used by the HTML5 tag maker to create a element.

Bug #7110: CGI: Add support for HTML5 tag
https://bugs.ruby-lang.org/issues/7110#change-32341

Author: stomar (Marcus Stollsteimer)
Status: Closed
Priority: Normal
Assignee: xibbar (Takeyuki Fujioka)
Category: lib
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-28 trunk 37049) [i686-linux]

=begin
These patches add the tag to CGI's HTML generation methods, finalizing the support of HTML5, see #6637.

Note that the old CGI#header method is renamed to CGI#http_header. CGI#header now generates a HTML5 header element.
=end

http://bugs.ruby-lang.org/

#11 Updated by Marcus Stollsteimer over 1 year ago

In my opinion compatibility is more important than consistency, but
ultimately it is up to xibbar.

Other ruby-core share this sentiment, see ruby-core:48469

I don't think a general rule can be derived from this single statement. Also, the circumstances are different. Here, it is more a question of avoiding inconsistent and unexpected behaviour than of adding some "would be nice to have" method.

(BTW, I prepared a slide for the developer meeting (7/21), see #6637, and apparently there haven't been objections, though I made sure to point out the incompatibility issue.)

But don't understand me wrong, I'm all for compatibility.

Maybe a point that would have to be considered is whether this change can be regarded as a mostly internal change of a method that is usually not called directly by the average user of the library, or not.

#12 Updated by Takeyuki FUJIOKA over 1 year ago

stomar (Marcus Stollsteimer) wrote:

Perhaps a note should be added to NEWS, maybe something like

  • cgi
    • incompatible changes:
    • CGI#header has been renamed to CGI#http_header. CGI#header is now used by the HTML5 tag maker to create a element.

Thank you. I will add.

#13 Updated by Takeyuki FUJIOKA over 1 year ago

I decide this change.
Because minor version up is is more important than consistency.
But 2.0 is major version up.
HTML5 will be gradually standard format.

#14 Updated by Zachary Scott over 1 year ago

xibbar, it is your decision to make, and I support it.

Thank you.

#15 Updated by Takeyuki FUJIOKA over 1 year ago

Curretly, some japanese programmer talk about compatibility. #7286
Many traditional web applications use cgi.rb .
This change give a impact to these applications.
Some committer said that cgi.rb 's importance is traditional code can run.
I agee them.

If you have better idea, please write here or #7286.

We are discussing in #7286 .

#16 Updated by Yusuke Endoh over 1 year ago

Let me complement. xibbar suggested three options:

  1. Just delete the old header method (current)
  2. Change CGI#header only before HTML4 mode
  3. Change CGI#header only in HTML5 mode

(I don't know any merit of (2), I guess it is typo)

We are mainly considering (3).

puts CGI.new .header #=> "Content-Type: text/html" + deprecated warning
puts CGI.new("html4").header #=> "Content-Type: text/html" + deprecated warning
puts CGI.new("html5").header #=> ""

Knu suggested more delicate way:

  • CGI#header should emit a tag when a block is given, and
  • CGI#header should emit a tag when it is called in a block of other tag-generating methods.

Yusuke Endoh mame@tsg.ne.jp

Also available in: Atom PDF