uniconvert 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/uniconvert +7 -18
- data/lib/uniconvert.rb +1 -1
- data/lib/uniconvert/converters/HTML.rb +13 -9
- data/lib/uniconvert/setup.rb +25 -0
- data/lib/uniconvert/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 995a875537b674c9e58241ec3c43e45470ee2611
|
4
|
+
data.tar.gz: 6ccb5e523a8a2a6e7bc6337e22991780c241062e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30a34f5b3f78147697de801f11f5c83dc6358ece2109f7c326d6c477253dd98580bc52c9abc3ea16a3f9e0a684a076d03030aecf1b3ec4f3c0bc22bd52952c56
|
7
|
+
data.tar.gz: f8b4bb8be251a93493d108d87a3e83bd652fcb341e43c38172d00bda8311bed35ead4c22700dfa73a9660df767adbd43df3924be6bde433efc10e5ed05ee30ed
|
data/exe/uniconvert
CHANGED
@@ -1,27 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
3
|
require 'htmlentities'
|
5
|
-
require 'unicode'
|
6
4
|
require 'notifaction'
|
7
|
-
require 'iconv'
|
8
5
|
require 'pathname'
|
9
6
|
|
10
|
-
|
11
|
-
require_relative "../#{f}"
|
12
|
-
end
|
13
|
-
|
7
|
+
require_relative "../lib/uniconvert/setup.rb"
|
14
8
|
require_relative "../lib/uniconvert.rb"
|
15
9
|
|
16
|
-
|
17
|
-
str = Pathname.new(ARGV[0])
|
10
|
+
setup = Uniconvert::Setup.new
|
18
11
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Notify.spacer
|
25
|
-
Notify.spit(Uniconvert.str_to(:HTML, str))
|
26
|
-
Notify.spacer
|
27
|
-
end
|
12
|
+
# include all converters
|
13
|
+
setup.load_converters
|
14
|
+
|
15
|
+
# convert input to HTML-safe characters
|
16
|
+
setup.execute_conversion
|
data/lib/uniconvert.rb
CHANGED
@@ -8,20 +8,24 @@ module Uniconvert
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def convert_file(file)
|
11
|
-
|
12
|
-
|
11
|
+
begin
|
12
|
+
file_contents = File.read(file)
|
13
|
+
converted = @encoder.encode(file_contents, :named)
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
if @create_file
|
16
|
+
translated_file_name = file + '.converted'
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
File.open(translated_file_name, 'w+') do |f|
|
19
|
+
f.write converted
|
20
|
+
end
|
21
|
+
|
22
|
+
`$EDITOR #{translated_file_name}`
|
19
23
|
end
|
20
24
|
|
21
|
-
|
25
|
+
converted.nil?
|
26
|
+
rescue Errno::EISDIR
|
27
|
+
false
|
22
28
|
end
|
23
|
-
|
24
|
-
converted.nil?
|
25
29
|
end
|
26
30
|
|
27
31
|
def convert_str(str)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Uniconvert
|
2
|
+
class Setup
|
3
|
+
|
4
|
+
def load_converters
|
5
|
+
Dir['lib/uniconvert/converters/*'].each do |f|
|
6
|
+
require_relative "../../#{f}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute_conversion
|
11
|
+
str = Pathname.new(ARGV[0])
|
12
|
+
|
13
|
+
if str.readable?
|
14
|
+
Uniconvert.file_to(:HTML, str)
|
15
|
+
else
|
16
|
+
Notify.spacer
|
17
|
+
Notify.success("Converted text below")
|
18
|
+
Notify.spacer
|
19
|
+
Notify.spit(Uniconvert.str_to(:HTML, str))
|
20
|
+
Notify.spacer
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/uniconvert/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniconvert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Priebe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- exe/uniconvert
|
128
128
|
- lib/uniconvert.rb
|
129
129
|
- lib/uniconvert/converters/HTML.rb
|
130
|
+
- lib/uniconvert/setup.rb
|
130
131
|
- lib/uniconvert/version.rb
|
131
132
|
- uniconvert.gemspec
|
132
133
|
homepage: https://rubygems.org/aapis/unicode-lang-converter
|