Skip to content

Commit

Permalink
added haml 2.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
sd committed Jan 23, 2009
1 parent 0a37243 commit baef605
Show file tree
Hide file tree
Showing 142 changed files with 12,411 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/environment.rb
Expand Up @@ -31,7 +31,7 @@
config.gem 'quietbacktrace', :version => '>= 0.1.1'
config.gem 'thoughtbot-factory_girl', :version => '>= 1.1.5', :lib => 'factory_girl', :source => 'http://gems.github.com'
config.gem 'thoughtbot-shoulda', :version => '>= 2.0.6', :lib => 'shoulda', :source => 'http://gems.github.com'
config.gem 'haml', :version => '>= 2.0.7'

# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
Expand Down
233 changes: 233 additions & 0 deletions vendor/gems/haml-2.0.7/.specification
@@ -0,0 +1,233 @@
--- !ruby/object:Gem::Specification
name: haml
version: !ruby/object:Gem::Version
version: 2.0.7
platform: ruby
authors:
- Nathan Weizenbaum
- Hampton Catlin
autorequire:
bindir: bin
cert_chain: []

date: 2009-01-22 00:00:00 -05:00
default_executable:
dependencies: []

description: Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML that's designed to express the structure of XHTML or XML documents in a non-repetitive, elegant, easy way, using indentation rather than closing tags and allowing Ruby to be embedded with ease. It was originally envisioned as a plugin for Ruby on Rails, but it can function as a stand-alone templating engine.
email: haml@googlegroups.com
executables:
- haml
- html2haml
- sass
- css2sass
extensions: []

