Thanks for the reply, but that only preserves the leading whitespace,
not the trailing (which only matters if you're trying to get things to
center up properly as I am).
>> haml_text =<<EOS
%pre
~
+
+++++
+
EOS
=> "%pre\n ~\n + \n +++++\n + \n" <--- trailing
whitespace
>> h = Haml::Engine.new haml_text
>> h.render
=> "<pre>\n +
+++++
 +
\n</pre>\n" <--- no
trailing whitespace
If you put this in a <center> tag, you get
+
+++++
+
Since the 1st and 3rd lines are only 3 chars long instead of 5. This
is a trivial example with an obvious workaround, but I have a big
ASCII logo to work with...
On Feb 5, 9:17 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> There's a special command for this: "~". If you nest a section of
> whitespace-sensitive text within a "~" command, the whitespace will be
> preserved. So, for example, you could do:
>
> %pre
> ~
> +
> +++++
> +
>
> - Nathan
>
> Doug Mc wrote:
> > Could someone tell me how to render this in a centered <pre> tag?
>
> > +
> > +++++
> > +
>
> > Ordinarily I'd use trailing whitespace to make all the lines the same
> > length so they'd center correctly. With trailing whitespace stripped
> > off I have no control over it, and I can't figure out how to tell HAML
> > to honor that whitespace. Do I have to patch? :(
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---