Permalink
Browse files

Freezing Haml

  • Loading branch information...
merbjedi committed Mar 2, 2009
1 parent 5b0446b commit 2b0ab95eaf8e0d5746ca3c0b62fa51633a8d0c54
Showing with 11,580 additions and 35 deletions.
  1. +0 −4 config/environment.rb
  2. +0 −31 lib/github_gem.rb
  3. +138 −0 vendor/plugins/haml/FAQ
  4. +20 −0 vendor/plugins/haml/MIT-LICENSE
  5. +319 −0 vendor/plugins/haml/README.rdoc
  6. +146 −0 vendor/plugins/haml/Rakefile
  7. +1 −0 vendor/plugins/haml/VERSION
  8. +7 −0 vendor/plugins/haml/bin/css2sass
  9. +8 −0 vendor/plugins/haml/bin/haml
  10. +7 −0 vendor/plugins/haml/bin/html2haml
  11. +8 −0 vendor/plugins/haml/bin/sass
  12. +7 −0 vendor/plugins/haml/init.rb
  13. +1,029 −0 vendor/plugins/haml/lib/haml.rb
  14. +236 −0 vendor/plugins/haml/lib/haml/buffer.rb
  15. +257 −0 vendor/plugins/haml/lib/haml/engine.rb
  16. +23 −0 vendor/plugins/haml/lib/haml/error.rb
  17. +347 −0 vendor/plugins/haml/lib/haml/exec.rb
  18. +264 −0 vendor/plugins/haml/lib/haml/filters.rb
  19. +415 −0 vendor/plugins/haml/lib/haml/helpers.rb
  20. +45 −0 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
  21. +134 −0 vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb
  22. +188 −0 vendor/plugins/haml/lib/haml/html.rb
  23. +807 −0 vendor/plugins/haml/lib/haml/precompiler.rb
  24. +43 −0 vendor/plugins/haml/lib/haml/template.rb
  25. +58 −0 vendor/plugins/haml/lib/haml/template/patch.rb
  26. +72 −0 vendor/plugins/haml/lib/haml/template/plugin.rb
  27. +833 −0 vendor/plugins/haml/lib/sass.rb
  28. +245 −0 vendor/plugins/haml/lib/sass/constant.rb
  29. +101 −0 vendor/plugins/haml/lib/sass/constant/color.rb
  30. +53 −0 vendor/plugins/haml/lib/sass/constant/literal.rb
  31. +87 −0 vendor/plugins/haml/lib/sass/constant/number.rb
  32. +30 −0 vendor/plugins/haml/lib/sass/constant/operation.rb
  33. +22 −0 vendor/plugins/haml/lib/sass/constant/string.rb
  34. +393 −0 vendor/plugins/haml/lib/sass/css.rb
  35. +459 −0 vendor/plugins/haml/lib/sass/engine.rb
  36. +35 −0 vendor/plugins/haml/lib/sass/error.rb
  37. +165 −0 vendor/plugins/haml/lib/sass/plugin.rb
  38. +56 −0 vendor/plugins/haml/lib/sass/plugin/merb.rb
  39. +24 −0 vendor/plugins/haml/lib/sass/plugin/rails.rb
  40. +53 −0 vendor/plugins/haml/lib/sass/tree/attr_node.rb
  41. +20 −0 vendor/plugins/haml/lib/sass/tree/comment_node.rb
  42. +46 −0 vendor/plugins/haml/lib/sass/tree/directive_node.rb
  43. +42 −0 vendor/plugins/haml/lib/sass/tree/node.rb
  44. +89 −0 vendor/plugins/haml/lib/sass/tree/rule_node.rb
  45. +16 −0 vendor/plugins/haml/lib/sass/tree/value_node.rb
  46. +82 −0 vendor/plugins/haml/test/benchmark.rb
  47. +586 −0 vendor/plugins/haml/test/haml/engine_test.rb
  48. +187 −0 vendor/plugins/haml/test/haml/helper_test.rb
  49. +60 −0 vendor/plugins/haml/test/haml/html2haml_test.rb
  50. +52 −0 vendor/plugins/haml/test/haml/markaby/standard.mab
  51. +6 −0 vendor/plugins/haml/test/haml/mocks/article.rb
  52. +15 −0 vendor/plugins/haml/test/haml/results/content_for_layout.xhtml
  53. +9 −0 vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml
  54. +86 −0 vendor/plugins/haml/test/haml/results/filters.xhtml
  55. +94 −0 vendor/plugins/haml/test/haml/results/helpers.xhtml
  56. +10 −0 vendor/plugins/haml/test/haml/results/helpful.xhtml
  57. +63 −0 vendor/plugins/haml/test/haml/results/just_stuff.xhtml
  58. +12 −0 vendor/plugins/haml/test/haml/results/list.xhtml
  59. +34 −0 vendor/plugins/haml/test/haml/results/nuke_inner_whitespace.xhtml
  60. +148 −0 vendor/plugins/haml/test/haml/results/nuke_outer_whitespace.xhtml
  61. +20 −0 vendor/plugins/haml/test/haml/results/original_engine.xhtml
  62. +21 −0 vendor/plugins/haml/test/haml/results/partials.xhtml
  63. +74 −0 vendor/plugins/haml/test/haml/results/silent_script.xhtml
  64. +42 −0 vendor/plugins/haml/test/haml/results/standard.xhtml
  65. +23 −0 vendor/plugins/haml/test/haml/results/tag_parsing.xhtml
  66. +5 −0 vendor/plugins/haml/test/haml/results/very_basic.xhtml
  67. +86 −0 vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml
  68. +12 −0 vendor/plugins/haml/test/haml/rhtml/_av_partial_1.rhtml
  69. +8 −0 vendor/plugins/haml/test/haml/rhtml/_av_partial_2.rhtml
  70. +62 −0 vendor/plugins/haml/test/haml/rhtml/action_view.rhtml
  71. +54 −0 vendor/plugins/haml/test/haml/rhtml/standard.rhtml
  72. +168 −0 vendor/plugins/haml/test/haml/template_test.rb
  73. +9 −0 vendor/plugins/haml/test/haml/templates/_av_partial_1.haml
  74. +5 −0 vendor/plugins/haml/test/haml/templates/_av_partial_2.haml
  75. +8 −0 vendor/plugins/haml/test/haml/templates/_partial.haml
  76. +3 −0 vendor/plugins/haml/test/haml/templates/_text_area.haml
  77. +47 −0 vendor/plugins/haml/test/haml/templates/action_view.haml
  78. +8 −0 vendor/plugins/haml/test/haml/templates/breakage.haml
  79. +10 −0 vendor/plugins/haml/test/haml/templates/content_for_layout.haml
  80. +11 −0 vendor/plugins/haml/test/haml/templates/eval_suppressed.haml
  81. +94 −0 vendor/plugins/haml/test/haml/templates/filters.haml
  82. +69 −0 vendor/plugins/haml/test/haml/templates/helpers.haml
  83. +11 −0 vendor/plugins/haml/test/haml/templates/helpful.haml
  84. +77 −0 vendor/plugins/haml/test/haml/templates/just_stuff.haml
  85. +12 −0 vendor/plugins/haml/test/haml/templates/list.haml
  86. +26 −0 vendor/plugins/haml/test/haml/templates/nuke_inner_whitespace.haml
  87. +144 −0 vendor/plugins/haml/test/haml/templates/nuke_outer_whitespace.haml
  88. +17 −0 vendor/plugins/haml/test/haml/templates/original_engine.haml
  89. +1 −0 vendor/plugins/haml/test/haml/templates/partialize.haml
  90. +12 −0 vendor/plugins/haml/test/haml/templates/partials.haml
  91. +40 −0 vendor/plugins/haml/test/haml/templates/silent_script.haml
  92. +42 −0 vendor/plugins/haml/test/haml/templates/standard.haml
  93. +21 −0 vendor/plugins/haml/test/haml/templates/tag_parsing.haml
  94. +4 −0 vendor/plugins/haml/test/haml/templates/very_basic.haml
  95. +87 −0 vendor/plugins/haml/test/haml/templates/whitespace_handling.haml
  96. +15 −0 vendor/plugins/haml/test/haml/test_helper.rb
  97. +276 −0 vendor/plugins/haml/test/sass/engine_test.rb
  98. +159 −0 vendor/plugins/haml/test/sass/plugin_test.rb
  99. +4 −0 vendor/plugins/haml/test/sass/results/alt.css
  100. +9 −0 vendor/plugins/haml/test/sass/results/basic.css
  101. +5 −0 vendor/plugins/haml/test/sass/results/compact.css
  102. +87 −0 vendor/plugins/haml/test/sass/results/complex.css
  103. +1 −0 vendor/plugins/haml/test/sass/results/compressed.css
  104. +14 −0 vendor/plugins/haml/test/sass/results/constants.css
  105. +19 −0 vendor/plugins/haml/test/sass/results/expanded.css
  106. +29 −0 vendor/plugins/haml/test/sass/results/import.css
  107. +95 −0 vendor/plugins/haml/test/sass/results/mixins.css
  108. +24 −0 vendor/plugins/haml/test/sass/results/multiline.css
  109. +22 −0 vendor/plugins/haml/test/sass/results/nested.css
  110. +13 −0 vendor/plugins/haml/test/sass/results/parent_ref.css
  111. +1 −0 vendor/plugins/haml/test/sass/results/subdir/nested_subdir/nested_subdir.css
  112. +1 −0 vendor/plugins/haml/test/sass/results/subdir/subdir.css
  113. +2 −0 vendor/plugins/haml/test/sass/templates/_partial.sass
  114. +16 −0 vendor/plugins/haml/test/sass/templates/alt.sass
  115. +23 −0 vendor/plugins/haml/test/sass/templates/basic.sass
  116. +2 −0 vendor/plugins/haml/test/sass/templates/bork.sass
  117. +2 −0 vendor/plugins/haml/test/sass/templates/bork2.sass
  118. +17 −0 vendor/plugins/haml/test/sass/templates/compact.sass
  119. +310 −0 vendor/plugins/haml/test/sass/templates/complex.sass
  120. +15 −0 vendor/plugins/haml/test/sass/templates/compressed.sass
  121. +97 −0 vendor/plugins/haml/test/sass/templates/constants.sass
  122. +17 −0 vendor/plugins/haml/test/sass/templates/expanded.sass
  123. +11 −0 vendor/plugins/haml/test/sass/templates/import.sass
  124. +14 −0 vendor/plugins/haml/test/sass/templates/importee.sass
  125. +76 −0 vendor/plugins/haml/test/sass/templates/mixins.sass
  126. +20 −0 vendor/plugins/haml/test/sass/templates/multiline.sass
  127. +25 −0 vendor/plugins/haml/test/sass/templates/nested.sass
  128. +25 −0 vendor/plugins/haml/test/sass/templates/parent_ref.sass
  129. +3 −0 vendor/plugins/haml/test/sass/templates/subdir/nested_subdir/nested_subdir.sass
  130. +6 −0 vendor/plugins/haml/test/sass/templates/subdir/subdir.sass
View
@@ -10,7 +10,6 @@
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
-require 'github_gem'
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
@@ -66,8 +65,5 @@
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
- # Gem Requirements
- config.gem "haml", :version => ">= 2.0.0"
-
end
View
@@ -1,31 +0,0 @@
-require 'active_support'
-
-module Rails
- class Configuration
-
- # Adds a single Gem dependency from GitHub
- #
- # # declare a github gem plugin
- # config.github_gem 'jcnetdev-better_partials'
- #
- # # equivalent to:
- # config.gem 'jcnetdev-better_partials', :lib => 'better_partials', :source => 'http://gems.github.com'
- def github_gem(name, options = {})
-
- # set lib name
- name_parts = name.split("-")
- if name_parts.size > 1
- lib = name.gsub("#{name_parts.first}-", "")
- else
- lib = name
- end
-
- # set defaults
- options.reverse_merge!(:lib => lib, :source => 'http://gems.github.com')
-
- # add rails dependency
- @gems << Rails::GemDependency.new(name, options)
- end
-
- end
-end
View
@@ -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,0 +1,20 @@
+Copyright (c) 2006-2008 Hampton Catlin
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Oops, something went wrong.

0 comments on commit 2b0ab95

Please sign in to comment.