Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

duplication of comments #8

Merged
merged 1 commit into from

2 participants

@americodls

in some cases the comments were duplicated.
I fixed it using regexp

@m-ryan m-ryan merged commit a0e1a8c into m-ryan:master
@m-ryan
Owner

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 11, 2012
  1. @americodls
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 6 deletions.
  1. 0  Changelog → CHANGELOG
  2. +3 −6 lib/magic_encoding.rb
View
0  Changelog → CHANGELOG
File renamed without changes
View
9 lib/magic_encoding.rb
@@ -34,12 +34,9 @@ def self.process(options)
lines = file.readlines
# remove current encoding comment(s)
- while lines[0] && (
- lines[0].starts_with?(comment_style.sub('{text}', 'encoding')) ||
- lines[0].starts_with?(comment_style.sub('{text}', 'coding')) ||
- lines[0].starts_with?(comment_style.sub('{text}', '-*- encoding')))
- lines.shift
- end
+ while lines[0].match(/^-?# ?(-\*-)? ?(en)?coding/)
+ lines.shift
+ end
# set current encoding
lines.insert(0,comment_style.sub('{text}', prefix))
Something went wrong with that request. Please try again.