haml 4.0.7 → 5.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +18 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +54 -0
  5. data/.yardopts +1 -1
  6. data/CHANGELOG.md +96 -4
  7. data/FAQ.md +4 -14
  8. data/Gemfile +19 -0
  9. data/MIT-LICENSE +1 -1
  10. data/README.md +80 -42
  11. data/REFERENCE.md +116 -64
  12. data/Rakefile +46 -54
  13. data/TODO +24 -0
  14. data/benchmark.rb +66 -0
  15. data/haml.gemspec +38 -0
  16. data/lib/haml/.gitattributes +1 -0
  17. data/lib/haml/attribute_builder.rb +163 -0
  18. data/lib/haml/attribute_compiler.rb +223 -0
  19. data/lib/haml/attribute_parser.rb +148 -0
  20. data/lib/haml/buffer.rb +22 -132
  21. data/lib/haml/compiler.rb +89 -298
  22. data/lib/haml/engine.rb +25 -41
  23. data/lib/haml/error.rb +3 -0
  24. data/lib/haml/escapable.rb +49 -0
  25. data/lib/haml/exec.rb +38 -19
  26. data/lib/haml/filters.rb +18 -24
  27. data/lib/haml/generator.rb +41 -0
  28. data/lib/haml/helpers/action_view_extensions.rb +3 -2
  29. data/lib/haml/helpers/action_view_mods.rb +42 -60
  30. data/lib/haml/helpers/action_view_xss_mods.rb +1 -0
  31. data/lib/haml/helpers/safe_erubi_template.rb +19 -0
  32. data/lib/haml/helpers/safe_erubis_template.rb +4 -1
  33. data/lib/haml/helpers/xss_mods.rb +18 -12
  34. data/lib/haml/helpers.rb +132 -89
  35. data/lib/haml/options.rb +41 -47
  36. data/lib/haml/parser.rb +278 -216
  37. data/lib/haml/{template/plugin.rb → plugin.rb} +8 -15
  38. data/lib/haml/railtie.rb +38 -12
  39. data/lib/haml/sass_rails_filter.rb +17 -4
  40. data/lib/haml/template/options.rb +12 -2
  41. data/lib/haml/template.rb +12 -6
  42. data/lib/haml/temple_engine.rb +121 -0
  43. data/lib/haml/temple_line_counter.rb +29 -0
  44. data/lib/haml/util.rb +80 -199
  45. data/lib/haml/version.rb +2 -1
  46. data/lib/haml.rb +1 -0
  47. data/yard/default/.gitignore +1 -0
  48. data/yard/default/fulldoc/html/css/common.sass +15 -0
  49. data/yard/default/layout/html/footer.erb +12 -0
  50. metadata +50 -111
  51. data/test/engine_test.rb +0 -2013
  52. data/test/erb/_av_partial_1.erb +0 -12
  53. data/test/erb/_av_partial_2.erb +0 -8
  54. data/test/erb/action_view.erb +0 -62
  55. data/test/erb/standard.erb +0 -55
  56. data/test/filters_test.rb +0 -254
  57. data/test/gemfiles/Gemfile.rails-3.0.x +0 -5
  58. data/test/gemfiles/Gemfile.rails-3.1.x +0 -6
  59. data/test/gemfiles/Gemfile.rails-3.2.x +0 -5
  60. data/test/gemfiles/Gemfile.rails-4.0.x +0 -5
  61. data/test/haml-spec/LICENSE +0 -14
  62. data/test/haml-spec/README.md +0 -106
  63. data/test/haml-spec/lua_haml_spec.lua +0 -38
  64. data/test/haml-spec/perl_haml_test.pl +0 -81
  65. data/test/haml-spec/ruby_haml_test.rb +0 -23
  66. data/test/haml-spec/tests.json +0 -660
  67. data/test/helper_test.rb +0 -583
  68. data/test/markaby/standard.mab +0 -52
  69. data/test/mocks/article.rb +0 -6
  70. data/test/parser_test.rb +0 -105
  71. data/test/results/content_for_layout.xhtml +0 -12
  72. data/test/results/eval_suppressed.xhtml +0 -9
  73. data/test/results/helpers.xhtml +0 -70
  74. data/test/results/helpful.xhtml +0 -10
  75. data/test/results/just_stuff.xhtml +0 -70
  76. data/test/results/list.xhtml +0 -12
  77. data/test/results/nuke_inner_whitespace.xhtml +0 -40
  78. data/test/results/nuke_outer_whitespace.xhtml +0 -148
  79. data/test/results/original_engine.xhtml +0 -20
  80. data/test/results/partial_layout.xhtml +0 -5
  81. data/test/results/partial_layout_erb.xhtml +0 -5
  82. data/test/results/partials.xhtml +0 -21
  83. data/test/results/render_layout.xhtml +0 -3
  84. data/test/results/silent_script.xhtml +0 -74
  85. data/test/results/standard.xhtml +0 -162
  86. data/test/results/tag_parsing.xhtml +0 -23
  87. data/test/results/very_basic.xhtml +0 -5
  88. data/test/results/whitespace_handling.xhtml +0 -90
  89. data/test/template_test.rb +0 -354
  90. data/test/templates/_av_partial_1.haml +0 -9
  91. data/test/templates/_av_partial_1_ugly.haml +0 -9
  92. data/test/templates/_av_partial_2.haml +0 -5
  93. data/test/templates/_av_partial_2_ugly.haml +0 -5
  94. data/test/templates/_layout.erb +0 -3
  95. data/test/templates/_layout_for_partial.haml +0 -3
  96. data/test/templates/_partial.haml +0 -8
  97. data/test/templates/_text_area.haml +0 -3
  98. data/test/templates/_text_area_helper.html.haml +0 -4
  99. data/test/templates/action_view.haml +0 -47
  100. data/test/templates/action_view_ugly.haml +0 -47
  101. data/test/templates/breakage.haml +0 -8
  102. data/test/templates/content_for_layout.haml +0 -8
  103. data/test/templates/eval_suppressed.haml +0 -11
  104. data/test/templates/helpers.haml +0 -55
  105. data/test/templates/helpful.haml +0 -11
  106. data/test/templates/just_stuff.haml +0 -85
  107. data/test/templates/list.haml +0 -12
  108. data/test/templates/nuke_inner_whitespace.haml +0 -32
  109. data/test/templates/nuke_outer_whitespace.haml +0 -144
  110. data/test/templates/original_engine.haml +0 -17
  111. data/test/templates/partial_layout.haml +0 -3
  112. data/test/templates/partial_layout_erb.erb +0 -4
  113. data/test/templates/partialize.haml +0 -1
  114. data/test/templates/partials.haml +0 -12
  115. data/test/templates/render_layout.haml +0 -2
  116. data/test/templates/silent_script.haml +0 -45
  117. data/test/templates/standard.haml +0 -43
  118. data/test/templates/standard_ugly.haml +0 -43
  119. data/test/templates/tag_parsing.haml +0 -21
  120. data/test/templates/very_basic.haml +0 -4
  121. data/test/templates/whitespace_handling.haml +0 -87
  122. data/test/test_helper.rb +0 -81
  123. data/test/util_test.rb +0 -63
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b7a38de787ab9e47ac3221b040c9c38ecf4884df
4
- data.tar.gz: 29497caf8377f40940a0e094d1477ea2403f380f
2
+ SHA256:
3
+ metadata.gz: 2164872cd8f38c57307ec65c2834988d49538cec038795797be328bd18e3e1c4
4
+ data.tar.gz: 6f090e38ab9856973b42a8f61bc34fe10fa7df3595dfc3939c0ead7c422d66d1
5
5
  SHA512:
6
- metadata.gz: 3c71810f7359be3c7536eea848acefb06d09859443d6b80a31908ea07b6c109dc082a7ad8a7e95f1305b08aefeabbe46dd48cc186dff66eb4fe46bdd258956e1
7
- data.tar.gz: 0d85d5e2164cef71dab787d7967ab4a3e7ecd1dd0b5e212188032bd94faa6d4923cdb39cd5fdffcdaed6da13b6f637d1d5d5c8171ca878fa017ac64c345d589f
6
+ metadata.gz: 510cbbc03d5d46c0430d7a866166fc089dd253a98584d540d9a46cd2610bb5fc327d39e830c05a939266b330c1048ce9e47a269b39b2c7d35cb0a4ed5d370be0
7
+ data.tar.gz: 3292001c396a698256d7292309e631c6d81bb02f26a4fc1b4763ad537dd97a808aa9abd27b3841091afe9a120dfb5dc868c6dfb8c96cbd6538383e92f2871a91
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ /.yardoc
2
+ /coverage
3
+ /doc
4
+ /log
5
+ /pkg
6
+ /test/rails
7
+ /test/gemfiles/*.lock
8
+ /.haml
9
+ /site
10
+ *.rbc
11
+ .sass-cache
12
+ .rbenv-version
13
+ .rbx
14
+ .ruby-version
15
+ .rvmrc
16
+ Gemfile.lock
17
+ tmp
18
+ .bundle/
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "test/haml-spec"]
2
+ path = test/haml-spec
3
+ url = git://github.com/haml/haml-spec.git
data/.travis.yml ADDED
@@ -0,0 +1,54 @@
1
+ sudo: false
2
+ dist: trusty
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - ruby-head
7
+ - 2.4.2
8
+ - 2.3.5
9
+ - 2.2.8
10
+ - 2.1.10
11
+ - 2.0.0
12
+ - jruby-9.1.12.0
13
+ - rbx-3
14
+ gemfile:
15
+ - test/gemfiles/Gemfile.rails-5.1.x
16
+ - test/gemfiles/Gemfile.rails-5.0.x
17
+ - test/gemfiles/Gemfile.rails-5.0.x.erubi
18
+ - test/gemfiles/Gemfile.rails-4.2.x
19
+ - test/gemfiles/Gemfile.rails-4.1.x
20
+ - test/gemfiles/Gemfile.rails-4.0.x
21
+ matrix:
22
+ exclude:
23
+ - rvm: 2.0.0
24
+ gemfile: test/gemfiles/Gemfile.rails-5.1.x
25
+ - rvm: 2.1.10
26
+ gemfile: test/gemfiles/Gemfile.rails-5.1.x
27
+ - rvm: 2.0.0
28
+ gemfile: test/gemfiles/Gemfile.rails-5.0.x
29
+ - rvm: 2.0.0
30
+ gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
31
+ - rvm: 2.1.10
32
+ gemfile: test/gemfiles/Gemfile.rails-5.0.x
33
+ - rvm: 2.1.10
34
+ gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
35
+ - rvm: 2.4.2
36
+ gemfile: test/gemfiles/Gemfile.rails-4.0.x
37
+ - rvm: 2.4.2
38
+ gemfile: test/gemfiles/Gemfile.rails-4.1.x
39
+ - rvm: 2.4.2
40
+ gemfile: test/gemfiles/Gemfile.rails-4.2.x
41
+ - rvm: ruby-head
42
+ gemfile: test/gemfiles/Gemfile.rails-4.0.x
43
+ - rvm: ruby-head
44
+ gemfile: test/gemfiles/Gemfile.rails-4.1.x
45
+ - rvm: ruby-head
46
+ gemfile: test/gemfiles/Gemfile.rails-4.2.x
47
+ include:
48
+ - rvm: 2.4.2
49
+ gemfile: test/gemfiles/Gemfile.rails-edge
50
+ allow_failures:
51
+ - rvm: rbx-3
52
+ - gemfile: test/gemfiles/Gemfile.rails-edge
53
+ fast_finish: true
54
+ script: "bundle exec rake submodules test"
data/.yardopts CHANGED
@@ -1,7 +1,7 @@
1
1
  --charset utf-8
2
2
  --readme README.md
3
3
  --markup markdown
4
- --markup-provider maruku
4
+ --markup-provider kramdown
5
5
  --template-path yard
6
6
  --default-return ""
7
7
  --title "Haml Documentation"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,98 @@
1
1
  # Haml Changelog
2
2
 
3
+ ## 5.0.4
4
+
5
+ Released on October 13, 2017
6
+ ([diff](https://github.com/haml/haml/compare/v5.0.3...v5.0.4)).
7
+
8
+ * Fix `haml -c --stdin` regression in 5.0.2. [#958](https://github.com/haml/haml/pull/958) (thanks [Timo Göllner](https://github.com/TeaMoe))
9
+ * Ruby 2.5 support (it wasn't working due to Ripper API change). (Akira Matsuda)
10
+
11
+ ## 5.0.3
12
+
13
+ Released on September 7, 2017
14
+ ([diff](https://github.com/haml/haml/compare/v5.0.2...v5.0.3)).
15
+
16
+ * Use `String#dump` instead of `String#inspect` to generate string literal. (Takashi Kokubun)
17
+ * Fix Erubi superclass mismatch error. [#952](https://github.com/haml/haml/pull/952) (thanks [Robin Daugherty](https://github.com/RobinDaugherty))
18
+
19
+ ## 5.0.2
20
+
21
+ Released on August 1, 2017
22
+ ([diff](https://github.com/haml/haml/compare/v5.0.1...v5.0.2)).
23
+
24
+ * Let `haml -c` fail if generated Ruby code is syntax error. [#880](https://github.com/haml/haml/issues/880) (Takashi Kokubun)
25
+ * Fix `NoMethodError` bug caused with Sprockets 3 and :sass filter. [#930](https://github.com/haml/haml/pull/930) (thanks [Gonzalez Maximiliano](https://github.com/emaxi))
26
+ * Fix `list_of` helper with multi-line content. [#933](https://github.com/haml/haml/pull/933) (thanks [Benoit Larroque](https://github.com/zetaben))
27
+ * Optimize rendering performance by changing timing to fix textareas. [#941](https://github.com/haml/haml/pull/941) (Takashi Kokubun)
28
+ * Fix `TypeError` with empty :ruby filter. [#942](https://github.com/haml/haml/pull/942) (Takashi Kokubun)
29
+ * Fix inconsistent attribute sort order. (Takashi Kokubun)
30
+
31
+ ## 5.0.1
32
+
33
+ Released on May 3, 2017
34
+ ([diff](https://github.com/haml/haml/compare/v5.0.0...v5.0.1)).
35
+
36
+ * Fix parsing attributes including string interpolation. [#917](https://github.com/haml/haml/pull/917) [#921](https://github.com/haml/haml/issues/921)
37
+ * Stop distributing test files in gem package and allow installing on Windows.
38
+ * Use ActionView's Erubi/Erubis handler for erb filter only on ActionView. [#914](https://github.com/haml/haml/pull/914)
39
+
40
+ ## 5.0.0
41
+
42
+ Released on April 26, 2017
43
+ ([diff](https://github.com/haml/haml/compare/4.0.7...v5.0.0)).
44
+
45
+ Breaking Changes
46
+
47
+ * Haml now requires Ruby 2.0.0 or above.
48
+ * Rails 3 is no longer supported, matching the official
49
+ [Maintenance Policy for Ruby on Rails](http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/).
50
+ Use Haml 4 if you want to use Rails 3.
51
+ (Tee Parham)
52
+ * Remove `:ugly` option ([#894](https://github.com/haml/haml/pull/894))
53
+ * The `haml` command's debug option (`-d`) no longer executes the Haml code, but
54
+ rather checks the generated Ruby syntax for errors.
55
+ * Drop parser/compiler accessor from `Haml::Engine`. Modify `Haml::Engine#initialize` options
56
+ or `Haml::Template.options` instead. (Takashi Kokubun)
57
+ * Drop dynamic quotes support and always escape `'` for `escape_html`/`escape_attrs` instead.
58
+ Also, escaped results are slightly changed and always unified to the same characters. (Takashi Kokubun)
59
+ * Don't preserve newlines in attributes. (Takashi Kokubun)
60
+ * HTML escape interpolated code in filters.
61
+ [#770](https://github.com/haml/haml/pull/770)
62
+ (Matt Wildig)
63
+
64
+ :javascript
65
+ #{JSON.generate(foo: "bar")}
66
+ Haml 4 output: {"foo":"bar"}
67
+ Haml 5 output: {"foo":"bar"}
68
+
69
+ Added
70
+
71
+ * Add a tracing option. When enabled, Haml will output a data-trace attribute on each tag showing the path
72
+ to the source Haml file from which it was generated. Thanks [Alex Babkin](https://github.com/ababkin).
73
+ * Add `haml_tag_if` to render a block, conditionally wrapped in another element (Matt Wildig)
74
+ * Support Rails 5.1 Erubi template handler.
75
+ * Support Sprockets 3. Thanks [Sam Davies](https://github.com/samphilipd) and [Jeremy Venezia](https://github.com/jvenezia).
76
+ * General performance and memory usage improvements. (Akira Matsuda)
77
+ * Analyze attribute values by Ripper and render static attributes beforehand. (Takashi Kokubun)
78
+ * Optimize attribute rendering about 3x faster. (Takashi Kokubun)
79
+ * Add temple gem as dependency and create `Haml::TempleEngine` class.
80
+ Some methods in `Haml::Compiler` are migrated to `Haml::TempleEngine`. (Takashi Kokubun)
81
+
82
+ Fixed
83
+
84
+ * Fix for attribute merging. When an attribute method (or literal nested hash)
85
+ was used in an old style attribute hash and there is also a (non-static) new
86
+ style hash there is an error. The fix can result in different behavior in
87
+ some circumstances. See the [commit message](https://github.com/haml/haml/tree/e475b015d3171fb4c4f140db304f7970c787d6e3)
88
+ for detailed info. (Matt Wildig)
89
+ * Make escape_once respect hexadecimal references. (Matt Wildig)
90
+ * Don't treat the 'data' attribute specially when merging attribute hashes. (Matt Wildig and Norman Clarke)
91
+ * Fix #@foo and #$foo style interpolation that was not working in html_safe mode. (Akira Matsuda)
92
+ * Allow `@` as tag's class name. Thanks [Joe Bartlett](https://github.com/redoPop).
93
+ * Raise `Haml::InvalidAttributeNameError` when attribute name includes invalid characters. (Takashi Kokubun)
94
+ * Don't ignore unexpected exceptions on initializing `ActionView::OutputBuffer`. (Takashi Kokubun)
95
+
3
96
  ## 4.0.7
4
97
 
5
98
  Released on August 10, 2015
@@ -11,7 +104,6 @@ Released on August 10, 2015
11
104
 
12
105
  Released on Dec 1, 2014 ([diff](https://github.com/haml/haml/compare/4.0.5...4.0.6)).
13
106
 
14
-
15
107
  * Fix warning on Ruby 1.8.7 "regexp has invalid interval" (thanks [Elia Schito](https://github.com/elia)).
16
108
 
17
109
  ## 4.0.5
@@ -76,7 +168,7 @@ Released March 21, 2013 ([diff](https://github.com/haml/haml/compare/4.0.0...4.0
76
168
 
77
169
  ## 4.0.0
78
170
 
79
- * The Haml exectutable now accepts an `--autoclose` option. You can now
171
+ * The Haml executable now accepts an `--autoclose` option. You can now
80
172
  specify a list of tags that should be autoclosed
81
173
 
82
174
  * The `:ruby` filter no longer redirects $stdout to the Haml document, as this
@@ -113,7 +205,7 @@ Released March 21, 2013 ([diff](https://github.com/haml/haml/compare/4.0.0...4.0
113
205
 
114
206
  * All Hash attribute values are now treated as HTML5 data, regardless of key.
115
207
  Previously only the "data" key was treated this way. Allowing arbitrary keys
116
- means you can now easily use this feauture for Aria attributes, among other
208
+ means you can now easily use this feature for Aria attributes, among other
117
209
  uses.
118
210
  (thanks to [Elvin Efendi](https://github.com/ElvinEfendi))
119
211
 
@@ -532,7 +624,6 @@ The {file:HAML_REFERENCE.md#ugly-option `:ugly` option} is now on by default
532
624
  in the testing environment in Rails to help tests run faster.
533
625
 
534
626
  ## 3.0.0
535
- {#3-0-0}
536
627
 
537
628
  [Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.0).
538
629
 
@@ -1361,3 +1452,4 @@ has been moved to [YARD](http://yard.soen.ca).
1361
1452
  YARD is an excellent documentation system,
1362
1453
  and allows us to write our documentation in [Maruku](http://maruku.rubyforge.org),
1363
1454
  which is also excellent.
1455
+ >>>>>>> External Changes
data/FAQ.md CHANGED
@@ -2,14 +2,7 @@
2
2
 
3
3
  ## Haml
4
4
 
5
- ### Why is my markup indented properly in development mode, but not in production?
6
- {#q-indentation-in-production}
7
-
8
- To improve performance, Haml defaults to {Haml::Options#ugly "ugly" mode} in
9
- Rails apps running in production.
10
-
11
- ### How do I put a punctuation mark after an element, like "`I like <strong>cake</strong>!`"?
12
- {#q-punctuation}
5
+ ### How do I put a punctuation mark after an element, like "`I like <strong>cake</strong>!`"? {#q-punctuation}
13
6
 
14
7
  Expressing the structure of a document
15
8
  and expressing inline formatting are two very different problems.
@@ -37,8 +30,7 @@ then it's even easier:
37
30
 
38
31
  %p== I like #{link_to 'chocolate', 'http://franschocolates.com'}!
39
32
 
40
- ### How do I stop Haml from indenting the contents of my `pre` and `textarea` tags?
41
- {#q-preserve}
33
+ ### How do I stop Haml from indenting the contents of my `pre` and `textarea` tags? {#q-preserve}
42
34
 
43
35
  Because Haml automatically indents the HTML source code,
44
36
  the contents of whitespace-sensitive tags like `pre` and `textarea`
@@ -78,8 +70,7 @@ and renders
78
70
 
79
71
  <p><textarea>Foo&#x000A;Bar</textarea></p>
80
72
 
81
- ### How do I make my long lines of Ruby code look nicer in my Haml document?
82
- {#q-multiline}
73
+ ### How do I make my long lines of Ruby code look nicer in my Haml document? {#q-multiline}
83
74
 
84
75
  Put them in a helper or your model.
85
76
 
@@ -125,8 +116,7 @@ in Haml, you have to do
125
116
  - form_for stuff do
126
117
  ...
127
118
 
128
- ### I have Haml installed. Why is Rails (only looking for `.html.erb` files | rendering Haml files as plain text | rendering Haml files as blank pages)?
129
- {#q-blank-page}
119
+ ### I have Haml installed. Why is Rails (only looking for `.html.erb` files | rendering Haml files as plain text | rendering Haml files as blank pages)? {#q-blank-page}
130
120
 
131
121
  There are several reasons these things might be happening.
132
122
  First of all, make sure that Haml really is installed;
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ gem "m"
5
+ gem "pry"
6
+
7
+ group :docs do
8
+ gem "yard", "~> 0.8.0"
9
+ gem "kramdown"
10
+ gem "sass"
11
+ end
12
+
13
+ platform :mri do
14
+ gem "ruby-prof"
15
+ end
16
+
17
+ platform :mri_21 do
18
+ gem "simplecov"
19
+ end
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2009 Hampton Catlin and Nathan Weizenbaum
1
+ Copyright (c) 2006-2009 Hampton Catlin and Natalie Weizenbaum
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Haml
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/haml/haml.png?branch=master)](http://travis-ci.org/haml/haml)
3
+ [![Gem Version](https://badge.fury.io/rb/haml.svg)](http://rubygems.org/gems/haml)
4
+ [![Build Status](https://travis-ci.org/haml/haml.svg?branch=master)](http://travis-ci.org/haml/haml)
5
+ [![Code Climate](http://img.shields.io/codeclimate/github/haml/haml.svg)](https://codeclimate.com/github/haml/haml)
6
+ [![Coverage Status](http://img.shields.io/coveralls/haml/haml.svg)](https://coveralls.io/r/haml/haml)
7
+ [![Inline docs](http://inch-ci.org/github/haml/haml.png)](http://inch-ci.org/github/haml/haml)
4
8
 
5
9
  Haml is a templating engine for HTML. It's designed to make it both easier and
6
10
  more pleasant to write HTML documents, by eliminating redundancy, reflecting the
@@ -12,23 +16,32 @@ that's both powerful and easy to understand.
12
16
  Haml can be used from the command line or as part of a Ruby web framework. The
13
17
  first step is to install the gem:
14
18
 
15
- gem install haml
19
+ ~~~sh
20
+ gem install haml
21
+ ~~~
16
22
 
17
23
  After you write some Haml, you can run
18
24
 
19
- haml document.haml
25
+ ~~~sh
26
+ haml document.haml
27
+ ~~~
20
28
 
21
29
  to compile it to HTML. For more information on these commands, check out
22
30
 
23
- haml --help
31
+ ~~~sh
32
+ haml --help
33
+ ~~~
24
34
 
25
- To use Haml programatically, check out the [YARD
26
- documentation](http://haml.info/docs/yardoc/).
35
+ To use Haml programatically, check out the [YARD documentation](http://haml.info/docs/yardoc/).
27
36
 
28
37
  ## Using Haml with Rails
29
38
 
30
39
  To use Haml with Rails, simply add Haml to your Gemfile and run `bundle`.
31
40
 
41
+ ~~~ruby
42
+ gem 'haml'
43
+ ~~~
44
+
32
45
  If you'd like to replace Rails's Erb-based generators with Haml, add
33
46
  [haml-rails](https://github.com/indirect/haml-rails) to your Gemfile as well.
34
47
 
@@ -36,58 +49,76 @@ If you'd like to replace Rails's Erb-based generators with Haml, add
36
49
 
37
50
  The most basic element of Haml is a shorthand for creating HTML:
38
51
 
39
- %tagname{:attr1 => 'value1', :attr2 => 'value2'} Contents
52
+ ~~~haml
53
+ %tagname{:attr1 => 'value1', :attr2 => 'value2'} Contents
54
+ ~~~
40
55
 
41
56
  No end-tag is needed; Haml handles that automatically. If you prefer HTML-style
42
57
  attributes, you can also use:
43
58
 
44
- %tagname(attr1='value1' attr2='value2') Contents
59
+ ~~~haml
60
+ %tagname(attr1='value1' attr2='value2') Contents
61
+ ~~~
45
62
 
46
63
  Adding `class` and `id` attributes is even easier. Haml uses the same syntax as
47
64
  the CSS that styles the document:
48
65
 
49
- %tagname#id.class
66
+ ~~~haml
67
+ %tagname#id.class
68
+ ~~~
50
69
 
51
70
  In fact, when you're using the `<div>` tag, it becomes _even easier_. Because
52
71
  `<div>` is such a common element, a tag without a name defaults to a div. So
53
72
 
54
- #foo Hello!
73
+ ~~~haml
74
+ #foo Hello!
75
+ ~~~
55
76
 
56
77
  becomes
57
78
 
58
- <div id='foo'>Hello!</div>
79
+ ~~~html
80
+ <div id='foo'>Hello!</div>
81
+ ~~~
59
82
 
60
83
  Haml uses indentation to bring the individual elements to represent the HTML
61
84
  structure. A tag's children are indented beneath than the parent tag. Again, a
62
85
  closing tag is automatically added. For example:
63
86
 
64
- %ul
65
- %li Salt
66
- %li Pepper
87
+ ~~~haml
88
+ %ul
89
+ %li Salt
90
+ %li Pepper
91
+ ~~~
67
92
 
68
93
  becomes:
69
94
 
70
- <ul>
71
- <li>Salt</li>
72
- <li>Pepper</li>
73
- </ul>
95
+ ~~~html
96
+ <ul>
97
+ <li>Salt</li>
98
+ <li>Pepper</li>
99
+ </ul>
100
+ ~~~
74
101
 
75
102
  You can also put plain text as a child of an element:
76
103
 
77
- %p
78
- Hello,
79
- World!
104
+ ~~~haml
105
+ %p
106
+ Hello,
107
+ World!
108
+ ~~~
80
109
 
81
110
  It's also possible to embed Ruby code into Haml documents. An equals sign, `=`,
82
111
  will output the result of the code. A hyphen, `-`, will run the code but not
83
112
  output the result. You can even use control statements like `if` and `while`:
84
113
 
85
- %p
86
- Date/Time:
87
- - now = DateTime.now
88
- %strong= now
89
- - if now > DateTime.parse("December 31, 2006")
90
- = "Happy new " + "year!"
114
+ ~~~haml
115
+ %p
116
+ Date/Time:
117
+ - now = DateTime.now
118
+ %strong= now
119
+ - if now > DateTime.parse("December 31, 2006")
120
+ = "Happy new " + "year!"
121
+ ~~~
91
122
 
92
123
  Haml provides far more tools than those presented here. Check out the [reference
93
124
  documentation](http://haml.info/docs/yardoc/file.REFERENCE.html)
@@ -105,18 +136,22 @@ Contributions are welcomed, but before you get started please read the
105
136
  [guidelines](http://haml.info/development.html#contributing).
106
137
 
107
138
  After forking and then cloning the repo locally, install Bundler and then use it
108
- to install the development gem dependecies:
109
-
110
- gem install bundler
111
- bundle install
139
+ to install the development gem dependencies:
140
+ ~~~sh
141
+ gem install bundler
142
+ bundle install
143
+ ~~~
112
144
 
113
145
  Once this is complete, you should be able to run the test suite:
114
-
115
- rake
146
+ ~~~sh
147
+ rake
148
+ ~~~
116
149
 
117
150
  You'll get a warning that you need to install haml-spec, so run this:
118
151
 
119
- git submodule update --init
152
+ ~~~sh
153
+ git submodule update --init
154
+ ~~~
120
155
 
121
156
  At this point `rake` should run without error or warning and you are ready to
122
157
  start working on your patch!
@@ -124,18 +159,20 @@ start working on your patch!
124
159
  Note that you can also run just one test out of the test suite if you're working
125
160
  on a specific area:
126
161
 
127
- ruby -Itest test/helper_test.rb -n test_buffer_access
162
+ ~~~sh
163
+ ruby -Itest test/helper_test.rb -n test_buffer_access
164
+ ~~~
128
165
 
129
- Haml supports Ruby 1.8.7 and higher, so please make sure your changes run on
130
- both 1.9 and 1.8.
166
+ Haml currently supports Ruby 2.0.0 and higher, so please make sure your changes run on 2.0+.
131
167
 
132
168
  ## Team
133
169
 
134
170
  ### Current Maintainers
135
171
 
136
- * [Norman Clarke](http://github.com/norman)
137
- * [Matt Wildig](http://github.com/mattwildig)
138
172
  * [Akira Matsuda](https://github.com/amatsuda)
173
+ * [Matt Wildig](https://github.com/mattwildig)
174
+ * [Tee Parham](https://github.com/teeparham)
175
+ * [Takashi Kokubun](https://github.com/k0kubun)
139
176
 
140
177
  ### Alumni
141
178
 
@@ -143,17 +180,18 @@ Haml was created by [Hampton Catlin](http://hamptoncatlin.com), the author of
143
180
  the original implementation. Hampton is no longer involved in day-to-day coding,
144
181
  but still consults on language issues.
145
182
 
146
- [Nathan Weizenbaum](http://nex-3.com) was for many years the primary developer
183
+ [Natalie Weizenbaum](http://nex-3.com) was for many years the primary developer
147
184
  and architect of the "modern" Ruby implementation of Haml.
148
185
 
186
+ [Norman Clarke](http://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
149
187
 
150
188
  ## License
151
189
 
152
- Some of Nathan's work on Haml was supported by Unspace Interactive.
190
+ Some of Natalie's work on Haml was supported by Unspace Interactive.
153
191
 
154
192
  Beyond that, the implementation is licensed under the MIT License.
155
193
 
156
- Copyright (c) 2006-2013 Hampton Catlin, Nathan Weizenbaum and the Haml team
194
+ Copyright (c) 2006-2013 Hampton Catlin, Natalie Weizenbaum and the Haml team
157
195
 
158
196
  Permission is hereby granted, free of charge, to any person obtaining a copy of
159
197
  this software and associated documentation files (the "Software"), to deal in