extra_rdoc_files:
- FAQ
- MIT-LICENSE
- VERSION
- README.rdoc
- REVISION
files:
- rails/init.rb
- lib/sass.rb
- lib/sass
- lib/sass/css.rb
- lib/sass/error.rb
- lib/sass/tree
- lib/sass/tree/comment_node.rb
- lib/sass/tree/node.rb
- lib/sass/tree/value_node.rb
- lib/sass/tree/directive_node.rb
- lib/sass/tree/attr_node.rb
- lib/sass/tree/rule_node.rb
- lib/sass/plugin
- lib/sass/plugin/rails.rb
- lib/sass/plugin/merb.rb
- lib/sass/constant.rb
- lib/sass/engine.rb
- lib/sass/plugin.rb
- lib/sass/constant
- lib/sass/constant/number.rb
- lib/sass/constant/operation.rb
- lib/sass/constant/literal.rb
- lib/sass/constant/color.rb
- lib/sass/constant/string.rb
- lib/sass/constant/nil.rb
- lib/haml
- lib/haml/filters.rb
- lib/haml/exec.rb
- lib/haml/error.rb
- lib/haml/template.rb
- lib/haml/engine.rb
- lib/haml/template
- lib/haml/template/patch.rb
- lib/haml/template/plugin.rb
- lib/haml/helpers.rb
- lib/haml/buffer.rb
- lib/haml/html.rb
- lib/haml/precompiler.rb
- lib/haml/util.rb
- lib/haml/helpers
- lib/haml/helpers/action_view_mods.rb
- lib/haml/helpers/action_view_extensions.rb
- lib/haml.rb
- bin/sass
- bin/css2sass
- bin/html2haml
- bin/haml
- test/linked_rails.rb
- test/benchmark.rb
- test/sass
- test/sass/results
- test/sass/results/constants.css
- test/sass/results/parent_ref.css
- test/sass/results/compressed.css
- test/sass/results/complex.css
- test/sass/results/compact.css
- test/sass/results/mixins.css
- test/sass/results/alt.css
- test/sass/results/subdir
- test/sass/results/subdir/subdir.css
- test/sass/results/subdir/nested_subdir
- test/sass/results/subdir/nested_subdir/nested_subdir.css
- test/sass/results/nested.css
- test/sass/results/import.css
- test/sass/results/multiline.css
- test/sass/results/basic.css
- test/sass/results/expanded.css
- test/sass/templates
- test/sass/templates/basic.sass
- test/sass/templates/bork.sass
- test/sass/templates/compressed.sass
- test/sass/templates/import.sass
- test/sass/templates/constants.sass
- test/sass/templates/expanded.sass
- test/sass/templates/nested.sass
- test/sass/templates/_partial.sass
- test/sass/templates/compact.sass
- test/sass/templates/subdir
- test/sass/templates/subdir/subdir.sass
- test/sass/templates/subdir/nested_subdir
- test/sass/templates/subdir/nested_subdir/nested_subdir.sass
- test/sass/templates/parent_ref.sass
- test/sass/templates/alt.sass
- test/sass/templates/importee.sass
- test/sass/templates/mixins.sass
- test/sass/templates/multiline.sass
- test/sass/templates/complex.sass
- test/sass/templates/bork2.sass
- test/sass/engine_test.rb
- test/sass/plugin_test.rb
- test/haml
- test/haml/mocks
- test/haml/mocks/article.rb
- test/haml/rhtml
- test/haml/rhtml/_av_partial_2.rhtml
- test/haml/rhtml/standard.rhtml
- test/haml/rhtml/_av_partial_1.rhtml
- test/haml/rhtml/action_view.rhtml
- test/haml/html2haml_test.rb
- test/haml/template_test.rb
- test/haml/helper_test.rb
- test/haml/results
- test/haml/results/tag_parsing.xhtml
- test/haml/results/content_for_layout.xhtml
- test/haml/results/helpers.xhtml
- test/haml/results/original_engine.xhtml
- test/haml/results/very_basic.xhtml
- test/haml/results/helpful.xhtml
- test/haml/results/list.xhtml
- test/haml/results/partials.xhtml
- test/haml/results/eval_suppressed.xhtml
- test/haml/results/nuke_inner_whitespace.xhtml
- test/haml/results/whitespace_handling.xhtml
- test/haml/results/silent_script.xhtml
- test/haml/results/standard.xhtml
- test/haml/results/just_stuff.xhtml
- test/haml/results/partial_layout.xhtml
- test/haml/results/filters.xhtml
- test/haml/results/nuke_outer_whitespace.xhtml
- test/haml/markaby
- test/haml/markaby/standard.mab
- test/haml/templates
- test/haml/templates/tag_parsing.haml
- test/haml/templates/nuke_inner_whitespace.haml
- test/haml/templates/partial_layout.haml
- test/haml/templates/_av_partial_2_ugly.haml
- test/haml/templates/partials.haml
- test/haml/templates/_layout_for_partial.haml
- test/haml/templates/original_engine.haml
- test/haml/templates/helpers.haml
- test/haml/templates/action_view_ugly.haml
- test/haml/templates/content_for_layout.haml
- test/haml/templates/silent_script.haml
- test/haml/templates/very_basic.haml
- test/haml/templates/filters.haml
- test/haml/templates/_av_partial_1.haml
- test/haml/templates/standard_ugly.haml
- test/haml/templates/_partial.haml
- test/haml/templates/nuke_outer_whitespace.haml
- test/haml/templates/breakage.haml
- test/haml/templates/list.haml
- test/haml/templates/standard.haml
- test/haml/templates/whitespace_handling.haml
- test/haml/templates/eval_suppressed.haml
- test/haml/templates/action_view.haml
- test/haml/templates/_av_partial_2.haml
- test/haml/templates/partialize.haml
- test/haml/templates/just_stuff.haml
- test/haml/templates/helpful.haml
- test/haml/templates/_av_partial_1_ugly.haml
- test/haml/templates/_text_area.haml
- test/haml/engine_test.rb
- test/test_helper.rb
- test/rails
- Rakefile
- init.rb
- FAQ
- MIT-LICENSE
- VERSION
- README.rdoc
- REVISION
has_rdoc: true
homepage: http://haml.hamptoncatlin.com/
post_install_message:
rdoc_options:
- --title
- Haml
- --main
- README.rdoc
- --exclude
- lib/haml/buffer.rb
- --line-numbers
- --inline-source
require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: "0"
version:
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: "0"
version:
requirements: []

rubyforge_project: haml
rubygems_version: 1.3.1
signing_key:
specification_version: 2
summary: An elegant, structured XHTML/XML templating engine. Comes with Sass, a similar CSS templating engine.
test_files:
- test/sass/engine_test.rb
- test/sass/plugin_test.rb
- test/haml/html2haml_test.rb
- test/haml/template_test.rb
- test/haml/helper_test.rb
- test/haml/engine_test.rb
138 changes: 138 additions & 0 deletions vendor/gems/haml-2.0.7/FAQ
@@ -0,0 +1,138 @@
= Frequently Asked Questions

