File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -108,16 +108,23 @@ def standardise(raw)
108
108
result = [ ]
109
109
lines = raw . split ( "\n " )
110
110
lines . each do |line |
111
+ quotes = false
111
112
if line . strip . start_with? ( "// " )
112
113
line = "<!--#{ line . strip [ 2 ..-1 ] } -->"
113
114
elsif line . strip . start_with? ( "//" )
114
115
line = "<!-- #{ line . strip [ 2 ..-1 ] } -->"
115
- elsif line . include? ( "// " )
116
- line = line . split ( "//" , 2 )
117
- line = line [ 0 ] +"<!--" +line [ 1 ] +" -->"
118
- elsif line . include? ( "//" )
119
- line = line . split ( "//" , 2 )
120
- line = line [ 0 ] +"<!-- " +line [ 1 ] +" -->"
116
+ end
117
+ line . chars . each_with_index do |ch , i |
118
+ quotes = !quotes if ch == "\" "
119
+ begin
120
+ if ch +line [ i +1 ] +line [ i +2 ] == "// " && !quotes
121
+ line = line . split ( "//" , 2 )
122
+ line = line [ 0 ] +"<!--" +line [ 1 ] +" -->"
123
+ elsif ch +line [ i +1 ] == "//" && !quotes
124
+ line = line . split ( "//" , 2 )
125
+ line = line [ 0 ] +"<!-- " +line [ 1 ] +" -->"
126
+ end
127
+ rescue ; break ; end
121
128
end
122
129
if line . strip . start_with? ( "." ) && bracketBalance ( line ) == 0
123
130
head = line . match ( /(^\s *\. \w *\s *(\[ .*?\] |)\s *)/ ) [ 0 ] . to_s
You can’t perform that action at this time.
0 commit comments