summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMaster/texmf-dist/scripts/uptex/convbkmk.rb25
1 files changed, 15 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/uptex/convbkmk.rb b/Master/texmf-dist/scripts/uptex/convbkmk.rb
index ab9e362df77..2794329384b 100755
--- a/Master/texmf-dist/scripts/uptex/convbkmk.rb
+++ b/Master/texmf-dist/scripts/uptex/convbkmk.rb
@@ -3,13 +3,13 @@
=begin
-convbkmk Ver.0.01
+convbkmk Ver.0.03
= License
convbkmk
-Copyright (c) 2009-2011 Takuji Tanaka
+Copyright (c) 2009-2012 Takuji Tanaka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -33,10 +33,14 @@ THE SOFTWARE.
2009.08.02 0.00 Initial version.
2011.05.02 0.01 Bug fix: BOM was not correct.
+2012.05.08 0.02 Bug fix: for a case of dvips with -z option and Ruby1.8.
+ Add conversion of /Creator and /Producer .
+2012.05.09 0.03 Suppress halfwidth -> fullwidth katakana conversion
+ and MIME decoding in Ruby1.8.
=end
-Version = "0.01"
+Version = "0.03"
require "optparse"
@@ -52,10 +56,10 @@ else
$RUBY_M17N = false
require "jcode" # for method each_char
- require "kconv"
+ require "nkf"
class String
def to_utf16be(enc)
- self.kconv(Kconv::UTF16, enc.kconv_enc)
+ NKF.nkf('-w16 -x -m0 '+enc.kconv_enc, self)
end
def ascii_only?
return self !~ /[\x80-\xFF]/n
@@ -64,7 +68,8 @@ else
tmp = "\"" + self + "\""
tmp.gsub!("\\(","\\\\\\(")
tmp.gsub!("\\)","\\\\\\)")
- tmp.gsub!("\n","\\n").gsub!("\r","\\r")
+ tmp.gsub!("\n","\\n")
+ tmp.gsub!("\r","\\r")
return tmp == self.inspect
end
def force_encoding(enc)
@@ -88,9 +93,9 @@ class TeXEncoding
@list = ['Shift_JIS', 'EUC-JP', 'UTF-8']
if !$RUBY_M17N
@kconv_enc = nil
- @kconv_list = {'Shift_JIS' => Kconv::SJIS,
- 'EUC-JP' => Kconv::EUC,
- 'UTF-8' => Kconv::UTF8}
+ @kconv_list = {'Shift_JIS' => '--sjis-input',
+ 'EUC-JP' => '--euc-input',
+ 'UTF-8' => '--utf8-input'}
end
end
@@ -290,7 +295,7 @@ def file_treatment(ifile, ofile, enc)
while l = ifile.gets do
line.force_encoding('ASCII-8BIT') if $RUBY_M17N
line += l
- if (line !~ %r!(/Author|/Title|/Subject|/Keywords)! )
+ if (line !~ %r!(/Title|/Author|/Keywords|/Subject|/Creator|/Producer)(\s+\(|$)! )
ofile.print line
line = ''
next