summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-03-26 21:59:35 +0000
committerKarl Berry <karl@freefriends.org>2020-03-26 21:59:35 +0000
commit6718ddef228e265e1229ab24336b433213b81db2 (patch)
tree76ade7bee4f6c4f4f281117fc1b421299d2fb235 /Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen
parent26b61329ccfef7f8de119d7cf2ae772288e1497d (diff)
hyph-utf8, with tlpsrc from arthur
git-svn-id: svn://tug.org/texlive/trunk@54568 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen')
-rw-r--r--Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/converter.rb39
-rw-r--r--Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/loader.rb2
-rw-r--r--Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/package.rb6
-rw-r--r--Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/source.rb6
4 files changed, 48 insertions, 5 deletions
diff --git a/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/converter.rb b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/converter.rb
new file mode 100644
index 00000000000..3b966d45a40
--- /dev/null
+++ b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/converter.rb
@@ -0,0 +1,39 @@
+# encoding: UTF-8
+
+require 'scanf'
+require 'byebug'
+
+module TeX
+ module Hyphen
+ class Converter
+ def read(conversion)
+ @mapping = { }
+ File.read(conversion).each_line do |line|
+ next if line =~ /^#/
+
+ eightbit, usv = line.scanf "0x%02X\tU+%04X"
+ @mapping[eightbit] = usv.chr(Encoding::UTF_8)
+ end
+ end
+
+ def convert(filename)
+ raise "Please define the encoding mapping first with #read" unless @mapping
+ doconvert = false
+ File.open(filename, external_encoding: Encoding::ASCII_8BIT).each_line do |line|
+ if line =~ /\\patterns{/
+ doconvert = true
+ next
+ end
+ doconvert = false if doconvert && line =~ /}/
+
+ if doconvert
+ puts (line.strip.each_byte.map do |byte|
+ byebug unless @mapping[byte]
+ @mapping[byte]
+ end || '').join
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/loader.rb b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/loader.rb
index 2fcb3945d30..878bf0ef0d3 100644
--- a/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/loader.rb
+++ b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/loader.rb
@@ -4,7 +4,7 @@ module TeX
module Loader
def unicode_only? # TODO Spec out
- ['cu', 'sa','as','bn','gu','hi','hy','kn','lo','mul-ethi','ml','mr','or','pa','ta','te', 'pi'].include? @bcp47
+ ['cu', 'sa','as','bn','gu','hi','hy','kn','lo','mul-ethi','ml','mr','or','pa','ta','te', 'pi', 'mk'].include? @bcp47
end
def string_enc
diff --git a/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/package.rb b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/package.rb
index 69481a41774..1d40dc512e8 100644
--- a/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/package.rb
+++ b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/package.rb
@@ -104,7 +104,11 @@ module TeX
unless has_dependency?
languages.each do |language|
if language.use_old_patterns_comment and language.legacy_patterns != "zerohyph.tex" and language.bcp47 != 'cop'
- files << sprintf("tex/generic/hyphen/%s", language.legacy_patterns)
+ if language.bcp47 == 'la-x-classic'
+ files << sprintf("tex/generic/hyph-utf8/patterns/tex-8bit/%s", language.legacy_patterns)
+ else
+ files << sprintf("tex/generic/hyphen/%s", language.legacy_patterns)
+ end
end
end
end
diff --git a/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/source.rb b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/source.rb
index 61292dcd3bb..dce5be00b41 100644
--- a/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/source.rb
+++ b/Master/texmf-dist/source/generic/hyph-utf8/lib/tex/hyphen/texlive/source.rb
@@ -82,7 +82,7 @@ module TeX
end
files << File.join(PATH::HYPHU8, 'patterns', 'tex', sprintf('hyph-%s.tex', bcp47))
- if encoding && encoding != "ascii" then
+ if encoding && encoding != "ascii" && bcp47 != 'la-x-classic' then
files << File.join(PATH::HYPHU8, 'patterns', 'ptex', sprintf('hyph-%s.%s.tex', bcp47, encoding))
elsif bcp47 == "cop"
files << File.join(PATH::HYPHU8, 'patterns', 'tex-8bit', legacy_patterns)
@@ -91,14 +91,14 @@ module TeX
# we skip the mongolian language for luatex files
return files if bcp47 == "mn-cyrl-x-lmc"
- ['chr', 'pat', 'hyp', 'lic'].each do |t|
+ ['pat', 'hyp'].each do |t|
files << File.join(PATH::HYPHU8, 'patterns', 'txt', sprintf('hyph-%s.%s.txt', bcp47, t))
end
if bcp47 =~ /^sh-/
# duplicate entries (will be removed later)
files << File.join(PATH::HYPHU8, 'patterns', 'tex', 'hyph-sr-cyrl.tex')
- ['chr', 'pat', 'hyp', 'lic'].each do |t|
+ ['pat', 'hyp'].each do |t|
# duplicate entries (will be removed later)
files << File.join(PATH::HYPHU8, 'patterns', 'txt', sprintf('hyph-sr-cyrl.%s.txt', t))
end