[Uw-ruby] Encapsulating HTML <style> using CGI??

Ryan Davis ryand-uwruby at zenspider.com
Thu Nov 22 01:59:26 PST 2007


On Nov 20, 2007, at 23:13 , Steve Dame wrote:

> I have a question about using Ruby CGI.  I want to be able to generate
> some very rich web tables that the HTML is generated from a tool chain
> of Excel--Word and then exported to an HTML file for the look and feel
> of my web page.
>
> The cgi.rb example got me pointed in the right direction, but how does
> one go about pulling raw text "style" strings into a cgi object so  
> that
> it can properly build an HTML sections output?
>
> The objective is to get a section of the CGI Ruby script to generate
> something like:

You use lots of words in combinations and forms I don't currently  
understand. Some of that is surely me (and the time), but... wha?

You want a CGI to create... what? A word document?

> <style>
> <!--
> /* Font Definitions */
> @font-face
>    {font-family:"Times New Roman";
>    panose-1:0 2 2 6 3 5 4 5 2 3;
>    mso-font-charset:0;
>    mso-generic-font-family:auto;
>    mso-font-pitch:variable;
>    mso-font-signature:50331648 0 0 0 1 0;}

that's not HTML or CSS. It may work on IE, but the rest of the world  
won't see a thing afaik.

Anyhow... I'm still not sure what you're trying to do, but the general  
idea is you've got data coming in via some stream (sounds like from a  
static file or stdin) that you're pulling in, then you morph that  
however appropriate, and push that out towards the web client... I  
usually use builder or markaby because they let me write my output in  
a structured ruby code block:

> mab = Markaby::Builder.new
> mab.html do
>   head do
>     title "title"
>     style do
>       self << "body { font-family: Optima, Times; background-color:  
> #99F }"
>       self << "h1   { color: #339 ; text-align: center }"
>       self << "h2   { color: #006 }"
>       self << "a    { color: black }"
>     end
>   end
>   body do
>     h1 "title"
>
>     table do
>       # ... etc ...
>     end
>   end
> end







More information about the Uw-ruby mailing list