textbringer 19 → 21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/textbringer/input_methods/skk_input_method.rb +28 -3
- data/lib/textbringer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9fb85ae8a3790d1ae876ecac31730522e121047dde8cf759bfb58e137ac5fb59
|
|
4
|
+
data.tar.gz: 70c9b7d737cda7b8fcc2bbfab347c2d22a47743ca9ec5d3c6863c4bee8b5005d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87cecff29b608feff2999cda9619b429d4158b74e6e2ef3d5560f2b742170553b5101996a6907ff1d9c8852086e76b429166108586f353ac73a1d0354276f4df
|
|
7
|
+
data.tar.gz: 4208176e8fb0ce43237786129ddbcd5a77b8b052b7003ad414c7b018b35086c5f68dfa944c3ade415969f18484e9e298a980ef5e138668fbd60286cc697456a5
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
require "open-uri"
|
|
2
|
+
require "fileutils"
|
|
3
|
+
|
|
1
4
|
module Textbringer
|
|
5
|
+
CONFIG[:skk_dictionary_path] = File.expand_path("~/.textbringer/skk/SKK-JISYO.L")
|
|
6
|
+
|
|
2
7
|
class SkkInputMethod < InputMethod
|
|
3
8
|
HIRAGANA_TABLE = {
|
|
4
9
|
"a" => "あ", "i" => "い", "u" => "う", "e" => "え", "o" => "お",
|
|
@@ -94,8 +99,6 @@ module Textbringer
|
|
|
94
99
|
(s.size - 1).times.map { |i| s[0, i + 1] }
|
|
95
100
|
}.uniq
|
|
96
101
|
|
|
97
|
-
DICTIONARY_PATH = File.expand_path("~/.textbringer/skk/SKK-JISYO.L")
|
|
98
|
-
|
|
99
102
|
DEFAULT_CURSOR_COLORS = {
|
|
100
103
|
hiragana: "pink",
|
|
101
104
|
katakana: "green",
|
|
@@ -569,7 +572,7 @@ module Textbringer
|
|
|
569
572
|
def ensure_dictionary_loaded
|
|
570
573
|
return if @okuriiari
|
|
571
574
|
|
|
572
|
-
path = CONFIG[:
|
|
575
|
+
path = CONFIG[:skk_dictionary_path]
|
|
573
576
|
@okuriiari = {}
|
|
574
577
|
@okurinasi = {}
|
|
575
578
|
section = :okuriiari
|
|
@@ -748,4 +751,26 @@ module Textbringer
|
|
|
748
751
|
STDOUT.flush
|
|
749
752
|
end
|
|
750
753
|
end
|
|
754
|
+
|
|
755
|
+
SKK_DICTIONARY_URL = "https://github.com/skk-dev/dict/raw/090619ac57ef230a0506c191b569fc8c82b1025b/SKK-JISYO.L"
|
|
756
|
+
|
|
757
|
+
module Commands
|
|
758
|
+
define_command(:skk_download_dictionary, doc: "Download SKK dictionary") do
|
|
759
|
+
path = CONFIG[:skk_dictionary_path]
|
|
760
|
+
if File.exist?(path) && !yes_or_no?("#{path} already exists. Overwrite it?")
|
|
761
|
+
return
|
|
762
|
+
end
|
|
763
|
+
background do
|
|
764
|
+
URI.open(SKK_DICTIONARY_URL) do |f|
|
|
765
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
766
|
+
File.open(path, "wb") do |out|
|
|
767
|
+
IO.copy_stream(f, out)
|
|
768
|
+
end
|
|
769
|
+
end
|
|
770
|
+
foreground do
|
|
771
|
+
message("Downloaded to #{path}")
|
|
772
|
+
end
|
|
773
|
+
end
|
|
774
|
+
end
|
|
775
|
+
end
|
|
751
776
|
end
|
data/lib/textbringer/version.rb
CHANGED