1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rdoc/diagram.rb:

- properly quote bare element attributes
    - terminates dangling elements (e.g. <img>, <br>, <link>, etc)
    - converts "CVS" to the more HTML-friendly acronym element
    - adds missing type attributes to style elements

  based on Paul Duncan's patch <pabs@pablotron.org> [ruby-core:7028]

* lib/rdoc/generators/html_generator.rb: ditto.
* lib/rdoc/generators/template/html/hefss.rb: ditto.
* lib/rdoc/generators/template/html/html.rb: ditto.
* lib/rdoc/generators/template/html/kilmer.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ocean 2006-01-13 10:27:52 +00:00
parent 50371feb52
commit 1383c1eb2d
7 changed files with 75 additions and 60 deletions

View file

@ -1,3 +1,18 @@
Fri Jan 13 19:14:56 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* lib/rdoc/diagram.rb:
- properly quote bare element attributes
- terminates dangling elements (e.g. <img>, <br>, <link>, etc)
- converts "CVS" to the more HTML-friendly acronym element
- adds missing type attributes to style elements
based on Paul Duncan's patch <pabs@pablotron.org> [ruby-core:7028]
* lib/rdoc/generators/html_generator.rb: ditto.
* lib/rdoc/generators/template/html/hefss.rb: ditto.
* lib/rdoc/generators/template/html/html.rb: ditto.
* lib/rdoc/generators/template/html/kilmer.rb: ditto.
Thu Jan 12 11:53:08 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Thu Jan 12 11:53:08 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/sample/tkballoonhelp.rb: [bug fix] couldn't add to a widget * ext/tk/sample/tkballoonhelp.rb: [bug fix] couldn't add to a widget

View file

@ -320,13 +320,13 @@ module RDoc
xs, ys = [$1.to_i, $3.to_i], [$2.to_i, $4.to_i] xs, ys = [$1.to_i, $3.to_i], [$2.to_i, $4.to_i]
url, area_name = $5, $6 url, area_name = $5, $6
res << %{ <area shape="RECT" coords="#{xs.min},#{ys.min},#{xs.max},#{ys.max}" } res << %{ <area shape="rect" coords="#{xs.min},#{ys.min},#{xs.max},#{ys.max}" }
res << %{ href="#{url}" alt="#{area_name}">\n} res << %{ href="#{url}" alt="#{area_name}" />\n}
end end
res << "</map>\n" res << "</map>\n"
# map_file = src.sub(/.dot/, '.map') # map_file = src.sub(/.dot/, '.map')
# system("dot -Timap #{src} -o #{map_file}") # system("dot -Timap #{src} -o #{map_file}")
res << %{<img src="#{dot}" usemap="#map" border=0 alt="#{name}">} res << %{<img src="#{dot}" usemap="#map" border="0" alt="#{name}" />}
return res return res
end end
end end

View file

@ -153,7 +153,7 @@ module Generators
if (type == "http" || type == "link") && if (type == "http" || type == "link") &&
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ url =~ /\.(gif|png|jpg|jpeg|bmp)$/
"<img src=\"#{url}\">" "<img src=\"#{url}\" />"
else else
"<a href=\"#{url}\">#{text.sub(%r{^#{type}:/*}, '')}</a>" "<a href=\"#{url}\">#{text.sub(%r{^#{type}:/*}, '')}</a>"
end end

View file

