Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Freeze Haml locally

  • Loading branch information...
commit 13afcc7957a2126007aaa5f947b76b76c2b17191 1 parent 743d2a7
@topfunky authored
Showing with 13,211 additions and 0 deletions.
  1. +4 −0 vendor/plugins/haml/.gitignore
  2. +138 −0 vendor/plugins/haml/FAQ
  3. +20 −0 vendor/plugins/haml/MIT-LICENSE
  4. +325 −0 vendor/plugins/haml/README.rdoc
  5. +150 −0 vendor/plugins/haml/Rakefile
  6. +9 −0 vendor/plugins/haml/TODO
  7. +1 −0  vendor/plugins/haml/VERSION
  8. +7 −0 vendor/plugins/haml/bin/css2sass
  9. +9 −0 vendor/plugins/haml/bin/haml
  10. +7 −0 vendor/plugins/haml/bin/html2haml
  11. +8 −0 vendor/plugins/haml/bin/sass
  12. +330 −0 vendor/plugins/haml/extra/haml-mode.el
  13. +88 −0 vendor/plugins/haml/extra/sass-mode.el
  14. +43 −0 vendor/plugins/haml/haml.gemspec
  15. +1,044 −0 vendor/plugins/haml/lib/haml.rb
  16. +236 −0 vendor/plugins/haml/lib/haml/buffer.rb
  17. +266 −0 vendor/plugins/haml/lib/haml/engine.rb
  18. +22 −0 vendor/plugins/haml/lib/haml/error.rb
  19. +372 −0 vendor/plugins/haml/lib/haml/exec.rb
  20. +274 −0 vendor/plugins/haml/lib/haml/filters.rb
  21. +432 −0 vendor/plugins/haml/lib/haml/helpers.rb
  22. +45 −0 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
  23. +171 −0 vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb
  24. +188 −0 vendor/plugins/haml/lib/haml/html.rb
  25. +819 −0 vendor/plugins/haml/lib/haml/precompiler.rb
  26. +37 −0 vendor/plugins/haml/lib/haml/shared.rb
  27. +51 −0 vendor/plugins/haml/lib/haml/template.rb
  28. +58 −0 vendor/plugins/haml/lib/haml/template/patch.rb
  29. +72 −0 vendor/plugins/haml/lib/haml/template/plugin.rb
  30. +884 −0 vendor/plugins/haml/lib/sass.rb
  31. +247 −0 vendor/plugins/haml/lib/sass/constant.rb
  32. +19 −0 vendor/plugins/haml/lib/sass/constant/bool.rb
  33. +102 −0 vendor/plugins/haml/lib/sass/constant/color.rb
  34. +55 −0 vendor/plugins/haml/lib/sass/constant/functions.rb
  35. +105 −0 vendor/plugins/haml/lib/sass/constant/literal.rb
  36. +17 −0 vendor/plugins/haml/lib/sass/constant/nil.rb
  37. +100 −0 vendor/plugins/haml/lib/sass/constant/number.rb
  38. +52 −0 vendor/plugins/haml/lib/sass/constant/operation.rb
  39. +38 −0 vendor/plugins/haml/lib/sass/constant/string.rb
  40. +29 −0 vendor/plugins/haml/lib/sass/constant/unary_operation.rb
  41. +394 −0 vendor/plugins/haml/lib/sass/css.rb
  42. +536 −0 vendor/plugins/haml/lib/sass/engine.rb
  43. +35 −0 vendor/plugins/haml/lib/sass/error.rb
  44. +203 −0 vendor/plugins/haml/lib/sass/plugin.rb
  45. +56 −0 vendor/plugins/haml/lib/sass/plugin/merb.rb
  46. +24 −0 vendor/plugins/haml/lib/sass/plugin/rails.rb
  47. +53 −0 vendor/plugins/haml/lib/sass/tree/attr_node.rb
  48. +17 −0 vendor/plugins/haml/lib/sass/tree/comment_node.rb
  49. +46 −0 vendor/plugins/haml/lib/sass/tree/directive_node.rb
  50. +43 −0 vendor/plugins/haml/lib/sass/tree/node.rb
  51. +108 −0 vendor/plugins/haml/lib/sass/tree/rule_node.rb
  52. +16 −0 vendor/plugins/haml/lib/sass/tree/value_node.rb
  53. +1 −0  vendor/plugins/haml/rails/init.rb
  54. +82 −0 vendor/plugins/haml/test/benchmark.rb
  55. +588 −0 vendor/plugins/haml/test/haml/engine_test.rb
  56. +203 −0 vendor/plugins/haml/test/haml/helper_test.rb
  57. +59 −0 vendor/plugins/haml/test/haml/html2haml_test.rb
  58. +52 −0 vendor/plugins/haml/test/haml/markaby/standard.mab
  59. +6 −0 vendor/plugins/haml/test/haml/mocks/article.rb
  60. +15 −0 vendor/plugins/haml/test/haml/results/content_for_layout.xhtml
  61. +9 −0 vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml
  62. +67 −0 vendor/plugins/haml/test/haml/results/filters.xhtml
  63. +91 −0 vendor/plugins/haml/test/haml/results/helpers.xhtml
  64. +10 −0 vendor/plugins/haml/test/haml/results/helpful.xhtml
  65. +68 −0 vendor/plugins/haml/test/haml/results/just_stuff.xhtml
  66. +12 −0 vendor/plugins/haml/test/haml/results/list.xhtml
  67. +40 −0 vendor/plugins/haml/test/haml/results/nuke_inner_whitespace.xhtml
  68. +148 −0 vendor/plugins/haml/test/haml/results/nuke_outer_whitespace.xhtml
  69. +20 −0 vendor/plugins/haml/test/haml/results/original_engine.xhtml
  70. +21 −0 vendor/plugins/haml/test/haml/results/partials.xhtml
  71. +74 −0 vendor/plugins/haml/test/haml/results/silent_script.xhtml
  72. +42 −0 vendor/plugins/haml/test/haml/results/standard.xhtml
  73. +23 −0 vendor/plugins/haml/test/haml/results/tag_parsing.xhtml
  74. +5 −0 vendor/plugins/haml/test/haml/results/very_basic.xhtml
  75. +86 −0 vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml
  76. +12 −0 vendor/plugins/haml/test/haml/rhtml/_av_partial_1.rhtml
  77. +8 −0 vendor/plugins/haml/test/haml/rhtml/_av_partial_2.rhtml
  78. +62 −0 vendor/plugins/haml/test/haml/rhtml/action_view.rhtml
  79. +54 −0 vendor/plugins/haml/test/haml/rhtml/standard.rhtml
  80. +160 −0 vendor/plugins/haml/test/haml/template_test.rb
  81. +9 −0 vendor/plugins/haml/test/haml/templates/_av_partial_1.haml
  82. +5 −0 vendor/plugins/haml/test/haml/templates/_av_partial_2.haml
  83. +8 −0 vendor/plugins/haml/test/haml/templates/_partial.haml
  84. +3 −0  vendor/plugins/haml/test/haml/templates/_text_area.haml
  85. +47 −0 vendor/plugins/haml/test/haml/templates/action_view.haml
  86. +8 −0 vendor/plugins/haml/test/haml/templates/breakage.haml
  87. +10 −0 vendor/plugins/haml/test/haml/templates/content_for_layout.haml
  88. +11 −0 vendor/plugins/haml/test/haml/templates/eval_suppressed.haml
  89. +71 −0 vendor/plugins/haml/test/haml/templates/filters.haml
  90. +69 −0 vendor/plugins/haml/test/haml/templates/helpers.haml
  91. +11 −0 vendor/plugins/haml/test/haml/templates/helpful.haml
  92. +83 −0 vendor/plugins/haml/test/haml/templates/just_stuff.haml
  93. +12 −0 vendor/plugins/haml/test/haml/templates/list.haml
  94. +32 −0 vendor/plugins/haml/test/haml/templates/nuke_inner_whitespace.haml
  95. +144 −0 vendor/plugins/haml/test/haml/templates/nuke_outer_whitespace.haml
  96. +17 −0 vendor/plugins/haml/test/haml/templates/original_engine.haml
  97. +1 −0  vendor/plugins/haml/test/haml/templates/partialize.haml
  98. +12 −0 vendor/plugins/haml/test/haml/templates/partials.haml
  99. +40 −0 vendor/plugins/haml/test/haml/templates/silent_script.haml
  100. +42 −0 vendor/plugins/haml/test/haml/templates/standard.haml
  101. +21 −0 vendor/plugins/haml/test/haml/templates/tag_parsing.haml
  102. +4 −0 vendor/plugins/haml/test/haml/templates/very_basic.haml
  103. +87 −0 vendor/plugins/haml/test/haml/templates/whitespace_handling.haml
  104. +593 −0 vendor/plugins/haml/test/sass/engine_test.rb
  105. +51 −0 vendor/plugins/haml/test/sass/functions_test.rb
  106. +9 −0 vendor/plugins/haml/test/sass/more_results/more1.css
  107. +26 −0 vendor/plugins/haml/test/sass/more_results/more1_with_line_comments.css
  108. +29 −0 vendor/plugins/haml/test/sass/more_results/more_import.css
  109. +2 −0  vendor/plugins/haml/test/sass/more_templates/_more_partial.sass
  110. +23 −0 vendor/plugins/haml/test/sass/more_templates/more1.sass
  111. +11 −0 vendor/plugins/haml/test/sass/more_templates/more_import.sass
  112. +203 −0 vendor/plugins/haml/test/sass/plugin_test.rb
  113. +4 −0 vendor/plugins/haml/test/sass/results/alt.css
  114. +9 −0 vendor/plugins/haml/test/sass/results/basic.css
  115. +5 −0 vendor/plugins/haml/test/sass/results/compact.css
  116. +87 −0 vendor/plugins/haml/test/sass/results/complex.css
  117. +1 −0  vendor/plugins/haml/test/sass/results/compressed.css
  118. +16 −0 vendor/plugins/haml/test/sass/results/constants.css
  119. +19 −0 vendor/plugins/haml/test/sass/results/expanded.css
  120. +29 −0 vendor/plugins/haml/test/sass/results/import.css
  121. +49 −0 vendor/plugins/haml/test/sass/results/line_numbers.css
  122. +95 −0 vendor/plugins/haml/test/sass/results/mixins.css
  123. +24 −0 vendor/plugins/haml/test/sass/results/multiline.css
  124. +22 −0 vendor/plugins/haml/test/sass/results/nested.css
  125. +13 −0 vendor/plugins/haml/test/sass/results/parent_ref.css
  126. +1 −0  vendor/plugins/haml/test/sass/results/subdir/nested_subdir/nested_subdir.css
  127. +1 −0  vendor/plugins/haml/test/sass/results/subdir/subdir.css
  128. +2 −0  vendor/plugins/haml/test/sass/templates/_partial.sass
  129. +16 −0 vendor/plugins/haml/test/sass/templates/alt.sass
  130. +23 −0 vendor/plugins/haml/test/sass/templates/basic.sass
  131. +2 −0  vendor/plugins/haml/test/sass/templates/bork.sass
  132. +2 −0  vendor/plugins/haml/test/sass/templates/bork2.sass
  133. +17 −0 vendor/plugins/haml/test/sass/templates/compact.sass
  134. +309 −0 vendor/plugins/haml/test/sass/templates/complex.sass
  135. +15 −0 vendor/plugins/haml/test/sass/templates/compressed.sass
  136. +100 −0 vendor/plugins/haml/test/sass/templates/constants.sass
  137. +17 −0 vendor/plugins/haml/test/sass/templates/expanded.sass
  138. +11 −0 vendor/plugins/haml/test/sass/templates/import.sass
  139. +19 −0 vendor/plugins/haml/test/sass/templates/importee.sass
  140. +13 −0 vendor/plugins/haml/test/sass/templates/line_numbers.sass
  141. +76 −0 vendor/plugins/haml/test/sass/templates/mixins.sass
  142. +20 −0 vendor/plugins/haml/test/sass/templates/multiline.sass
  143. +25 −0 vendor/plugins/haml/test/sass/templates/nested.sass
  144. +25 −0 vendor/plugins/haml/test/sass/templates/parent_ref.sass
  145. +3 −0  vendor/plugins/haml/test/sass/templates/subdir/nested_subdir/nested_subdir.sass
  146. +6 −0 vendor/plugins/haml/test/sass/templates/subdir/subdir.sass
  147. +18 −0 vendor/plugins/haml/test/test_helper.rb
