confidential_info_redactor_lite 0.0.25 → 0.0.26
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5acaf81f53e7390182f433c0904c0046cd6b887
|
4
|
+
data.tar.gz: 7463858f0d108d8cfb4bfe5c4794ccf9c2dceb03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b688792d2d55b1b09b13e41b77e0a3b45571632ea78d371373025a2c6f8a805a622f4f322610a4ef1a0ac6a260a6c8630e539220f1b384115b2f24d98e7eb5f2
|
7
|
+
data.tar.gz: a2b71134454512b86b6388ab1f06cd75dc736fa9c8778501aeca2eee87bdccd95ac1b0646d57674359be9f667533c52cee28f8e91766217e588a86fa0c6eca0b
|
@@ -110,10 +110,14 @@ module ConfidentialInfoRedactorLite
|
|
110
110
|
|
111
111
|
def redact_emails_html(txt)
|
112
112
|
redacted_text = redact_emails(txt).gsub(/\>\s#{Regexp.escape(token_text)}\s\</, ">#{token_text}<").gsub(/\>\s#{Regexp.escape(number_text)}\s\</, ">#{number_text}<").gsub(/\>\s#{Regexp.escape(date_text)}\s\</, ">#{date_text}<").gsub(/\>\s#{Regexp.escape(email_text)}\s\</, ">#{email_text}<").gsub(/\>\s#{Regexp.escape(hyperlink_text)}\s\</, ">#{hyperlink_text}<")
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
if language.eql?('ja')
|
114
|
+
final_email_tokens = txt.scan(/([\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+)/i).map { |token| token[0] }
|
115
|
+
else
|
116
|
+
original_sentence_array = txt.split(' ')
|
117
|
+
redacted_sentence_array = redacted_text.split(' ')
|
118
|
+
diff = original_sentence_array - redacted_sentence_array
|
119
|
+
final_email_tokens = diff.map { |token| token[-1].eql?('.') ? token[0...-1] : token }.map { |token| token[-1].eql?(')') ? token[0...-1] : token }.map { |token| token[0].eql?('(') ? token[1..token.length] : token }
|
120
|
+
end
|
117
121
|
[redacted_text.gsub(/(?<=[^\>])#{Regexp.escape(email_text)}/, "<span class='confidentialEmail'>#{email_text}</span>"), final_email_tokens]
|
118
122
|
end
|
119
123
|
|