Skip to content

Commit 7b2fa81

Browse files
committed
Various cleanup
1 parent eedf19d commit 7b2fa81

File tree

7 files changed

+263
-276
lines changed

7 files changed

+263
-276
lines changed

Rakefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
require "bundler/gem_tasks"
44
require "rake/testtask"
5+
require "syntax_tree/rake_tasks"
56

67
Rake::TestTask.new(:test) do |t|
78
t.libs << "test"
89
t.libs << "lib"
910
t.test_files = FileList["test/**/*_test.rb"]
1011
end
1112

13+
SOURCE_FILES =
14+
FileList[%w[Gemfile Rakefile syntax_tree-haml.gemspec lib/**/*.rb test/*.rb]]
15+
16+
SyntaxTree::Rake::CheckTask.new { |t| t.source_files = SOURCE_FILES }
17+
SyntaxTree::Rake::WriteTask.new { |t| t.source_files = SOURCE_FILES }
18+
1219
task default: :test

lib/syntax_tree/haml.rb

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ module Haml
1414
"strict" => "Strict",
1515
"xml" => "XML"
1616
}
17-
18-
DOCTYPE_VERSIONS = ["1.1", "5"]
19-
17+
18+
DOCTYPE_VERSIONS = %w[1.1 5]
19+
2020
# This is the parent class of the various visitors that we provide to access
2121
# the HAML syntax tree.
2222
class Visitor
@@ -55,15 +55,24 @@ class Haml::Parser::ParseNode
5555
# accept a visitor in order to walk through the tree.
5656
def accept(visitor)
5757
case type
58-
in :comment then visitor.visit_comment(self)
59-
in :doctype then visitor.visit_doctype(self)
60-
in :filter then visitor.visit_filter(self)
61-
in :haml_comment then visitor.visit_haml_comment(self)
62-
in :plain then visitor.visit_plain(self)
63-
in :root then visitor.visit_root(self)
64-
in :script then visitor.visit_script(self)
65-
in :silent_script then visitor.visit_silent_script(self)
66-
in :tag then visitor.visit_tag(self)
58+
in :comment
59+
visitor.visit_comment(self)
60+
in :doctype
61+
visitor.visit_doctype(self)
62+
in :filter
63+
visitor.visit_filter(self)
64+
in :haml_comment
65+
visitor.visit_haml_comment(self)
66+
in :plain
67+
visitor.visit_plain(self)
68+
in :root
69+
visitor.visit_root(self)
70+
in :script
71+
visitor.visit_script(self)
72+
in :silent_script
73+
visitor.visit_silent_script(self)
74+
in :tag
75+
visitor.visit_tag(self)
6776
end
6877
end
6978

0 commit comments

Comments
 (0)