View
4 vendor/plugins/haml/.gitignore
@@ -0,0 +1,4 @@
+/coverage
+/rdoc
+/pkg
+/test/rails
View
138 vendor/plugins/haml/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].
View
20 vendor/plugins/haml/MIT-LICENSE
@@ -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.
View
325 vendor/plugins/haml/README.rdoc
@@ -0,0 +1,325 @@
+= Haml and Sass
+
+Haml and Sass are templating engines
+for the two most common types of documents on the web:
+HTML and CSS, respectively.
+They are designed to make it both easier and more pleasant
+to code HTML and CSS documents,
+by eliminating redundancy,
+reflecting the underlying structure that the document represents,
+and providing elegant, easily understandable, and powerful syntax.
+
+== Using
+
+There are several ways to use Haml and Sass.
+They can be used as a plugins for Rails or Merb,
+or embedded on their own in other applications.
+The first step of all of these is to install the Haml gem:
+
+ gem install haml
+
+To install Haml and Sass as a Rails plugin,
+just run <tt>haml --rails path/to/rails/app</tt>
+and both Haml and Sass will be installed.
+Views with the <tt>.haml</tt> (or <tt>.html.haml</tt> for edge)
+extension will automatically use Haml.
+Sass is a little more complicated;
+<tt>.sass</tt> files should be placed in public/stylesheets/sass,
+where they'll be automatically compiled
+to corresponding CSS files in public/stylesheets when needed
+(the Sass template directory is customizable...
+see the Sass module docs for details).
+
+For Merb, <tt>.html.haml</tt> views will work without any further modification.
+To enable Sass, you also need to add it add a dependency.
+To do so, just add
+
+ dependency "haml"
+
+to config/dependencies.rb.
+Then it'll work just like it does in Rails.
+
+To use Haml and Sass programatically,
+check out the RDocs for the Haml and Sass modules.
+
+== Formatting
+
+=== Haml
+
+The most basic element of Haml
+is a shorthand for creating HTML tags:
+
+ %tagname{ :attr1 => 'value1', :attr2 => 'value2' } Contents
+
+No end-tag is needed; Haml handles that automatically.
+Adding <tt>class</tt> and <tt>id</tt> attributes is even easier.
+Haml uses the same syntax as the CSS that styles the document:
+
+ %tagname#id.class
+
+In fact, when you're using the <tt><div></tt> tag,
+it becomes <em>even easier</em>.
+Because <tt><div></tt> is such a common element,
+a tag without a name defaults to a div. So
+
+ #foo Hello!
+
+becomes
+
+ <div id='foo'>Hello!</div>
+
+Haml uses indentation
+to bring the individual elements to represent the HTML structure.
+A tag's children are indented beneath than the parent tag.
+Again, a closing tag is automatically added.
+For example:
+
+ %ul
+ %li Salt
+ %li Pepper
+
+becomes:
+
+ <ul>
+ <li>Salt</li>
+ <li>Pepper</li>
+ </ul>
+
+You can also put plain text as a child of an element:
+
+ %p
+ Hello,
+ World!
+
+It's even possible to embed Ruby code into Haml documents.
+An equals sign, <tt>=</tt>, will output the result of the code.
+A hyphen, <tt>-</tt>, will run the code but not output the result.
+You can even use control statements
+like <tt>if</tt> and <tt>while</tt>:
+
+ %p
+ Date/Time:
+ - now = DateTime.now
+ %strong= now
+ - if now > DateTime.parse("December 31, 2006")
+ = "Happy new " + "year!"
+
+Haml provides far more tools than those presented here.
+Check out the reference documentation in the Haml module.
+
+=== Sass
+
+At its most basic,
+Sass is just another way of writing CSS.
+Although it's very much like normal CSS,
+the basic syntax offers a few helpful features:
+tabulation indicates the attributes in a rule,
+rather than non-DRY brackets;
+and newlines indicate the end of an attribute,
+rather than a semicolon.
+For example:
+
+ #main
+ :background-color #f00
+ :width 98%
+
+becomes:
+
+ #main {
+ background-color: #f00;
+ width: 98% }
+
+However, Sass provides much more than a way to make CSS look nice.
+In CSS, it's important to have accurate selectors,
+so your styles don't just apply to everything.
+However, in order to do this,
+you need to use nested element selectors.
+These get very ugly very quickly.
+I'm sure everyone's had to write something like
+"#main .sidebar .top p h1 a",
+followed by
+"#main .sidebar .top p h1 a:visited" and
+"#main .sidebar .top p h1 a:hover".
+Well, Sass gets rid of that.
+Like Haml, it uses indentation to indicate the structure of the document.
+So, what was:
+
+ #main {
+ width: 90%;
+ }
+ #main p {
+ border-style: solid;
+ border-width: 1px;
+ border-color: #00f;
+ }
+ #main p a {
+ text-decoration: none;
+ font-weight: bold;
+ }
+ #main p a:hover {
+ text-decoration: underline;
+ }
+
+becomes:
+
+ #main
+ :width 90%
+ p
+ :border-style solid
+ :border-width 1px
+ :border-color #00f
+ a
+ :text-decoration none
+ :font-weight bold
+ a:hover
+ :text-decoration underline
+
+Pretty nice, no? Well, it gets better.
+One of the main complaints against CSS is that it doesn't allow constants.
+What if have a color or a width you re-use all the time?
+In CSS, you just have to re-type it each time,
+which is a nightmare when you decide to change it later.
+Not so for Sass!
+You can use the "!" character to set constants.
+Then, if you put "=" after your attribute name,
+you can set it to a constant.
+For example:
+
+ !note_bg= #55aaff
+
+ #main
+ :width 70%
+ .note
+ :background-color= !note_bg
+ p
+ :width 5em
+ :background-color= !note_bg
+
+becomes:
+
+ #main {
+ width: 70%; }
+ #main .note {
+ background-color: #55aaff; }
+ #main p {
+ width: 5em;
+ background-color: #55aaff; }
+
+You can even do simple arithmetic operations with constants,
+adding numbers and even colors together:
+
+ !main_bg= #46ar12
+ !main_width= 40em
+
+ #main
+ :background-color= !main_bg
+ :width= !main_width
+ .sidebar
+ :background-color= !main_bg + #333333
+ :width= !main_width - 25em
+
+becomes:
+
+ #main {
+ background-color: #46a312;
+ width: 40em; }
+ #main .sidebar {
+ background-color: #79d645;
+ width: 15em; }
+
+Taking the idea of constants a bit further are mixins.
+These let you group whole swathes of CSS attributes into a single
+directive and then include those anywhere you want:
+
+ =blue-border
+ :border
+ :color blue
+ :width 2px
+ :style dotted
+
+ .comment
+ +blue-border
+ :padding 2px
+ :margin 10px 0
+
+ .reply
+ +blue-border
+
+becomes:
+
+ .comment {
+ border-color: blue;
+ border-width: 2px;
+ border-style: dotted;
+ padding: 2px;
+ margin: 10px 0;
+ }
+
+ .reply {
+ border-color: blue;
+ border-width: 2px;
+ border-style: dotted;
+ }
+
+A comprehensive list of features is in
+the documentation for the Sass module.
+
+== Indentation
+
+Indentation can be made up of one or more tabs or spaces.
+However, indentation must be consistent within a given document.
+Hard tabs and spaces can't be mixed,
+and the same number of tabs or spaces must be used throughout.
+
+== Executables
+
+The Haml gem includes several executables that are useful
+for dealing with Haml and Sass from the command line.
+
+=== +haml+
+
+The +haml+ executable transforms a source Haml file into HTML.
+See <tt>haml --help</tt> for further information and options.
+
+=== +sass+
+
+The +sass+ executable transforms a source Sass file into CSS.
+See <tt>sass --help</tt> for further information and options.
+
+=== <tt>html2haml</tt>
+
+The <tt>html2haml</tt> executable attempts to transform HTML,
+optionally with ERB markup, into Haml code.
+Since HTML is so variable, this transformation is not always perfect;
+it's a good idea to have a human check the output of this tool.
+See <tt>html2haml --help</tt> for further information and options.
+
+=== <tt>css2sass</tt>
+
+The <tt>css2sass</tt> executable attempts to transform CSS into Sass code.
+This transformation attempts to use Sass nesting where possible.
+See <tt>css2sass --help</tt> for further information and options.
+
+== Authors
+
+Haml and Sass are designed by Hampton Catlin (hcatlin) and he is the author
+of the original implementation. However, Hampton doesn't even know his way
+around the code anymore and mostly just concentrates on the language issues.
+Hampton lives in Toronto, Ontario (though he's an American by birth) and
+is a partner at Unspace Interactive.
+
+Nathan Weizenbaum is the primary maintainer and architect of the "modern" Ruby
+implementation of Haml. His hard work has kept the project alive by endlessly
+answering forum posts, fixing bugs, refactoring, finding speed improvements,
+writing documentation, implementing new features, and getting Hampton
+coffee (a fitting task for a boy-genius). Nathan lives in Seattle, Washington and
+while not being a student at University of Washington he consults for
+Unspace Interactive and Microsoft.
+
+If you use this software, you must pay Hampton a compliment. And
+buy Nathan some jelly beans. Maybe pet a kitten. Yeah. Pet that kitty.
+
+Some of the work on Haml was supported by Unspace Interactive.
+
+Beyond that, the implementation is licensed under the MIT License.
+Ok, fine, I guess that means compliments aren't *required*.
View
150 vendor/plugins/haml/Rakefile
@@ -0,0 +1,150 @@
+require 'rubygems'
+require 'rake'
+
+# ----- Benchmarking -----
+
+desc <<END
+Benchmark haml against ERb.
+ TIMES=n sets the number of runs. Defaults to 1000.
+END
+task :benchmark do
+ sh "ruby test/benchmark.rb #{ENV['TIMES']}"
+end
+
+# ----- Default: Testing ------
+
+task :default => :test
+
+require 'rake/testtask'
+
+Rake::TestTask.new do |t|
+ t.libs << 'lib'
+ test_files = FileList['test/**/*_test.rb']
+ test_files.exclude('test/rails/*')
+ t.test_files = test_files
+ t.verbose = true
+end
+Rake::Task[:test].send(:add_comment, <<END)
+To run with an alternate version of Rails, make test/rails a symlink to that version.
+END
+
+# ----- Packaging -----
+
+require 'rake/gempackagetask'
+load 'haml.gemspec'
+
+Rake::GemPackageTask.new(HAML_GEMSPEC) do |pkg|
+ if Rake.application.top_level_tasks.include?('release')
+ pkg.need_tar_gz = true
+ pkg.need_tar_bz2 = true
+ pkg.need_zip = true
+ end
+end
+
+task :revision_file do
+ require 'lib/haml'
+
+ if Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
+ File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] }
+ elsif Rake.application.top_level_tasks.include?('release')
+ File.open('REVISION', 'w') { |f| f.puts "(release)" }
+ else
+ File.open('REVISION', 'w') { |f| f.puts "(unknown)" }
+ end
+end
+Rake::Task[:package].prerequisites.insert(0, :revision_file)
+
+# We also need to get rid of this file after packaging.
+at_exit { File.delete('REVISION') rescue nil }
+
+desc "Install Haml as a gem."
+task :install => [:package] do
+ sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo'
+ sh %{#{sudo} gem install --no-ri pkg/haml-#{File.read('VERSION').strip}}
+end
+
+desc "Release a new Haml package to Rubyforge. Requires the NAME and VERSION flags."
+task :release => [:package] do
+ name, version = ENV['NAME'], ENV['VERSION']
+ raise "Must supply NAME and VERSION for release task." unless name && version
+ sh %{rubyforge login}
+ sh %{rubyforge add_release haml haml "#{name} (v#{version})" pkg/haml-#{version}.gem}
+ sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.gz}
+ sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.bz2}
+ sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.zip}
+end
+
+# ----- Documentation -----
+
+begin
+ require 'hanna/rdoctask'
+rescue LoadError
+ require 'rake/rdoctask'
+end
+
+Rake::RDocTask.new do |rdoc|
+ rdoc.title = 'Haml/Sass'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include(*FileList.new('*') do |list|
+ list.exclude(/(^|[^.a-z])[a-z]+/)
+ list.exclude('TODO')
+ end.to_a)
+ rdoc.rdoc_files.include('lib/**/*.rb')
+ rdoc.rdoc_files.exclude('TODO')
+ rdoc.rdoc_files.exclude('lib/haml/buffer.rb')
+ rdoc.rdoc_files.exclude('lib/sass/tree/*')
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.main = 'README.rdoc'
+end
+
+# ----- Coverage -----
+
+begin
+ require 'rcov/rcovtask'
+
+ Rcov::RcovTask.new do |t|
+ t.test_files = FileList['test/**/*_test.rb']
+ t.rcov_opts << '-x' << '"^\/"'
+ if ENV['NON_NATIVE']
+ t.rcov_opts << "--no-rcovrt"
+ end
+ t.verbose = true
+ end
+rescue LoadError; end
+
+# ----- Profiling -----
+
+begin
+ require 'ruby-prof'
+
+ desc <<END
+Run a profile of haml.
+ ENGINE=str sets the engine to be profiled. Defaults to Haml.
+ TIMES=n sets the number of runs. Defaults to 1000.
+ FILE=str sets the file to profile.
+ Defaults to 'standard' for Haml and 'complex' for Sass.
+ OUTPUT=str sets the ruby-prof output format.
+ Can be Flat, CallInfo, or Graph. Defaults to Flat. Defaults to Flat.
+END
+ task :profile do
+ engine = (ENV['ENGINE'] || 'haml').downcase
+ times = (ENV['TIMES'] || '1000').to_i
+ file = ENV['FILE']
+
+ if engine == 'sass'
+ require 'lib/sass'
+
+ file = File.read("#{File.dirname(__FILE__)}/test/sass/templates/#{file || 'complex'}.sass")
+ result = RubyProf.profile { times.times { Sass::Engine.new(file).render } }
+ else
+ require 'lib/haml'
+
+ file = File.read("#{File.dirname(__FILE__)}/test/haml/templates/#{file || 'standard'}.haml")
+ obj = Object.new
+ Haml::Engine.new(file).def_method(obj, :render)
+ result = RubyProf.profile { times.times { obj.render } }
+ end
+
+ RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
+ end
+rescue LoadError; end
View
9 vendor/plugins/haml/TODO
@@ -0,0 +1,9 @@
+Testing:
+ Test html2haml and css2sass
+
+Features:
+ Sass should throw generic errors for undefined constants, not syntax errors
+ Sass::Plugin should log errors
+ There should be a way to make Haml tags not insert whitespace
+ "%li, %a"?
+ Sass::Engine load_paths option should be set by executable
View
1  vendor/plugins/haml/VERSION
@@ -0,0 +1 @@
+2.1.0
View
7 vendor/plugins/haml/bin/css2sass
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../lib/haml'
+require 'haml/exec'
+
+opts = Haml::Exec::CSS2Sass.new(ARGV)
+opts.parse!
View
9 vendor/plugins/haml/bin/haml
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+# The command line Haml parser.
+
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
+require 'haml'
+require 'haml/exec'
+
+opts = Haml::Exec::Haml.new(ARGV)
+opts.parse!
View
7 vendor/plugins/haml/bin/html2haml
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../lib/haml'
+require 'haml/exec'
+
+opts = Haml::Exec::HTML2Haml.new(ARGV)
+opts.parse!
View
8 vendor/plugins/haml/bin/sass
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+# The command line Sass parser.
+
+require File.dirname(__FILE__) + '/../lib/haml'
+require 'haml/exec'
+
+opts = Haml::Exec::Sass.new(ARGV)
+opts.parse!
View
330 vendor/plugins/haml/extra/haml-mode.el
@@ -0,0 +1,330 @@
+;;; haml-mode.el -- Major mode for editing Haml files
+;;; Written by Nathan Weizenbaum
+
+;;; Because Haml's indentation schema is similar
+;;; to that of YAML and Python, many indentation-related
+;;; functions are similar to those in yaml-mode and python-mode.
+
+;;; To install, save this somewhere and add the following to your .emacs file:
+;;;
+;;; (add-to-list 'load-path "/path/to/haml-mode.el")
+;;; (require 'haml-mode nil 't)
+;;; (add-to-list 'auto-mode-alist '("\\.sass$" . sass-mode))
+;;;
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+
+;; User definable variables
+
+(defgroup haml nil
+ "Support for the Haml template language."
+ :group 'languages
+ :prefix "haml-")
+
+(defcustom haml-mode-hook nil
+ "Hook run when entering Haml mode."
+ :type 'hook
+ :group 'haml)
+
+(defcustom haml-indent-offset 2
+ "Amount of offset per level of indentation."
+ :type 'integer
+ :group 'haml)
+
+(defcustom haml-backspace-backdents-nesting t
+ "Non-nil to have `haml-electric-backspace' re-indent all code
+nested beneath the backspaced line be re-indented along with the
+line itself."
+ :type 'boolean
+ :group 'haml)
+
+(defface haml-tab-face
+ '((((class color)) (:background "hotpink"))
+ (t (:reverse-video t)))
+ "Face to use for highlighting tabs in Haml files."
+ :group 'faces
+ :group 'haml)
+
+(defvar haml-indent-function 'haml-indent-p
+ "This function should look at the current line and return true
+if the next line could be nested within this line.")
+
+(defvar haml-block-openers
+ `("^ *\\([%\\.#][^ \t]*\\)\\(\\[.*\\]\\)?\\({.*}\\)?\\(\\[.*\\]\\)?[ \t]*$"
+ "^ *[-=].*do[ \t]*\\(|.*|[ \t]*\\)?$"
+ ,(concat "^ *-[ \t]*\\("
+ (regexp-opt '("if" "unless" "while" "until" "else"
+ "begin" "elsif" "rescue" "ensure" "when"))
+ "\\)")
+ "^ */\\(\\[.*\\]\\)?[ \t]*$"
+ "^ *-#"
+ "^ *:")
+ "A list of regexps that match lines of Haml that could have
+text nested beneath them.")
+
+;; Font lock
+
+(defconst haml-font-lock-keywords
+ '(("^ *\\(\t\\)" 1 'haml-tab-face)
+ ("^!!!.*" 0 font-lock-constant-face)
+ ("\\('[^']*'\\)" 1 font-lock-string-face append)
+ ("\\(\"[^\"]*\"\\)" 1 font-lock-string-face append)
+ ("&?:\\w+" 0 font-lock-constant-face append)
+ ("@[a-z0-9_]+" 0 font-lock-variable-name-face append)
+ ("| *$" 0 font-lock-string-face)
+ ("^[ \t]*\\(/.*\\)$" 1 font-lock-comment-face append)
+ ("^ *\\(#[a-z0-9_]+\/?\\)" 1 font-lock-keyword-face)
+ ("^ *\\(\\.[a-z0-9_]+\/?\\)" 1 font-lock-type-face)
+ ("^ *\\(%[a-z0-9_]+\/?\\)" 1 font-lock-function-name-face)
+ ("^ *\\(#[a-z0-9_]+\/?\\)" (1 font-lock-keyword-face)
+ ("\\.[a-z0-9_]+" nil nil (0 font-lock-type-face)))
+ ("^ *\\(\\.[a-z0-9_]+\/?\\)" (1 font-lock-type-face)
+ ("\\.[a-z0-9_]+" nil nil (0 font-lock-type-face)))
+ ("^ *\\(\\.[a-z0-9_]+\/?\\)" (1 font-lock-type-face)
+ ("\\#[a-z0-9_]+" nil nil (0 font-lock-keyword-face)))
+ ("^ *\\(%[a-z0-9_]+\/?\\)" (1 font-lock-function-name-face)
+ ("\\.[a-z0-9_]+" nil nil (0 font-lock-type-face)))
+ ("^ *\\(%[a-z0-9_]+\/?\\)" (1 font-lock-function-name-face)
+ ("\\#[a-z0-9_]+" nil nil (0 font-lock-keyword-face)))
+ ("^ *\\([~=-] .*\\)" 1 font-lock-preprocessor-face prepend)
+ ("^ *[\\.#%a-z0-9_]+\\([~=-] .*\\)" 1 font-lock-preprocessor-face prepend)
+ ("^ *[\\.#%a-z0-9_]+\\({[^}]+}\\)" 1 font-lock-preprocessor-face prepend)
+ ("^ *[\\.#%a-z0-9_]+\\(\\[[^]]+\\]\\)" 1 font-lock-preprocessor-face prepend)))
+
+;; Mode setup
+
+(defvar haml-mode-syntax-table
+ (let ((table (make-syntax-table)))
+ (modify-syntax-entry ?: "." table)
+ (modify-syntax-entry ?_ "w" table)
+ table)
+ "Syntax table in use in haml-mode buffers.")
+
+(defvar haml-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [backspace] 'haml-electric-backspace)
+ (define-key map "\C-?" 'haml-electric-backspace)
+ (define-key map "\C-\M-f" 'haml-forward-sexp)
+ (define-key map "\C-\M-b" 'haml-backward-sexp)
+ (define-key map "\C-\M-u" 'haml-up-list)
+ (define-key map "\C-\M-d" 'haml-down-list)
+ (define-key map "\C-C\C-k" 'haml-kill-line-and-indent)
+ map))
+
+(define-derived-mode haml-mode fundamental-mode "Haml"
+ "Major mode for editing Haml files.
+
+\\{haml-mode-map}"
+ (set-syntax-table haml-mode-syntax-table)
+ (set (make-local-variable 'indent-line-function) 'haml-indent-line)
+ (set (make-local-variable 'indent-region-function) 'haml-indent-region)
+ (set (make-local-variable 'forward-sexp-function) 'haml-forward-sexp)
+ (setq font-lock-defaults '((haml-font-lock-keywords) nil t)))
+
+;; Navigation
+
+(defun haml-forward-through-whitespace (&optional backward)
+ "Move the point forward at least one line, until it reaches
+either the end of the buffer or a line with no whitespace.
+
+If `backward' is non-nil, move the point backward instead."
+ (let ((arg (if backward -1 1))
+ (endp (if backward 'bobp 'eobp)))
+ (loop do (forward-line arg)
+ while (and (not (funcall endp))
+ (looking-at "^[ \t]*$")))))
+
+(defun haml-at-indent-p ()
+ "Returns whether or not the point is at the first
+non-whitespace character in a line or whitespace preceding that
+character."
+ (let ((opoint (point)))
+ (save-excursion
+ (back-to-indentation)
+ (>= (point) opoint))))
+
+(defun haml-forward-sexp (&optional arg)
+ "Move forward across one nested expression.
+With `arg', do it that many times. Negative arg -N means move
+backward across N balanced expressions.
+
+A sexp in Haml is defined as a line of Haml code as well as any
+lines nested beneath it."
+ (interactive "p")
+ (or arg (setq arg 1))
+ (if (and (< arg 0) (not (haml-at-indent-p)))
+ (back-to-indentation)
+ (while (/= arg 0)
+ (let ((indent (current-indentation)))
+ (loop do (haml-forward-through-whitespace (< arg 0))
+ while (and (not (eobp))
+ (not (bobp))
+ (> (current-indentation) indent)))
+ (back-to-indentation)
+ (setq arg (+ arg (if (> arg 0) -1 1)))))))
+
+(defun haml-backward-sexp (&optional arg)
+ "Move backward across one nested expression.
+With ARG, do it that many times. Negative arg -N means move
+forward across N balanced expressions.
+
+A sexp in Haml is defined as a line of Haml code as well as any
+lines nested beneath it."
+ (interactive "p")
+ (haml-forward-sexp (if arg (- arg) -1)))
+
+(defun haml-up-list (&optional arg)
+ "Move out of one level of nesting.
+With ARG, do this that many times."
+ (interactive "p")
+ (or arg (setq arg 1))
+ (while (> arg 0)
+ (let ((indent (current-indentation)))
+ (loop do (haml-forward-through-whitespace t)
+ while (and (not (bobp))
+ (>= (current-indentation) indent)))
+ (setq arg (- arg 1))))
+ (back-to-indentation))
+
+(defun haml-down-list (&optional arg)
+ "Move down one level of nesting.
+With ARG, do this that many times."
+ (interactive "p")
+ (or arg (setq arg 1))
+ (while (> arg 0)
+ (let ((indent (current-indentation)))
+ (haml-forward-through-whitespace)
+ (when (<= (current-indentation) indent)
+ (haml-forward-through-whitespace t)
+ (back-to-indentation)
+ (error "Nothing is nested beneath this line"))
+ (setq arg (- arg 1))))
+ (back-to-indentation))
+
+(defun haml-mark-sexp-but-not-next-line ()
+ "Marks the next Haml sexp, but puts the mark at the end of the
+last line of the sexp rather than the first non-whitespace
+character of the next line."
+ (mark-sexp)
+ (set-mark
+ (save-excursion
+ (goto-char (mark))
+ (forward-line -1)
+ (end-of-line)
+ (point))))
+
+;; Indentation and electric keys
+
+(defun haml-indent-p ()
+ "Returns true if the current line can have lines nested beneath it."
+ (loop for opener in haml-block-openers
+ if (looking-at opener) return t
+ finally return nil))
+
+(defun haml-compute-indentation ()
+ "Calculate the maximum sensible indentation for the current line."
+ (save-excursion
+ (beginning-of-line)
+ (if (bobp) 0
+ (haml-forward-through-whitespace t)
+ (+ (current-indentation)
+ (if (funcall haml-indent-function) haml-indent-offset
+ 0)))))
+
+(defun haml-indent-region (start end)
+ "Indent each nonblank line in the region.
+This is done by indenting the first line based on
+`haml-compute-indentation' and preserving the relative
+indentation of the rest of the region.
+
+If this command is used multiple times in a row, it will cycle
+between possible indentations."
+ (save-excursion
+ (goto-char end)
+ (setq end (point-marker))
+ (goto-char start)
+ (let (this-line-column current-column
+ (next-line-column
+ (if (and (equal last-command this-command) (/= (current-indentation) 0))
+ (* (/ (- (current-indentation) 1) haml-indent-offset) haml-indent-offset)
+ (haml-compute-indentation))))
+ (while (< (point) end)
+ (setq this-line-column next-line-column
+ current-column (current-indentation))
+ ;; Delete whitespace chars at beginning of line
+ (delete-horizontal-space)
+ (unless (eolp)
+ (setq next-line-column (save-excursion
+ (loop do (forward-line 1)
+ while (and (not (eobp)) (looking-at "^[ \t]*$")))
+ (+ this-line-column
+ (- (current-indentation) current-column))))
+ ;; Don't indent an empty line
+ (unless (eolp) (indent-to this-line-column)))
+ (forward-line 1)))
+ (move-marker end nil)))
+
+(defun haml-indent-line ()
+ "Indent the current line.
+The first time this command is used, the line will be indented to the
+maximum sensible indentation. Each immediately subsequent usage will
+back-dent the line by `haml-indent-offset' spaces. On reaching column
+0, it will cycle back to the maximum sensible indentation."
+ (interactive "*")
+ (let ((ci (current-indentation))
+ (cc (current-column))
+ (need (haml-compute-indentation)))
+ (save-excursion
+ (beginning-of-line)
+ (delete-horizontal-space)
+ (if (and (equal last-command this-command) (/= ci 0))
+ (indent-to (* (/ (- ci 1) haml-indent-offset) haml-indent-offset))
+ (indent-to need)))
+ (if (< (current-column) (current-indentation))
+ (forward-to-indentation 0))))
+
+(defun haml-reindent-region-by (n)
+ "Add N spaces to the beginning of each line in the region.
+If N is negative, will remove the spaces instead. Assumes all
+lines in the region have indentation >= that of the first line."
+ (let ((ci (current-indentation)))
+ (save-excursion
+ (replace-regexp (concat "^" (make-string ci ? ))
+ (make-string (max 0 (+ ci n)) ? )
+ nil (point) (mark)))))
+
+(defun haml-electric-backspace (arg)
+ "Delete characters or back-dent the current line.
+If invoked following only whitespace on a line, will back-dent
+the line and all nested lines to the immediately previous
+multiple of `haml-indent-offset' spaces.
+
+Set `haml-backspace-backdents-nesting' to nil to just back-dent
+the current line."
+ (interactive "*p")
+ (if (or (/= (current-indentation) (current-column))
+ (bolp)
+ (looking-at "^[ \t]+$"))
+ (backward-delete-char arg)
+ (let ((ci (current-column)))
+ (beginning-of-line)
+ (if haml-backspace-backdents-nesting
+ (haml-mark-sexp-but-not-next-line)
+ (set-mark (save-excursion (end-of-line) (point))))
+ (haml-reindent-region-by (* (- arg) haml-indent-offset))
+ (back-to-indentation)
+ (pop-mark))))
+
+(defun haml-kill-line-and-indent ()
+ "Kill the current line, and re-indent all lines nested beneath it."
+ (interactive)
+ (beginning-of-line)
+ (haml-mark-sexp-but-not-next-line)
+ (kill-line 1)
+ (haml-reindent-region-by (* -1 haml-indent-offset)))
+
+;; Setup/Activation
+
+(provide 'haml-mode)
View
88 vendor/plugins/haml/extra/sass-mode.el
@@ -0,0 +1,88 @@
+;;; sass-mode.el -- Major mode for editing Sass files
+;;; Written by Nathan Weizenbaum
+
+;;; Because Sass's indentation schema is similar
+;;; to that of YAML and Python, many indentation-related
+;;; functions are similar to those in yaml-mode and python-mode.
+
+;;; To install, save this somewhere and add the following to your .emacs file:
+;;;
+;;; (add-to-list 'load-path "/path/to/sass-mode.el")
+;;; (require 'sass-mode nil 't)
+;;; (add-to-list 'auto-mode-alist '("\\.sass$" . sass-mode))
+;;;
+
+;;; Code:
+
+(require 'haml-mode)
+
+;; User definable variables
+
+(defgroup sass nil
+ "Support for the Sass template language."
+ :group 'languages
+ :prefix "sass-")
+
+(defcustom sass-mode-hook nil
+ "Hook run when entering Sass mode."
+ :type 'hook
+ :group 'sass)
+
+(defcustom sass-indent-offset 2
+ "Amount of offset per level of indentation."
+ :type 'integer
+ :group 'sass)
+
+(defvar sass-non-block-openers
+ '("^ *:[^ \t]+[ \t]+[^ \t]"
+ "^ *[^ \t:]+[ \t]*[=:][ \t]*[^ \t]")
+ "A list of regexps that match lines of Sass that couldn't have
+text nested beneath them.")
+
+;; Font lock
+
+(defconst sass-font-lock-keywords
+ '(("^ *\\(\t\\)" 1 'haml-tab-face)
+ ("^@.*" 0 font-lock-constant-face)
+ ("\\(\'[^']*'\\)" 1 font-lock-string-face append)
+ ("\\(\"[^\"]*\"\\)" 1 font-lock-string-face append)
+ ("\\(#[0-9a-fA-F]\\{3\\}\\{1,2\\}\\>\\)" 1 font-lock-string-face append)
+ ("\\(:[A-Za-z-]+\\|[A-Za-z-]+:\\)" 0 font-lock-constant-face append)
+ ("![a-z0-9_-]+" 0 font-lock-variable-name-face append)
+ ("^ *\\(/[/*].*\\)$" 1 font-lock-comment-face append)
+ ("\\(?:^\\|,\\) *\\(#[a-z0-9_-]+\/?\\)" 1 font-lock-keyword-face)
+ ("\\(?:^\\|,\\) *\\(\\.[a-z0-9_-]+\/?\\)" 1 font-lock-type-face)
+ ("\\(?:^\\|,\\) *\\(&\\|[a-z0-9_]+\/?\\)" 1 font-lock-function-name-face)
+ ("\\([=]\\)" 0 font-lock-preprocessor-face prepend)
+ ("\\(?:^\\|,\\) *\\(#[a-z0-9_]+\/?\\)" (1 font-lock-keyword-face)
+ ("\\.[a-z0-9_-]+" nil nil (0 font-lock-type-face)))
+ ("\\(?:^\\|,\\) *\\(\\.[a-z0-9_]+\/?\\)" (1 font-lock-type-face)
+ ("\\.[a-z0-9_-]+" nil nil (0 font-lock-type-face)))
+ ("\\(?:^\\|,\\) *\\(\\.[a-z0-9_]+\/?\\)" (1 font-lock-type-face)
+ ("\\#[a-z0-9_-]+" nil nil (0 font-lock-keyword-face)))
+ ("\\(?:^\\|,\\) *\\(&\\|[a-z0-9_]+\/?\\)" (1 font-lock-function-name-face)
+ ("\\.[a-z0-9_-]+" nil nil (0 font-lock-type-face)))
+ ("\\(?:^\\|,\\) *\\(&\\|[a-z0-9_]+\/?\\)" (1 font-lock-function-name-face)
+ ("\\#[a-z0-9_-]+" nil nil (0 font-lock-keyword-face)))))
+
+;; Constants
+
+;; Mode setup
+
+(define-derived-mode sass-mode haml-mode "Sass"
+ "Major mode for editing Sass files."
+ (set (make-local-variable 'haml-indent-function) 'sass-indent-p)
+ (set (make-local-variable 'haml-indent-offset) sass-indent-offset)
+ (setq font-lock-defaults '(sass-font-lock-keywords nil t)))
+
+;; Indentation
+
+(defun sass-indent-p ()
+ "Returns true if the current line can have lines nested beneath it."
+ (loop for opener in sass-non-block-openers
+ unless (looking-at opener) return t
+ return nil))
+
+;; Setup/Activation
+
+(provide 'sass-mode)
View
43 vendor/plugins/haml/haml.gemspec
@@ -0,0 +1,43 @@
+require 'rubygems'
+require 'rake'
+
+HAML_GEMSPEC = Gem::Specification.new do |spec|
+ spec.rubyforge_project = spec.name = 'haml'
+ spec.summary = "An elegant, structured XHTML/XML templating engine.\nComes with Sass, a similar CSS templating engine."
+ spec.version = File.read('VERSION').strip
+ spec.authors = ['Nathan Weizenbaum', 'Hampton Catlin']
+ spec.email = 'haml@googlegroups.com'
+ spec.description = <<-END
+ 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.
+ END
+ #'
+
+ # We need the revision file to exist,
+ # so we just create it if it doesn't.
+ # It'll usually just get overwritten, though.
+ File.open('REVISION', 'w') { |f| f.puts "(unknown)" } unless File.exist?('REVISION')
+ readmes = FileList.new('*') do |list|
+ list.exclude(/(^|[^.a-z])[a-z]+/)
+ list.exclude('TODO')
+ list.include('REVISION')
+ end.to_a
+ spec.executables = ['haml', 'html2haml', 'sass', 'css2sass']
+ spec.files = FileList['rails/init.rb', 'lib/**/*', 'bin/*', 'test/**/*', 'Rakefile', 'init.rb'].to_a + readmes
+ spec.homepage = 'http://haml.hamptoncatlin.com/'
+ spec.has_rdoc = true
+ spec.extra_rdoc_files = readmes
+ spec.rdoc_options += [
+ '--title', 'Haml',
+ '--main', 'README.rdoc',
+ '--exclude', 'lib/haml/buffer.rb',
+ '--line-numbers',
+ '--inline-source'
+ ]
+ spec.test_files = FileList['test/**/*_test.rb'].to_a
+end
View
1,044 vendor/plugins/haml/lib/haml.rb
@@ -0,0 +1,1044 @@
+dir = File.dirname(__FILE__)
+$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
+
+# = Haml (XHTML Abstraction Markup Language)
+#
+# Haml is a markup language
+# that's used to cleanly and simply describe the XHTML of any web document,
+# without the use of inline code.
+# Haml functions as a replacement
+# for inline page templating systems such as PHP, ERB, and ASP.
+# However, Haml avoids the need for explicitly coding XHTML into the template,
+# because it is actually an abstract description of the XHTML,
+# with some code to generate dynamic content.
+#
+# == Features
+#
+# * Whitespace active
+# * Well-formatted markup
+# * DRY
+# * Follows CSS conventions
+# * Integrates Ruby code
+# * Implements Rails templates with the .haml extension
+#
+# == Using Haml
+#
+# Haml can be used in three ways:
+# as a plugin for Ruby on Rails,
+# as a standalone Ruby module,
+# and as a command-line tool.
+# The first step for all of these is to install the Haml gem:
+#
+# gem install haml
+#
+# To enable it as a Rails plugin,
+# then run
+#
+# haml --rails path/to/rails/app
+#
+# Once it's installed, all view files with the ".html.haml" extension
+# will be compiled using Haml.
+#
+# To run Haml from the commandline, just use
+#
+# haml input.haml output.html
+#
+# Use <tt>haml --help</tt> for full documentation.
+#
+# You can access instance variables in Haml templates
+# the same way you do in ERb templates.
+# Helper methods are also available in Haml templates.
+# For example (this example uses Rails, but the principle for Merb is the same):
+#
+# # file: app/controllers/movies_controller.rb
+#
+# class MoviesController < ApplicationController
+# def index
+# @title = "Teen Wolf"
+# end
+# end
+#
+# -# file: app/views/movies/index.haml
+#
+# #content
+# .title
+# %h1= @title
+# = link_to 'Home', home_url
+#
+# may be compiled to:
+#
+# <div id='content'>
+# <div class='title'>
+# <h1>Teen Wolf</h1>
+# <a href='/'>Home</a>
+# </div>
+# </div>
+#
+# === Ruby Module
+#
+# Haml can also be used completely separately from Rails and ActionView.
+# To do this, install the gem with RubyGems:
+#
+# gem install haml
+#
+# You can then use it by including the "haml" gem in Ruby code,
+# and using Haml::Engine like so:
+#
+# engine = Haml::Engine.new("%p Haml code!")
+# engine.render #=> "<p>Haml code!</p>\n"
+#
+# == Characters with meaning to Haml
+#
+# Various characters, when placed at a certain point in a line,
+# instruct Haml to render different types of things.
+#
+# === XHTML Tags
+#
+# These characters render XHTML tags.
+#
+# ==== %
+#
+#
+# The percent character is placed at the beginning of a line.
+# It's followed immediately by the name of an element,
+# then optionally by modifiers (see below), a space,
+# and text to be rendered inside the element.
+# It creates an element in the form of <tt><element></element></tt>.
+# For example:
+#
+# %one
+# %two
+# %three Hey there
+#
+# is compiled to:
+#
+# <one>
+# <two>
+# <three>Hey there</three>
+# </two>
+# </one>
+#
+# Any string is a valid element name;
+# Haml will automatically generate opening and closing tags for any element.
+#
+# ==== {}
+#
+# Brackets represent a Ruby hash
+# that is used for specifying the attributes of an element.
+# It is literally evaluated as a Ruby hash,
+# so logic will work in it and local variables may be used.
+# Quote characters within the attribute
+# will be replaced by appropriate escape sequences.
+# The hash is placed after the tag is defined.
+# For example:
+#
+# %html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
+#
+# is compiled to:
+#
+# <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"></html>
+#
+# Attribute hashes can also be stretched out over multiple lines
+# to accomidate many attributes.
+# However, newlines may only be placed immediately after commas.
+# For example:
+#
+# %script{:type => "text/javascript",
+# :src => "javascripts/script_#{2 + 7}"}
+#
+# is compiled to:
+#
+# <script src='javascripts/script_9' type='text/javascript'></script>
+#
+# ===== Attribute Methods
+#
+# A Ruby method call that returns a hash
+# can be substituted for the hash contents.
+# For example, Haml::Helpers defines the following method:
+#
+# def html_attrs(lang = 'en-US')
+# {:xmlns => "http://www.w3.org/1999/xhtml", 'xml:lang' => lang, :lang => lang}
+# end
+#
+# This can then be used in Haml, like so:
+#
+# %html{html_attrs('fr-fr')}
+#
+# This is compiled to:
+#
+# <html lang='fr-fr' xml:lang='fr=fr' xmlns='http://www.w3.org/1999/xhtml'>
+# </html>
+#
+# You can use as many such attribute methods as you want
+# by separating them with commas,
+# like a Ruby argument list.
+# All the hashes will me merged together, from left to right.
+# For example, if you defined
+#
+# def hash1
+# {:bread => 'white', :filling => 'peanut butter and jelly'}
+# end
+#
+# def hash2
+# {:bread => 'whole wheat'}
+# end
+#
+# then
+#
+# %sandwich{hash1, hash2, :delicious => true}/
+#
+# would compile to:
+#
+# <sandwich bread='whole wheat' delicious='true' filling='peanut butter and jelly' />
+#
+# ===== Boolean Attributes
+#
+# Some attributes, such as "checked" for <tt>input</tt> tags or "selected" for <tt>option</tt> tags,
+# are "boolean" in the sense that their values don't matter -
+# it only matters whether or not they're present.
+# In HTML (but not XHTML), these attributes can be written as
+#
+# <input selected>
+#
+# To do this in Haml, just assign a Ruby true value to the attribute:
+#
+# %input{:selected => true}
+#
+# In XHTML, the only valid value for these attributes is the name of the attribute.
+# Thus this will render in XHTML as
+#
+# <input selected="selected">
+#
+# To set these attributes to false, simply assign them to a Ruby false value.
+# In both XHTML and HTML
+#
+# %input{:selected => false}
+#
+# will just render as
+#
+# <input>
+#
+# ==== []
+#
+# Square brackets follow a tag definition and contain a Ruby object
+# that is used to set the class and id of that tag.
+# The class is set to the object's class
+# (transformed to use underlines rather than camel case)
+# and the id is set to the object's class, followed by its id.
+# Because the id of an object is normally an obscure implementation detail,
+# this is most useful for elements that represent instances of Models.
+# Additionally, the second argument (if present) will be used as a prefix for
+# both the id and class attributes.
+# For example:
+#
+# # file: app/controllers/users_controller.rb
+#
+# def show
+# @user = CrazyUser.find(15)
+# end
+#
+# -# file: app/views/users/show.haml
+#
+# %div[@user, :greeting]
+# %bar[290]/
+# Hello!
+#
+# is compiled to:
+#
+# <div class="greeting_crazy_user" id="greeting_crazy_user_15">
+# <bar class="fixnum" id="fixnum_581" />
+# Hello!
+# </div>
+#
+# ==== /
+#
+# The forward slash character, when placed at the end of a tag definition,
+# causes the tag to be self-closed.
+# For example:
+#
+# %br/
+# %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/
+#
+# is compiled to:
+#
+# <br />
+# <meta http-equiv='Content-Type' content='text/html' />
+#
+# Some tags are automatically closed, as long as they have no content.
+# +meta+, +img+, +link+, +script+, +br+, and +hr+ tags are closed by default.
+# This list can be customized by setting the <tt>:autoclose</tt> option (see below).
+# For example:
+#
+# %br
+# %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}
+#
+# is also compiled to:
+#
+# <br />
+# <meta http-equiv='Content-Type' content='text/html' />
+#
+# ==== . and #
+#
+# The period and pound sign are borrowed from CSS.
+# They are used as shortcuts to specify the <tt>class</tt>
+# and <tt>id</tt> attributes of an element, respectively.
+# Multiple class names can be specified in a similar way to CSS,
+# by chaining the class names together with periods.
+# They are placed immediately after the tag and before an attributes hash.
+# For example:
+#
+# %div#things
+# %span#rice Chicken Fried
+# %p.beans{ :food => 'true' } The magical fruit
+# %h1.class.otherclass#id La La La
+#
+# is compiled to:
+#
+# <div id='things'>
+# <span id='rice'>Chicken Fried</span>
+# <p class='beans' food='true'>The magical fruit</p>
+# <h1 class='class otherclass' id='id'>La La La</h1>
+# </div>
+#
+# And,
+#
+# #content
+# .articles
+# .article.title
+# Doogie Howser Comes Out
+# .article.date
+# 2006-11-05
+# .article.entry
+# Neil Patrick Harris would like to dispel any rumors that he is straight
+#
+# is compiled to:
+#
+# <div id="content">
+# <div class="articles">
+# <div class="article title">Doogie Howser Comes Out</div>
+# <div class="article date">2006-11-05</div>
+# <div class="article entry">
+# Neil Patrick Harris would like to dispel any rumors that he is straight
+# </div>
+# </div>
+# </div>
+#
+# ==== Implicit Div Elements
+#
+# Because the div element is used so often, it is the default element.
+# If you only define a class and/or id using the <tt>.</tt> or <tt>#</tt> syntax,
+# a div element is automatically used.
+# For example:
+#
+# #collection
+# .item
+# .description What a cool item!
+#
+# is the same as:
+#
+# %div{:id => collection}
+# %div{:class => 'item'}
+# %div{:class => 'description'} What a cool item!
+#
+# and is compiled to:
+#
+# <div id='collection'>
+# <div class='item'>
+# <div class='description'>What a cool item!</div>
+# </div>
+# </div>
+#
+# ==== > and <
+#
+# <tt>></tt> and <tt><</tt> give you more control over the whitespace near a tag.
+# <tt>></tt> will remove all whitespace surrounding a tag,
+# while <tt><</tt> will remove all whitespace immediately within a tag.
+# You can think of them as alligators eating the whitespace:
+# <tt>></tt> faces out of the tag and eats the whitespace on the outside,
+# and <tt><</tt> faces into the tag and eats the whitespace on the inside.
+# They're placed at the end of a tag definition,
+# after class, id, and attribute declarations
+# but before <tt>/</tt> or <tt>=</tt>.
+# For example:
+#
+# %blockquote<
+# %div
+# Foo!
+#
+# is compiled to:
+#
+# <blockquote><div>
+# Foo!
+# </div></blockquote>
+#
+# And:
+#
+# %img
+# %img>
+# %img
+#
+# is compiled to:
+#
+# <img /><img /><img />
+#
+# And:
+#
+# %p<= "Foo\nBar"
+#
+# is compiled to:
+#
+# <p>Foo
+# Bar</p>
+#
+# And finally:
+#
+# %img
+# %pre><
+# foo
+# bar
+# %img
+#
+# is compiled to:
+#
+# <img /><pre>foo
+# bar</pre><img />
+#
+# ==== =
+#
+# <tt>=</tt> is placed at the end of a tag definition,
+# after class, id, and attribute declarations.
+# It's just a shortcut for inserting Ruby code into an element.
+# It works the same as <tt>=</tt> without a tag:
+# it inserts the result of the Ruby code into the template.
+# However, if the result is short enough,
+# it is displayed entirely on one line.
+# For example:
+#
+# %p= "hello"
+#
+# is not quite the same as:
+#
+# %p
+# = "hello"
+#
+# It's compiled to:
+#
+# <p>hello</p>
+#
+# ==== ~
+#
+# ~ works just like =, except that it runs Haml::Helpers#find_and_preserve on its input.
+# For example,
+#
+# ~ "Foo\n<pre>Bar\nBaz</pre>"
+#
+# is the same as:
+#
+# = find_and_preserve("Foo\n<pre>Bar\nBaz</pre>")
+#
+# and is compiled to:
+#
+# Foo
+# <pre>Bar&#x000A;Baz</pre>
+#
+# See also Whitespace Preservation, below.
+#
+# === XHTML Helpers
+#
+# ==== No Special Character
+#
+# If no special character appears at the beginning of a line,
+# the line is rendered as plain text.
+# For example:
+#
+# %gee
+# %whiz
+# Wow this is cool!
+#
+# is compiled to:
+#
+# <gee>
+# <whiz>
+# Wow this is cool!
+# </whiz>
+# </gee>
+#
+# ==== !!!
+#
+# When describing XHTML documents with Haml,
+# you can have a document type or XML prolog generated automatically
+# by including the characters <tt>!!!</tt>.
+# For example:
+#
+# !!! XML
+# !!!
+# %html
+# %head
+# %title Myspace
+# %body
+# %h1 I am the international space station
+# %p Sign my guestbook
+#
+# is compiled to:
+#
+# <?xml version="1.0" encoding="utf-8" ?>
+# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+# <html>
+# <head>
+# <title>Myspace</title>
+# </head>
+# <body>
+# <h1>I am the international space station</h1>
+# <p>Sign my guestbook</p>
+# </body>
+# </html>
+#
+# You can also specify the version and type of XHTML after the <tt>!!!</tt>.
+# XHTML 1.0 Strict, Transitional, and Frameset and XHTML 1.1 are supported.
+# The default version is 1.0 and the default type is Transitional.
+# For example:
+#
+# !!! 1.1
+#
+# is compiled to:
+#
+# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+#
+# and
+#
+# !!! Strict
+#
+# is compiled to:
+#
+# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+#
+# If you're not using the UTF-8 character set for your document,
+# you can specify which encoding should appear
+# in the XML prolog in a similar way.
+# For example:
+#
+# !!! XML iso-8859-1
+#
+# is compiled to:
+#
+# <?xml version="1.0" encoding="iso-8859-1" ?>
+#
+# ==== /
+#
+# The forward slash character, when placed at the beginning of a line,
+# wraps all text after it in an HTML comment.
+# For example:
+#
+# %peanutbutterjelly
+# / This is the peanutbutterjelly element
+# I like sandwiches!
+#
+# is compiled to:
+#
+# <peanutbutterjelly>
+# <!-- This is the peanutbutterjelly element -->
+# I like sandwiches!
+# </peanutbutterjelly>
+#
+# The forward slash can also wrap indented sections of code. For example:
+#
+# /
+# %p This doesn't render...
+# %div
+# %h1 Because it's commented out!
+#
+# is compiled to:
+#
+# <!--
+# <p>This doesn't render...</p>
+# <div>
+# <h1>Because it's commented out!</h1>
+# </div>
+# -->
+#
+# You can also use Internet Explorer conditional comments
+# (about)[http://www.quirksmode.org/css/condcom.html]
+# by enclosing the condition in square brackets after the <tt>/</tt>.
+# For example:
+#
+# /[if IE]
+# %a{ :href => 'http://www.mozilla.com/en-US/firefox/' }
+# %h1 Get Firefox
+#
+# is compiled to:
+#
+# <!--[if IE]>
+# <a href='http://www.mozilla.com/en-US/firefox/'>
+# <h1>Get Firefox</h1>
+# </a>
+# <![endif]-->
+#
+# ==== \
+#
+# The backslash character escapes the first character of a line,
+# allowing use of otherwise interpreted characters as plain text.
+# For example:
+#
+# %title
+# = @title
+# \- MySite
+#
+# is compiled to:
+#
+# <title>
+# MyPage
+# - MySite
+# </title>
+#
+# ==== |
+#
+# The pipe character designates a multiline string.
+# It's placed at the end of a line
+# and means that all following lines that end with <tt>|</tt>
+# will be evaluated as though they were on the same line.
+# For example:
+#
+# %whoo
+# %hoo I think this might get |
+# pretty long so I should |
+# probably make it |
+# multiline so it doesn't |
+# look awful. |
+# %p This is short.
+#
+# is compiled to:
+#
+# <whoo>
+# <hoo>
+# I think this might get pretty long so I should probably make it multiline so it doesn't look awful.
+# </hoo>
+# <p>This is short</p>
+# </whoo>
+#
+# ==== :
+#
+# The colon character designates a filter.
+# This allows you to pass an indented block of text as input
+# to another filtering program and add the result to the output of Haml.
+# The syntax is simply a colon followed by the name of the filter.
+# For example,
+#
+# %p
+# :markdown
+# Textile
+# =======
+#
+# Hello, *World*
+#
+# is compiled to
+#
+# <p>
+# <h1>Textile</h1>
+#
+# <p>Hello, <em>World</em></p>
+# </p>
+#
+# Filters can have Ruby code interpolated, like with ==.
+# For example,
+#
+# - flavor = "raspberry"
+# #content
+# :textile
+# I *really* prefer _#{h flavor}_ jam.
+#
+# is compiled to
+#
+# <div id='content'>
+# <p>I <strong>really</strong> prefer <em>raspberry</em> jam.</p>
+# </div>
+#
+# Haml has the following filters defined:
+#
+# [plain] Does not parse the filtered text.
+# This is useful for large blocks of text without HTML tags,
+# when you don't want lines starting with <tt>.</tt> or <tt>-</tt>
+# to be parsed.
+#
+# [javascript] Surrounds the filtered text with <script> and CDATA tags.
+# Useful for including inline Javascript.
+#
+# [escaped] Works the same as plain, but HTML-escapes the text
+# before placing it in the document.
+#
+# [ruby] Parses the filtered text with the normal Ruby interpreter.
+# All output sent to <tt>$stdout</tt>, like with +puts+,
+# is output into the Haml document.
+# Not available if the <tt>suppress_eval</tt> option is set to true.
+# The Ruby code is evaluated in the same context as the Haml template.
+#
+# [preserve] Inserts the filtered text into the template with whitespace preserved.
+# <tt>preserve</tt>d blocks of text aren't indented,
+# and newlines are replaced with the HTML escape code for newlines,
+# to preserve nice-looking output.
+# See also Whitespace Preservation, below.
+#
+# [erb] Parses the filtered text with ERB, like an RHTML template.
+# Not available if the <tt>suppress_eval</tt> option is set to true.
+# Embedded Ruby code is evaluated in the same context as the Haml template.
+#
+# [sass] Parses the filtered text with Sass to produce CSS output.
+#
+# [textile] Parses the filtered text with Textile (http://www.textism.com/tools/textile).
+# Only works if RedCloth is installed.
+#
+# [markdown] Parses the filtered text with Markdown (http://daringfireball.net/projects/markdown).
+# Only works if RDiscount, RPeg-Markdown, Maruku, or BlueCloth are installed.
+#
+# [maruku] Parses the filtered text with Maruku, which has some non-standard extensions to Markdown.
+#
+# You can also define your own filters (see Haml::Filters).
+#
+# === Ruby evaluators
+#
+# ==== =
+#
+# The equals character is followed by Ruby code,
+# which is evaluated and the output inserted into the document as plain text.
+# For example:
+#
+# %p
+# = ['hi', 'there', 'reader!'].join " "
+# = "yo"
+#
+# is compiled to:
+#
+# <p>
+# hi there reader!
+# yo
+# </p>
+#
+# If the <tt>:escape_html</tt> option is set, <tt>=</tt> will sanitize any
+# HTML-sensitive characters generated by the script. For example:
+#
+# = '<script>alert("I\'m evil!");</script>'
+#
+# would be compiled to
+#
+# &lt;script&gt;alert(&quot;I'm evil!&quot;);&lt;/script&gt;
+#
+# ==== -
+#
+# The hyphen character makes the text following it into "silent script":
+# Ruby script that is evaluated, but not output.
+#
+# <b>It is not recommended that you use this widely;
+# almost all processing code and logic should be restricted
+# to the Controller, the Helper, or partials.</b>
+#
+# For example:
+#
+# - foo = "hello"
+# - foo << " there"
+# - foo << " you!"
+# %p= foo
+#
+# is compiled to:
+#
+# <p>
+# hello there you!
+# </p>
+#
+# ==== ==
+#
+# Two equals characters interpolates Ruby code into plain text,
+# similarly to Ruby string interpolation.
+# For example,
+#
+# %p== This is #{h quality} cake!
+#
+# is the same as
+#
+# %p= "This is #{h quality} cake!"
+#
+# and might compile to
+#
+# <p>This is scrumptious cake!</p>
+#
+# Backslashes can be used to escape "#{" strings,
+# but they don't act as escapes anywhere else in the string.
+# For example:
+#
+# %p
+# == \\ Look at \\#{h word} lack of backslash: \#{foo}
+#
+# might compile to
+#
+# <p>
+# \\ Look at \yon lack of backslash: #{foo}
+# </p>
+#
+# ==== &=
+#
+# An ampersand followed by one or two equals characters
+# evaluates Ruby code just like the equals without the ampersand,
+# but sanitizes any HTML-sensitive characters in the result of the code.
+# For example:
+#
+# &= "I like cheese & crackers"
+#
+# compiles to
+#
+# I like cheese &amp; crackers
+#
+# If the <tt>:escape_html</tt> option is set,
+# &= behaves identically to =.
+#
+# ==== !=
+#
+# An exclamation mark followed by one or two equals characters
+# evaluates Ruby code just like the equals would,
+# but never sanitizes the HTML.
+#
+# By default, the single equals doesn't sanitize HTML either.
+# However, if the <tt>:escape_html</tt> option is set, = will sanitize the HTML, but != still won't.
+# For example, if <tt>:escape_html</tt> is set:
+#
+# = "I feel <strong>!"
+# != "I feel <strong>!"
+#
+# compiles to
+#
+# I feel &lt;strong&gt;!
+# I feel <strong>!
+#
+# ===== Blocks
+#
+# Ruby blocks, like XHTML tags, don't need to be explicitly closed in Haml.
+# Rather, they're automatically closed, based on indentation.
+# A block begins whenever the indentation is increased
+# after a silent script command.
+# It ends when the indentation decreases
+# (as long as it's not an +else+ clause or something similar).
+# For example:
+#
+# - (42...47).each do |i|
+# %p= i
+# %p See, I can count!
+#
+# is compiled to:
+#
+# <p>
+# 42
+# </p>
+# <p>
+# 43
+# </p>
+# <p>
+# 44
+# </p>
+# <p>
+# 45
+# </p>
+# <p>
+# 46
+# </p>
+#
+# Another example:
+#
+# %p
+# - case 2
+# - when 1
+# = "1!"
+# - when 2
+# = "2?"
+# - when 3
+# = "3."
+#
+# is compiled to:
+#
+# <p>
+# 2?
+# </p>
+#
+# ==== -#
+#
+# The hyphen followed immediately by the pound sign
+# signifies a silent comment.
+# Any text following this isn't rendered in the resulting document
+# at all.
+#
+# For example:
+#
+# %p foo
+# -# This is a comment
+# %p bar
+#
+# is compiled to:
+#
+# <p>foo</p>
+# <p>bar</p>
+#
+# You can also nest text beneath a silent comment.
+# None of this text will be rendered.
+# For example:
+#
+# %p foo
+# -#
+# This won't be displayed
+# Nor will this
+# %p bar
+#
+# is compiled to:
+#
+# <p>foo</p>
+# <p>bar</p>
+#
+# == Other Useful Things
+#
+# === Whitespace Preservation
+#
+# Sometimes you don't want Haml to indent all your text.
+# For example, tags like +pre+ and +textarea+ are whitespace-sensitive;
+# indenting the text makes them render wrong.
+#
+# Haml deals with this by "preserving" newlines before they're put into the document --
+# converting them to the XHTML whitespace escape code, <tt>&#x000A;</tt>.
+# Then Haml won't try to re-format the indentation.
+#
+# Literal +textarea+ and +pre+ tags automatically preserve their content.
+# Dynamically can't be caught automatically,
+# and so should be passed through Haml::Helpers#find_and_preserve or the <tt>~</tt> command,
+# which has the same effect (see above).
+#
+# Blocks of literal text can be preserved using the :preserve filter (see above).
+#
+# === Helpers
+#
+# Haml offers a bunch of helpers that are useful
+# for doing stuff like preserving whitespace,
+# creating nicely indented output for user-defined helpers,
+# and other useful things.
+# The helpers are all documented in the Haml::Helpers and Haml::Helpers::ActionViewExtensions modules.
+#
+# === Haml Options
+#
+# Options can be set by setting the <tt>Haml::Template.options</tt> hash
+# in <tt>environment.rb</tt> in Rails...
+#
+# Haml::Template.options[:format] = :html5
+#
+# ...or by setting the <tt>Merb::Config[:haml]</tt> hash in <tt>init.rb</tt> in Merb...
+#
+# Merb::Config[:haml][:format] = :html5
+#
+# ...or by passing an options hash to Haml::Engine.new.
+# Available options are:
+#
+# [<tt>:format</tt>] Determines the output format. The default is :xhtml.
+# Other options are :html4 and :html5, which are
+# identical to :xhtml except there are no self-closing tags,
+# XML prolog is ignored and correct DOCTYPEs are generated.
+#
+# [<tt>:escape_html</tt>] Sets whether or not to escape HTML-sensitive characters in script.
+# If this is true, = behaves like &=;
+# otherwise, it behaves like !=.
+# Note that if this is set, != should be used for yielding to subtemplates
+# and rendering partials.
+# Defaults to false.
+#
+# [<tt>:suppress_eval</tt>] Whether or not attribute hashes and Ruby scripts
+# designated by <tt>=</tt> or <tt>~</tt> should be
+# evaluated. If this is true, said scripts are
+# rendered as empty strings. Defaults to false.
+#
+# [<tt>:attr_wrapper</tt>] The character that should wrap element attributes.
+# This defaults to <tt>'</tt> (an apostrophe). Characters
+# of this type within the attributes will be escaped
+# (e.g. by replacing them with <tt>&apos;</tt>) if
+# the character is an apostrophe or a quotation mark.
+#
+# [<tt>:filename</tt>] The name of the Haml file being parsed.
+# This is only used as information when exceptions are raised.
+# This is automatically assigned when working through ActionView,
+# so it's really only useful for the user to assign
+# when dealing with Haml programatically.
+#
+# [<tt>:line</tt>] The line offset of the Haml template being parsed.
+# This is useful for inline templates,
+# similar to the last argument to Kernel#eval.
+#
+# [<tt>:autoclose</tt>] A list of tag names that should be automatically self-closed
+# if they have no content.
+# Defaults to <tt>['meta', 'img', 'link', 'br', 'hr', 'input', 'area', 'param', 'col', 'base']</tt>.
+#
+# [<tt>:preserve</tt>] A list of tag names that should automatically have their newlines preserved
+# using the Haml::Helpers#preserve helper.
+# This means that any content given on the same line as the tag will be preserved.
+# For example:
+#
+# %textarea= "Foo\nBar"
+#
+# compiles to:
+#
+# <textarea>Foo&&#x000A;Bar</textarea>
+#
+# Defaults to <tt>['textarea', 'pre']</tt>.
+#
+# See also Whitespace Preservation, above.
+#
+module Haml
+ # Returns a hash representing the version of Haml.
+ # The :major, :minor, and :teeny keys have their respective numbers.
+ # The :string key contains a human-readable string representation of the version.
+ # If Haml is checked out from Git,
+ # the :rev key will have the revision hash.
+ def self.version
+ return @@version if defined?(@@version)
+
+ numbers = File.read(scope('VERSION')).strip.split('.').map { |n| n.to_i }
+ @@version = {
+ :major => numbers[0],
+ :minor => numbers[1],
+ :teeny => numbers[2]
+ }
+ @@version[:string] = [:major, :minor, :teeny].map { |comp| @@version[comp] }.compact.join('.')
+
+ if File.exists?(scope('REVISION'))
+ rev = File.read(scope('REVISION')).strip
+ rev = nil if rev !~ /^([a-f0-9]+|\(.*\))$/
+ end
+
+ if rev.nil? && File.exists?(scope('.git/HEAD'))
+ rev = File.read(scope('.git/HEAD')).strip
+ if rev =~ /^ref: (.*)$/
+ rev = File.read(scope(".git/#{$1}")).strip
+ end
+ end
+
+ if rev
+ @@version[:rev] = rev
+ unless rev[0] == ?(
+ @@version[:string] << "."
+ @@version[:string] << rev[0...7]
+ end
+ end
+
+ @@version
+ end
+
+ # Returns the path of file relative to the Haml root.
+ def self.scope(file) # :nodoc:
+ File.join(File.dirname(__FILE__), '..', file)
+ end
+
+ # A string representing the version of Haml.
+ # A more fine-grained representation is generated by Haml.version.
+ VERSION = version[:string] unless defined?(Haml::VERSION)
+
+ # This method is called by init.rb,
+ # which is run by Rails on startup.
+ # We use it rather than putting stuff straight into init.rb
+ # so we can change the initialization behavior
+ # without modifying the file itself.
+ def self.init_rails(binding)
+ # No &method here for Rails 2.1 compatibility
+ %w[haml/template sass sass/plugin].each {|f| require f}
+ end
+end
+
+require 'haml/engine'
View
236 vendor/plugins/haml/lib/haml/buffer.rb
@@ -0,0 +1,236 @@
+module Haml
+ # This class is used only internally. It holds the buffer of XHTML that
+ # is eventually output by Haml::Engine's to_html method. It's called
+ # from within the precompiled code, and helps reduce the amount of
+ # processing done within instance_eval'd code.
+ class Buffer
+ include Haml::Helpers
+
+ # The string that holds the compiled XHTML. This is aliased as
+ # _erbout for compatibility with ERB-specific code.
+ attr_accessor :buffer
+
+ # The options hash passed in from Haml::Engine.
+ attr_accessor :options
+
+ # The Buffer for the enclosing Haml document.
+ # This is set for partials and similar sorts of nested templates.
+ # It's nil at the top level (see #toplevel?).
+ attr_accessor :upper
+
+ # See #active?
+ attr_writer :active
+
+ # True if the format is XHTML
+ def xhtml?
+ not html?
+ end
+
+ # True if the format is any flavor of HTML
+ def html?
+ html4? or html5?
+ end