== Haml

=== How do I put a punctuation mark after an element, like "<tt>I like <strong>cake</strong>!</tt>"?

Expressing the structure of a document
and expressing inline formatting are two very different problems.
Haml is mostly designed for structure,
so the best way to deal with formatting is to leave it to other languages
that are designed for it.
You could use Textile:

%p
:textile
I like *cake*!

or Markdown:

%p
:markdown
I like **cake**!

or plain old XHTML:

%p I like <strong>cake</strong>!

If you're inserting something that's generated by a helper, like a link,
then it's even easier:

%p== I like #{link_to 'chocolate', 'http://franschocolates.com'}!

=== How do I stop Haml from indenting the contents of my +pre+ and +textarea+ tags?

Because Haml automatically indents the HTML source code,
the contents of whitespace-sensitive tags like +pre+ and +textarea+
can get screwed up.
The solution is to replace the newlines inside these tags
with HTML newline entities (<tt>&#x000A;</tt>),
which Haml does using the Haml::Helpers#preserve and Haml::Helpers#find_and_preserve helpers.

Normally, Haml will do this for you automatically
when you're using a tag that needs it
(this can be customized using the <tt>:preserve</tt> option;
see the Options section of the {Haml reference}(../classes/Haml.html)).
For example,

%p
%textarea= "Foo\nBar"

will be compiled to

<p>
<textarea>Foo&#x000A;Bar</textarea>
</p>

However, if a helper is generating the tag,
Haml can't detect that and so you'll have to call +find_and_preserve+ yourself.
You can also use <tt>~</tt>, which is the same as <tt>=</tt>
except that it automatically runs +find_and_preserve+ on its input.
For example:

%p= find_and_preserve "<textarea>Foo\nBar</textarea>"

is the same as

%p~ "<textarea>Foo\nBar</textarea>"

and renders

<p><textarea>Foo&#x000A;Bar</textarea></p>

=== How do I make my long lines of Ruby code look nicer in my Haml document?

Put them in a helper or your model.

Haml purposefully makes it annoying to put lots of Ruby code into your templates,
because lots of code doesn't belong in the view.
If you take that huge +link_to_remote+ call
and move it to a +update_sidebar_link+ helper,
it'll make your view both easier to read and more semantic.

If you absolutely must put lots of code in your template,
Haml offers a somewhat awkward multiline-continuation tool.
Put a <tt>|</tt> (pipe character) at the end of each line you want to be merged into one
(including the last line!).
For example:

%p= @this.is(way.too.much). |
code("and I should"). |
really_move.it.into( |
:a => @helper) |

=== I have Haml installed. Why is Rails (only looking for <tt>.html.erb</tt> files | rendering Haml files as plain text | rendering Haml files as blank pages)?

There are several reasons these things might be happening.
First of all, make sure vendor/plugins/haml really exists
and has an init.rb file in there.
Then try restarting Mongrel or WEBrick or whatever you might be using.

Finally, if none of these work,
chances are you've got some localization plugin like Globalize installed.
Such plugins often don't play nicely with Haml.
Luckily, there's usually an easy fix.
For Globalize, just edit globalize/lib/globalize/rails/action_view.rb
and change

@@re_extension = /\.(rjs|rhtml|rxml)$/

to

@@re_extension = /\.(rjs|rhtml|rxml|erb|builder|haml)$/

For other plugins, a little searching will probably turn up a way to fix them as well.

== Sass

=== Can I use a variable from my controller in my Sass file?

No. Sass files aren't views.
They're compiled once into static CSS files,
then left along until they're changed and need to be compiled again.
Not only don't you want to be running a full request cycle
every time someone requests a stylesheet,
but it's not a great idea to put much logic in there anyway
due to how browsers handle them.

If you really need some sort of dynamic CSS,
the best thing to do is put only the snippet you need to dynamically set
in the +head+ of your HTML document.

== You still haven't answered my question!

Sorry! Try looking at the Haml or Sass references,
in the doucmentation for the haml and Sass modules, respectively.
If you can't find an answer there,
feel free to ask in #haml on irc.freenode.net
or send an email to the {mailing list}[http://groups.google.com/group/haml?hl=en].

0 comments on commit baef605

Please sign in to comment.