S
Sean O'Halpin
Hi,
I finally got fed up with seeing n-thousand duplicate anchors at the
top of my gem_server's index page, so I rustled this up to winnow the
list:
--- PATCH ---
--- /ruby-1.8.2/bin/gem_server=092005-04-17 17:41:08.000000000 +0100
+++ gem_server=092005-09-27 21:27:19.840023000 +0100
@@ -24,14 +24,14 @@
<h1>Summary</h1>
<p>There are %gem_count% gems installed:</p>
<p>
-START:specs
+START:index
IFNOT:is_last
<a href=3D"#%name%">%name%</a>,
ENDIF:is_last
IF:is_last
<a href=3D"#%name%">%name%</a>.
ENDIF:is_last
-END:specs
+END:index
<h1>Gems</h1>
<dl>
@@ -415,12 +415,16 @@
# create page from template
template =3D TemplatePage.new(DOC_TEMPLATE)
res['content-type'] =3D 'text/html'
+
+ index =3D specs.map{|spec| spec["name"]}.uniq.sort{|a,b| a.downcase
<=3D> b.downcase}.map{|name| {"name" =3D> name}}
+
template.write_html_on(
res.body,
{
"gem_count" =3D> specs.size.to_s,
"specs" =3D> specs,
"total_file_count" =3D> total_file_count.to_s,
+ "index" =3D> index
}
)
--- END OF PATCH ---
Regards,
Sean
P.S. Is this the right place to send this kind of patch?
I finally got fed up with seeing n-thousand duplicate anchors at the
top of my gem_server's index page, so I rustled this up to winnow the
list:
--- PATCH ---
--- /ruby-1.8.2/bin/gem_server=092005-04-17 17:41:08.000000000 +0100
+++ gem_server=092005-09-27 21:27:19.840023000 +0100
@@ -24,14 +24,14 @@
<h1>Summary</h1>
<p>There are %gem_count% gems installed:</p>
<p>
-START:specs
+START:index
IFNOT:is_last
<a href=3D"#%name%">%name%</a>,
ENDIF:is_last
IF:is_last
<a href=3D"#%name%">%name%</a>.
ENDIF:is_last
-END:specs
+END:index
<h1>Gems</h1>
<dl>
@@ -415,12 +415,16 @@
# create page from template
template =3D TemplatePage.new(DOC_TEMPLATE)
res['content-type'] =3D 'text/html'
+
+ index =3D specs.map{|spec| spec["name"]}.uniq.sort{|a,b| a.downcase
<=3D> b.downcase}.map{|name| {"name" =3D> name}}
+
template.write_html_on(
res.body,
{
"gem_count" =3D> specs.size.to_s,
"specs" =3D> specs,
"total_file_count" =3D> total_file_count.to_s,
+ "index" =3D> index
}
)
--- END OF PATCH ---
Regards,
Sean
P.S. Is this the right place to send this kind of patch?