mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
parent
05898c5b90
commit
3651f678a7
Notes:
git
2021-03-16 15:47:54 +09:00
8 changed files with 471 additions and 2 deletions
|
@ -314,6 +314,29 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|||
@res << raw.parts.join("\n")
|
||||
end
|
||||
|
||||
##
|
||||
# Adds +table+ to the output
|
||||
|
||||
def accept_table header, body, aligns
|
||||
@res << "\n<table role=\"table\">\n<thead>\n<tr>\n"
|
||||
header.zip(aligns) do |text, align|
|
||||
@res << '<th'
|
||||
@res << ' align="' << align << '"' if align
|
||||
@res << '>' << CGI.escapeHTML(text) << "</th>\n"
|
||||
end
|
||||
@res << "</tr>\n</thead>\n<tbody>\n"
|
||||
body.each do |row|
|
||||
@res << "<tr>\n"
|
||||
row.zip(aligns) do |text, align|
|
||||
@res << '<td'
|
||||
@res << ' align="' << align << '"' if align
|
||||
@res << '>' << CGI.escapeHTML(text) << "</td>\n"
|
||||
end
|
||||
@res << "</tr>\n"
|
||||
end
|
||||
@res << "</tbody>\n</table>\n"
|
||||
end
|
||||
|
||||
# :section: Utilities
|
||||
|
||||
##
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue