Feature #6637


Add HTML5 support to CGI

Added by stomar (Marcus Stollsteimer) almost 12 years ago. Updated over 11 years ago.

Target version:


The attached patch adds support for HTML 5, providing
the doctype and the tag helpers for the
new HTML elements (article, section, ...).

Changes were made in

  • `lib/cgi/core.rb'
  • `lib/cgi/html.rb'

Tests were added to

  • `test/cgi/test_cgi_core.rb'

((Notice:)) the new HTML5 `header' element has ((not)) been added,
because it collides with the already defined CGI#header
method that creates the HTTP header block.
To avoid unreflected addition of this element, a test has
been included to make sure that CGI#header won't break.

Detailed list of changes in `html.rb' (in comparison to HTML 4 strict):

  • doctype changed
  • new elements added
  • removed elements: tt, big, acronym
  • void elements: area, base, br, col, command, embed, hr, img, input, keygen, link, meta, param, source, track, wbr
  • new elements with optional end tag: optgroup, rt, rp

See the Editor's Draft of the HTML5 specification (15 June 2012):


html5_support_lib_cgi.patch (3.46 KB) html5_support_lib_cgi.patch stomar (Marcus Stollsteimer), 06/24/2012 06:53 AM
6637.pdf (64.8 KB) 6637.pdf stomar (Marcus Stollsteimer), 07/02/2012 01:54 AM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #7110: CGI: Add support for HTML5 <header> tagClosedxibbar (Takeyuki FUJIOKA)10/05/2012Actions

Updated by mame (Yusuke Endoh) almost 12 years ago

  • Status changed from Open to Assigned
  • Assignee set to xibbar (Takeyuki FUJIOKA)

Updated by stomar (Marcus Stollsteimer) almost 12 years ago

Slide added (attached 6637.pdf).


Feature #6637: Add HTML5 support to CGI, now!


  • CGI: provides methods for generating HTML elements

  • HTML5 already widely used, support highly desirable


  • new element <header> collides with existing CGI#header
    (which returns the HTTP header)

  • suggestion:
    rename CGI#header, possibly to CGI#http_header


  • at least, include support for nearly all new HTML5 elements
    (easy to achieve, no compatibility issues, patch supplied)

  • if possible, achieve full support
    (this could not be done in a minor release)

Updated by mame (Yusuke Endoh) almost 12 years ago

Received, thank you!

Unfortunately, CGI maintainer (Takeyuki Fujioka) is not planning to attend the developers' meeting.
So it may be difficult to determine to accept your proposal. But we'll discuss it. Thank you again!

Yusuke Endoh

Updated by xibbar (Takeyuki FUJIOKA) almost 12 years ago

I think your proposal is good.
I will insert your patch to my branch and test.
Please wait so days.
Thank you.

Updated by mame (Yusuke Endoh) almost 12 years ago

Marcus Stollsteimer,

We discussed your slide at the developer meeting (7/21), and
left this issue up to the CGI maintainer (Takeyuki Fujioka).

Yusuke Endoh

Updated by stomar (Marcus Stollsteimer) over 11 years ago

Hi Takeyuki,

have you come to any conclusions?

In case you consider support of all new HTML5 tags,
including , I would be willing to provide
a new set of patches:

  • first patch to rename CGI#header to CGI#http_header
    (breaking downward compatibility)

  • second patch to provide full HTML5 support at once


Updated by xibbar (Takeyuki FUJIOKA) over 11 years ago

  • Category set to lib
  • Target version set to 2.0.0

Sorry, I was into other cgi performance tuning.

I will commit immediately.

Actions #8

Updated by xibbar (Takeyuki FUJIOKA) over 11 years ago

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

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

  • lib/cgi/html5.rb: Add html5 tag maker.
    • lib/cgi/core.rb: ditto.
      [Feature #6637]

Updated by stomar (Marcus Stollsteimer) over 11 years ago

Hi Takeyuki,

Did you consider the issue with the tag?
At the moment it can not be created with the tag writer
like the other tags. I proposed a possible solution
in my previous posts.

Do you have any thoughts about this point?


BTW. I would have appreciated being mentioned in
the log message, like it's done by other committers
("patch by ..."), considerung the effort I put into this.

Updated by xibbar (Takeyuki FUJIOKA) over 11 years ago

  • Status changed from Closed to Feedback

I need your full support patch to support the complete HTML5.
I will write "patch by stomar" to log, I promise.
Please provide.

Updated by stomar (Marcus Stollsteimer) over 11 years ago

Since this issue is already closed, I opened a new one, see #7110.

Updated by ko1 (Koichi Sasada) over 11 years ago

  • Status changed from Feedback to Closed

It seems closed.


Also available in: Atom PDF