@ -114,7 +114,7 @@ BODY = %{
<html><head> <html><head>
<title>%title%</title> <title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<link rel=StyleSheet href="%style_url%" type="text/css" media=screen> <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
function popCode(url) { function popCode(url) {
@ -138,9 +138,9 @@ IF:description
ENDIF:description ENDIF:description
IF:requires IF:requires
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Required files</td></tr> <tr><td class="tablesubtitle">Required files</td></tr>
</table><br> </table><br />
<div class="name-list"> <div class="name-list">
START:requires START:requires
HREF:aref:name: HREF:aref:name:
@ -149,9 +149,9 @@ ENDIF:requires
</div> </div>
IF:methods IF:methods
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Subroutines and Functions</td></tr> <tr><td class="tablesubtitle">Subroutines and Functions</td></tr>
</table><br> </table><br />
<div class="name-list"> <div class="name-list">
START:methods START:methods
HREF:aref:name:, HREF:aref:name:,
@ -160,10 +160,10 @@ END:methods
ENDIF:methods ENDIF:methods
IF:attributes IF:attributes
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Arguments</td></tr> <tr><td class="tablesubtitle">Arguments</td></tr>
</table><br> </table><br />
<table cellspacing=5> <table cellspacing="5">
START:attributes START:attributes
<tr valign="top"> <tr valign="top">
IF:rw IF:rw
@ -180,10 +180,10 @@ END:attributes
ENDIF:attributes ENDIF:attributes
IF:classlist IF:classlist
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Modules</td></tr> <tr><td class="tablesubtitle">Modules</td></tr>
</table><br> </table><br />
%classlist%<br> %classlist%<br />
ENDIF:classlist ENDIF:classlist
!INCLUDE! <!-- method descriptions --> !INCLUDE! <!-- method descriptions -->
@ -198,13 +198,13 @@ FILE_PAGE = <<_FILE_PAGE_
<table width="100%"> <table width="100%">
<tr class="title-row"> <tr class="title-row">
<td><table width="100%"><tr> <td><table width="100%"><tr>
<td class="big-title-font" colspan=2><font size=-3><B>File</B><BR></font>%short_name%</td> <td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font>%short_name%</td>
<td align="right"><table cellspacing=0 cellpadding=2> <td align="right"><table cellspacing="0" cellpadding="2">
<tr> <tr>
<td class="small-title-font">Path:</td> <td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path% <td class="small-title-font">%full_path%
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
</td> </td>
</tr> </tr>
@ -215,26 +215,26 @@ ENDIF:cvsurl
</table> </table>
</td></tr></table></td> </td></tr></table></td>
</tr> </tr>
</table><br> </table><br />
_FILE_PAGE_ _FILE_PAGE_
################################################################### ###################################################################
CLASS_PAGE = %{ CLASS_PAGE = %{
<table width="100%" border=0 cellspacing=0> <table width="100%" border="0" cellspacing="0">
<tr class="title-row"> <tr class="title-row">
<td class="big-title-font"> <td class="big-title-font">
<font size=-3><B>%classmod%</B><BR></font>%full_name% <font size="-3"><b>%classmod%</b><br /></font>%full_name%
</td> </td>
<td align="right"> <td align="right">
<table cellspacing=0 cellpadding=2> <table cellspacing="0" cellpadding="2">
<tr valign="top"> <tr valign="top">
<td class="small-title-font">In:</td> <td class="small-title-font">In:</td>
<td class="small-title-font"> <td class="small-title-font">
START:infiles START:infiles
HREF:full_path_url:full_path: HREF:full_path_url:full_path:
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
END:infiles END:infiles
</td> </td>
@ -256,14 +256,14 @@ ENDIF:parent
</table> </table>
</td> </td>
</tr> </tr>
</table><br> </table><br />
} }
################################################################### ###################################################################
METHOD_LIST = %{ METHOD_LIST = %{
IF:includes IF:includes
<div class="tablesubsubtitle">Uses</div><br> <div class="tablesubsubtitle">Uses</div><br />
<div class="name-list"> <div class="name-list">
START:includes START:includes
<span class="method-name">HREF:aref:name:</span> <span class="method-name">HREF:aref:name:</span>
@ -274,11 +274,11 @@ ENDIF:includes
IF:method_list IF:method_list
START:method_list START:method_list
IF:methods IF:methods
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">%type% %category% methods</td></tr> <tr><td class="tablesubtitle">%type% %category% methods</td></tr>
</table> </table>
START:methods START:methods
<table width="100%" cellspacing = 0 cellpadding=5 border=0> <table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle"> <tr><td class="methodtitle">
<a name="%aref%"> <a name="%aref%">
<b>%name%</b>%params% <b>%name%</b>%params%
@ -307,7 +307,7 @@ SRC_PAGE = %{
<html> <html>
<head><title>%title%</title> <head><title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<style> <style type="text/css">
.kw { color: #3333FF; font-weight: bold } .kw { color: #3333FF; font-weight: bold }
.cmt { color: green; font-style: italic } .cmt { color: green; font-style: italic }
.str { color: #662222; font-style: italic } .str { color: #662222; font-style: italic }
@ -339,7 +339,7 @@ FILE_INDEX = %{
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<style> <style type="text/css">
<!-- <!--
body { body {
background-color: #bbbbbb; background-color: #bbbbbb;
@ -368,7 +368,7 @@ div.banner {
<body> <body>
<div class="banner">%list_title%</div> <div class="banner">%list_title%</div>
START:entries START:entries
<a href="%href%">%name%</a><br> <a href="%href%">%name%</a><br />
END:entries END:entries
</body></html> </body></html>
} }

View file

@ -322,7 +322,7 @@ FILE_PAGE = %{
<td><strong>Path:</strong></td> <td><strong>Path:</strong></td>
<td>%full_path% <td>%full_path%
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
</td> </td>
</tr> </tr>
@ -358,7 +358,7 @@ IF:full_path_url
</a> </a>
ENDIF:full_path_url ENDIF:full_path_url
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
<br /> <br />
END:infiles END:infiles
@ -504,7 +504,7 @@ IF:aliases
START:aliases START:aliases
<tr class="top-aligned-row context-row"> <tr class="top-aligned-row context-row">
<td class="context-item-name">%old_name%</td> <td class="context-item-name">%old_name%</td>
<td>-></td> <td>-&gt;</td>
<td class="context-item-value">%new_name%</td> <td class="context-item-value">%new_name%</td>
</tr> </tr>
IF:desc IF:desc

View file

@ -94,7 +94,7 @@ BODY = %{
<html><head> <html><head>
<title>%title%</title> <title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<link rel=StyleSheet href="%style_url%" type="text/css" media=screen> <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
function popCode(url) { function popCode(url) {
@ -118,9 +118,9 @@ IF:description
ENDIF:description ENDIF:description
IF:requires IF:requires
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Required files</td></tr> <tr><td class="tablesubtitle">Required files</td></tr>
</table><br> </table><br />
<div class="name-list"> <div class="name-list">
START:requires START:requires
HREF:aref:name: HREF:aref:name:
@ -129,9 +129,9 @@ ENDIF:requires
</div> </div>
IF:methods IF:methods
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Methods</td></tr> <tr><td class="tablesubtitle">Methods</td></tr>
</table><br> </table><br />
<div class="name-list"> <div class="name-list">
START:methods START:methods
HREF:aref:name:, HREF:aref:name:,
@ -152,10 +152,10 @@ ENDIF:seccomment
ENDIF:sectitle ENDIF:sectitle
IF:attributes IF:attributes
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Attributes</td></tr> <tr><td class="tablesubtitle">Attributes</td></tr>
</table><br> </table><br />
<table cellspacing=5> <table cellspacing="5">
START:attributes START:attributes
<tr valign="top"> <tr valign="top">
IF:rw IF:rw
@ -172,10 +172,10 @@ END:attributes
ENDIF:attributes ENDIF:attributes
IF:classlist IF:classlist
<table cellpadding=5 width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Classes and Modules</td></tr> <tr><td class="tablesubtitle">Classes and Modules</td></tr>
</table><br> </table><br />
%classlist%<br> %classlist%<br />
ENDIF:classlist ENDIF:classlist
!INCLUDE! <!-- method descriptions --> !INCLUDE! <!-- method descriptions -->
@ -192,13 +192,13 @@ FILE_PAGE = <<_FILE_PAGE_
<table width="100%"> <table width="100%">
<tr class="title-row"> <tr class="title-row">
<td><table width="100%"><tr> <td><table width="100%"><tr>
<td class="big-title-font" colspan=2><font size=-3><B>File</B><BR></font>%short_name%</td> <td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font>%short_name%</td>
<td align="right"><table cellspacing=0 cellpadding=2> <td align="right"><table cellspacing="0" cellpadding="2">
<tr> <tr>
<td class="small-title-font">Path:</td> <td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path% <td class="small-title-font">%full_path%
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
</td> </td>
</tr> </tr>
@ -209,26 +209,26 @@ ENDIF:cvsurl
</table> </table>
</td></tr></table></td> </td></tr></table></td>
</tr> </tr>
</table><br> </table><br />
_FILE_PAGE_ _FILE_PAGE_
################################################################### ###################################################################
CLASS_PAGE = %{ CLASS_PAGE = %{
<table width="100%" border=0 cellspacing=0> <table width="100%" border="0" cellspacing="0">
<tr class="title-row"> <tr class="title-row">
<td class="big-title-font"> <td class="big-title-font">
<font size=-3><B>%classmod%</B><BR></font>%full_name% <font size="-3"><b>%classmod%</b><br /></font>%full_name%
</td> </td>
<td align="right"> <td align="right">
<table cellspacing=0 cellpadding=2> <table cellspacing="0" cellpadding="2">
<tr valign="top"> <tr valign="top">
<td class="small-title-font">In:</td> <td class="small-title-font">In:</td>
<td class="small-title-font"> <td class="small-title-font">
START:infiles START:infiles
HREF:full_path_url:full_path: HREF:full_path_url:full_path:
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
END:infiles END:infiles
</td> </td>
@ -250,14 +250,14 @@ ENDIF:parent
</table> </table>
</td> </td>
</tr> </tr>
</table><br> </table><br />
} }
################################################################### ###################################################################
METHOD_LIST = %{ METHOD_LIST = %{
IF:includes IF:includes
<div class="tablesubsubtitle">Included modules</div><br> <div class="tablesubsubtitle">Included modules</div><br />
<div class="name-list"> <div class="name-list">
START:includes START:includes
<span class="method-name">HREF:aref:name:</span> <span class="method-name">HREF:aref:name:</span>
@ -272,7 +272,7 @@ IF:methods
<tr><td class="tablesubtitle">%type% %category% methods</td></tr> <tr><td class="tablesubtitle">%type% %category% methods</td></tr>
</table> </table>
START:methods START:methods
<table width="100%" cellspacing = 0 cellpadding=5 border=0> <table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle"> <tr><td class="methodtitle">
<a name="%aref%"> <a name="%aref%">
IF:callseq IF:callseq
@ -319,7 +319,7 @@ SRC_PAGE = %{
<html> <html>
<head><title>%title%</title> <head><title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<style> <style type="text/css">
.ruby-comment { color: green; font-style: italic } .ruby-comment { color: green; font-style: italic }
.ruby-constant { color: #4433aa; font-weight: bold; } .ruby-constant { color: #4433aa; font-weight: bold; }
.ruby-identifier { color: #222222; } .ruby-identifier { color: #222222; }
@ -380,7 +380,7 @@ div.banner {
<body> <body>
<div class="banner">%list_title%</div> <div class="banner">%list_title%</div>
START:entries START:entries
<a href="%href%">%name%</a><br> <a href="%href%">%name%</a><br />
END:entries END:entries
</body></html> </body></html>
} }

View file

@ -497,7 +497,7 @@ FILE_PAGE = <<_FILE_PAGE_
<td class="small-title-font">Path:</td> <td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path% <td class="small-title-font">%full_path%
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
</td> </td>
</tr> </tr>
@ -533,7 +533,7 @@ IF:full_path_url
</a> </a>
ENDIF:full_path_url ENDIF:full_path_url
IF:cvsurl IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl ENDIF:cvsurl
<br /> <br />
END:infiles END:infiles
@ -570,7 +570,7 @@ SRC_PAGE = %{
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<title>%title%</title> <title>%title%</title>
<link rel=StyleSheet href="%style_url%" type="text/css" media="screen" /> <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
</head> </head>
<body bgcolor="white"> <body bgcolor="white">
<pre>%code%</pre> <pre>%code%</pre>