Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

duplication of comments #8

Merged
merged 1 commit into from

2 participants

Américo Duarte Manuel Ryan
Américo Duarte

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

Manuel Ryan m-ryan merged commit a0e1a8c into from
Manuel 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. Américo Duarte
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
0  Changelog → CHANGELOG
View
File renamed without changes
9 lib/magic_encoding.rb
View
@@ -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.