bing_dictionary 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -26
- data/lib/bing_dictionary.rb +2 -2
- data/lib/bing_dictionary/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbc50af5b5ddf83a0775fe03469d2fc42bc5d0df
|
4
|
+
data.tar.gz: 986b3a6e3b531094b82dfce73cdc9600932baad9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 295bcaed92324fc045cecc392cd9d8c2ed1fcd21d1e93118dbe7dbc9a5091db98989051e1e02f59602ee28e4f3e35edb576f13cd3de957ab901af93882ff313f
|
7
|
+
data.tar.gz: d32676c749a9f616ea190f15b6bb463fe380cd1ca145948dc67570eb70bd2ee8bfe4597c609c94ad5cd4b90e4a246032aca26dfe1450fa91c948bea2e4b784fc
|
data/README.md
CHANGED
@@ -10,18 +10,6 @@ It uses http://cn.bing.com/dict/ to query.
|
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
13
|
-
Add this line to your application's Gemfile:
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
gem 'bing_dictionary'
|
17
|
-
```
|
18
|
-
|
19
|
-
And then execute:
|
20
|
-
|
21
|
-
$ bundle
|
22
|
-
|
23
|
-
Or install it yourself as:
|
24
|
-
|
25
13
|
$ gem install bing_dictionary
|
26
14
|
|
27
15
|
## Usage
|
@@ -29,23 +17,18 @@ A `dict` runable bin file provided.
|
|
29
17
|
|
30
18
|
DEMO:
|
31
19
|
|
32
|
-
dict cake
|
33
|
-
dict 蛋糕
|
34
|
-
|
35
|
-
You can make it work tegother with Vim by add follows to $HOME/.vimrc
|
36
|
-
|
37
|
-
nnoremap <leader>d :!dict <cword><CR>
|
38
|
-
vnoremap <leader>d y:!dict <c-r>"<CR>
|
20
|
+
$ dict cake
|
21
|
+
$ dict 蛋糕
|
39
22
|
|
40
23
|
## Support long sentence
|
41
24
|
Now long sentence is supported
|
42
25
|
|
43
|
-
dict 你好吗
|
44
|
-
dict How old are you
|
26
|
+
$ dict 你好吗
|
27
|
+
$ dict How old are you
|
45
28
|
|
46
29
|
## Support fuzzy query
|
47
30
|
|
48
|
-
dict hexxo
|
31
|
+
$ dict hexxo
|
49
32
|
|
50
33
|
您要找的是不是
|
51
34
|
|
@@ -55,11 +38,30 @@ Now long sentence is supported
|
|
55
38
|
hexode六极管
|
56
39
|
...
|
57
40
|
|
58
|
-
##
|
59
|
-
You can open your local dictionary.app with `open dict://someword`. It may be faster.
|
60
|
-
Add following to your vimrc to make it work in vim:
|
41
|
+
## Support Chinese to English
|
61
42
|
|
62
|
-
|
43
|
+
$ dict 单片机
|
44
|
+
单片机
|
45
|
+
|
46
|
+
网络 MCU; Single Chip Microcomputer; Microcontroller
|
47
|
+
|
48
|
+
The monolithic integrated circuit occurs the explanation , did not understand may have a look !
|
49
|
+
单片机发生的讲解,不懂得可以看看!
|
50
|
+
...
|
51
|
+
|
52
|
+
## More options
|
53
|
+
|
54
|
+
$ dict --help
|
55
|
+
Example: dict hello
|
56
|
+
-p, --[no-]pronounce Pronounce the word
|
57
|
+
-j, --[no-]jump Jump to web page
|
58
|
+
-v, --version Show the version
|
59
|
+
|
60
|
+
## Work with vim
|
61
|
+
You can make it work tegother with Vim by add follows to $HOME/.vimrc
|
62
|
+
|
63
|
+
nnoremap <leader>d :!dict <cword><CR>
|
64
|
+
vnoremap <leader>d y:!dict <c-r>"<CR>
|
63
65
|
|
64
66
|
## Thanks
|
65
67
|
Heavily borrowed from [Command-Line-Youdao-Dictionary](https://github.com/qhwa/Command-Line-Youdao-Dictionary)
|
data/lib/bing_dictionary.rb
CHANGED
@@ -79,11 +79,11 @@ class String
|
|
79
79
|
COLORS = %w(black red green yellow blue magenta cyan white)
|
80
80
|
COLORS.each_with_index do |color, idx|
|
81
81
|
define_method color do
|
82
|
-
"\e[3#{idx}m" << self.to_s << "\e[0m"
|
82
|
+
$stdout.tty? ? "\e[3#{idx}m" << self.to_s << "\e[0m" : self
|
83
83
|
end
|
84
84
|
|
85
85
|
define_method "#{color}_bg" do
|
86
|
-
"\e[4#{idx}m" << self.to_s << "\e[0m"
|
86
|
+
$stdout.tty? ? "\e[4#{idx}m" << self.to_s << "\e[0m" : self
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|