summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def287
-rw-r--r--Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty83
2 files changed, 11 insertions, 359 deletions
diff --git a/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def b/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
index b82e1ce0d5d..695a4c24601 100644
--- a/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
+++ b/Master/texmf-dist/tex/latex/bxwareki/bxwareki-cd.def
@@ -1,7 +1,7 @@
%%
%% This is file 'bxwareki-cd.def'.
%%
-%% Copyright (c) 2018 Takayuki YATO (aka. "ZR")
+%% Copyright (c) 2018,2019 Takayuki YATO (aka. "ZR")
%% GitHub: https://github.com/zr-tex8r
%% Twitter: @zr_tex8r
%%
@@ -12,18 +12,12 @@
%% file declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{bxwareki-cd.def}[2018/10/01 v0.4]
+\ProvidesFile{bxwareki-cd.def}[2019/06/01 v0.6]
\ifbxwy@epTeXinputencoding@ok
\epTeXinputencoding utf8
\fi
-%% branch for download mode
-\ifbxwy@download
- \long\def\bxwy@next#1\bxwy@download{}
- \expandafter\bxwy@next
-\fi
-
%--------------------------------------- helpers
%% \bxwy@burst-`>...
@@ -127,283 +121,6 @@
\def\bxwy@cdpo@@o#1#2#3{#1#2o}
\def\bxwy@cdpo@@O#1#2#3{#1#2O}
-%--------------------------------------- special procedure for LuaTeX
-\ifx\bxwy@new@gengo\@empty \ifnum\bxwy@engine=5
-
-% The process below tries to guess the name of the new gengo
-% from the result of os,date().
-\begingroup
- \catcode`\~=12 \let\0\relax \let\1\relax \let\2\relax
- \directlua{
- if not bxwareki then bxwareki = {} end
- local os = bxwareki.os or os
- function bxwareki.get_new_gengo()
- local lc_time = nil
- local ok, ret = pcall(function()
- assert(os.type == "unix")
- lc_time = os.setlocale(nil, "time")
- assert(os.setlocale("ja_JP.utf8", "time") or
- os.setlocale("ja_JP.UTF-8", "time"))
- local heisei = "\229\185\179\230\136\144"
- local kanji = "[\228-\233][\128-\191][\128-\191]"
- local gh = os.date("\037EC", 1500000000)
- local gn = os.date("\037EC", 1600000000)
- assert(gh == heisei and gn ~= heisei and
- gn:match("^"..kanji..kanji.."$"))
- return gn
- end)
- os.setlocale(lc_time, "time")
- return ok and ret or ""
- end}
- \toks@{}
- \directlua{pcall(function()
- tex.toks[0] = bxwareki.get_new_gengo()
- end)}
- \xdef\bxwy@new@gengo{\the\toks@}
-\endgroup
-
-\fi\fi
%--------------------------------------- all done
\endinput
-%=======================================
-\bxwy@download
-\begingroup
-\catcode`\^^A=14 \catcode`\^^\=0 \catcode`\^^[=1 \catcode`\^^]=2
-\endlinechar=10 \catcode10=12 \catcode96=7 \let\do\@makeother
-\dospecials``\directlua``[``A
-local ok, retcode = pcall(function()
----------------------------------------- shell availability check
-local ok = false
-if ((status and status.luatex_version) or 0) >= 68 then
- ok = (os.execute() == 1)
-end
-if not ok then return 2 end
----------------------------------------- preparations
-local url = 'https://raw.githubusercontent.com/zr-tex8r/BXwareki/master/bxwareki2019.def'
-local fdef = 'bxwareki2019.def'
-io.stderr:write("\n\n//////// START BXWAREKI DOWNLOAD PROCEDURE ////////\n")
-local function log(s)
- io.stderr:write("bxwareki: ", s, "\n")
-end
-local function info(f, ...) log(f:format(...)) end
-local function finish(s, ...) info(...); return s end
----------------------------------------- 'zrget' module
-zrget = (function(M)
- -- parameters
- M.max_trial = M.max_trial or 3
- M.interval = M.interval or 1 -- second
- M.log = M.log or true
-
- -- helpers
- local lfs = require 'lfs'
- local socket = require 'socket'
- local tempb = '__zrget'
- local win = (lfs.attributes('C:\\NUL', 'mode') ~= nil)
- local function upath(pth)
- return (win) and pth:gsub('\\', '/') or pth
- end
- local function npath(pth)
- return (win) and pth:gsub('/', '\\') or pth
- end
- local function mpath(...)
- return table.concat({...}, (win) and '\\' or '/')
- end
- local function log_print(s)
- io.stderr:write("zrget: ", s, "\n")
- end
- local function log(fmt, ...)
- if not M.log then return end
- local l = (type(M.log) == 'function') and M.log or log_print
- l(tostring(fmt):format(...))
- end
- local function file_ok(pth)
- return ((lfs.attributes(pth, 'size') or 0) > 0)
- end
- local function execute(clfmt, ...)
- local cl = clfmt:format(...)
- if M.verbose then log("RUN: %s", cl) end
- local ok = os.execute(cl)
- return (ok == true) or (ok == 0)
- end
- local badbin = '*'
- local function exefile(pth)
- pth = npath(pth..(win and '.exe' or ''))
- return (file_ok(pth) or nil) and pth
- end
- local function validate(vprc, pth)
- if not file_ok(pth) then return false end
- local h = io.open(pth, 'rb')
- local d = h and h:read('*a')
- if h then h:close() end
- local r = d and (not vprc or vprc(d))
- if not r then log("Validation failure") end
- return r
- end
-
- -- TeXLive stuffs
- local kpse
- pcall(function()
- kpse = require 'kpse'
- kpse.set_program_name('luatex')
- end)
- local tlpkg = kpse and kpse.var_value('SELFAUTOPARENT')
- tlpkg = tlpkg and tlpkg..'/tlpkg'
- local tlwget = tlpkg and exefile(tlpkg..'/installer/wget/wget')
- local tlperl = tlpkg and exefile(tlpkg..'/tlperl/bin/perl')
-
- -- methods
- local fcout, fcerr, ftdst =
- tempb..'-1.out', tempb..'-2.out', tempb..'-0.bin'
- local method_list = {
- {
- name = 'wget';
- checker = 'wget --version'; check_tag = 'Wget';
- loader = function(src)
- return execute('wget -q --no-check-certificate "%s" -O %s 2>%s',
- src, ftdst, fcerr)
- end
- },
- {
- name = 'curl';
- checker = 'curl --version'; check_tag = 'curl';
- loader = function(src)
- return execute('curl -k -s "%s" -o %s 2>%s',
- src, ftdst, fcerr)
- end
- },
- {
- name = 'tl-wget';
- checker = tlwget and tlwget..' --version'; check_tag = 'Wget';
- loader = function(src)
- return execute('%s -q --no-check-certificate "%s" -O %s 2>%s',
- tlwget, src, ftdst, fcerr)
- end
- },
- {
- name = 'powershell';
- checker = 'powershell -Help'; check_tag = 'PowerShell';
- loader = function(src)
- return execute('powershell -Command Invoke-WebRequest '..
- '"%s" -OutFile %s 2>%s',
- src, ftdst, fcerr)
- end
- },
---[[
- {
- name = 'tl-perl';
- checker = tlperl and tlperl..' --version'; check_tag = '?Perl';
- loader = function(src)
- return false -- TODO: make it
- end
- },
-]]
- }
-
- -- main procedure
- function M.download(url, dst, vprc)
- url = tostring(url):gsub('[\1-\31 \"\'<>\\`{|}]',
- function(s) return ('%%%02X'):format(string.byte(s)) end)
- if file_ok(dst) then
- log("File '%s' already exists", dst)
- return false
- end
- os.remove(dst)
- --
- local done = false
- for tc = 1, M.max_trial do
- for _, mth in ipairs(method_list) do
- repeat
- if not mth.checker or mth.pass then break end
- log("Try method '%s'...(%s)", mth.name, tc)
- -- check
- execute('%s 1>%s 2>%s', mth.checker, fcout, fcerr)
- local hso = io.open(fcout, 'rb')
- local p = (hso and hso:read('*a') or ''):find(mth.check_tag, 1, true)
- hso:close()
- if not p then
- log("Method '%s' is not available", mth.name)
- mth.pass = true
- break
- end
- -- download
- log("Try downloading...")
- os.remove(ftdst)
- if mth.loader(url) and validate(vprc, ftdst) then
- done = true; break
- end
- socket.sleep(M.interval)
- os.remove(ftdst)
- until true
- if done then break end
- end
- if done then break end
- end
- --
- if done then
- os.rename(ftdst, dst)
- log("File '%s' is successfully downloaded", dst)
- else
- log("File '%s' cannot be downloaded", dst)
- end
- --
- for _, f in ipairs {ftdst, fcerr, fcout} do
- os.remove(f)
- end
- return done
- end
-
- return M
-end)({})
----------------------------------------- make directory
-if kpse.find_file(fdef, 'tex', true) then
- return finish(0, "File '%s' already exists.", fdef)
-end
-local phome = kpse.var_value("TEXMFHOME")
-if not (phome and lfs.isdir(phome)) then
- return finish(1, "TEXMFHOME is invalid.")
-end
-local ppkg = assert(kpse.find_file('bxwareki.sty', 'tex', true))
-local pm = (ppkg:match('^.*(tex/latex.*)') or 'tex/latex/bxwareki/')
- :gsub('/[^/]*$', '')
-local pddir = phome
-for t in pm:gmatch('[^/]+') do
- pddir = pddir..'/'..t
- lfs.mkdir(pddir)
-end
-if not lfs.isdir(pddir) then
- return finish(1, "Cannot create directory '%s'", pddir)
-end
----------------------------------------- download
-zrget.log = log
-info("Target file is '%s'.", fdef)
-local ok = zrget.download(url, fdef,
- function (d) return d:match('^%x%x%x%x%x%x:%x%x%x%x:') end)
-if not ok then return 1 end
----------------------------------------- transfer
-local pddef = pddir..'/'..fdef
-local hddef = io.open(pddef, 'wb')
-if not hddef then
- return finish(1, 'Cannot open '%s' for output.', pddef)
-end
-local hsdef = assert(io.open(fdef, 'rb'))
-assert(hddef:write(assert(hsdef:read('*a'))))
-hsdef:close(); hddef:close()
-os.remove(fdef)
-info("Target file is copied to '%s'.", pddef)
----------------------------------------- last check
-if not kpse.find_file(fdef, 'tex', true) then
- return finish(1, "Target file is still not found.")
-end
-return finish(0, "Target file is installed at '%s'.", pddef)
----------------------------------------- done
-end)
-if not ok then
- io.stderr:write("\n\nINTERNAL ERROR:\n"..tostring(retcode).."\n")
- retcode = 1
-end
-tex.setcount('global', 'count@', retcode)
-``]``\endgroup%
-
-\chardef\bxwy@next=\count@
-
%% EOF
diff --git a/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty b/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
index 51dd883fc4b..d3dab98acaa 100644
--- a/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
+++ b/Master/texmf-dist/tex/latex/bxwareki/bxwareki.sty
@@ -12,7 +12,7 @@
%% package declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bxwareki}[2019/04/01 v0.5]
+\ProvidesPackage{bxwareki}[2019/06/01 v0.6]
%% preparation
\def\bxwy@pkgname{bxwareki}
@@ -89,36 +89,11 @@
%--------------------------------------- options
-%% variables
-\newif\ifbxwy@download
-
%% 'download'
-\DeclareOption{download2019}{%
- \bxwy@downloadtrue}
+\DeclareOption{download2019}{}% now no-op
% dispatch
\ProcessOptions\relax
-%--------------------------------------- download mode
-
-\ifbxwy@download
- \chardef\bxwy@next=\tw@
- \ifnum\bxwy@engine=5
- \input{bxwareki-cd.def}
- \fi
- \ifcase\bxwy@next
- \PackageInfo\bxwy@pkgname
- {The installation of 'bxwareki2019.def' succeeded\@gobble}
- \or
- \PackageWarningNoLine\bxwy@pkgname
- {The installation of 'bxwareki2019.def' failed}
- \else
- \PackageWarningNoLine\bxwy@pkgname
- {Download mode is not available here and thus\MessageBreak
- the option 'download2019' is ignored}
- \fi
-\fi
-\bxwy@downloadfalse
-
%--------------------------------------- Japanese string maker
% The "combo-code" represents a single Japanese character and has
@@ -226,6 +201,10 @@
\let\bxwy@@heisei\@empty
\bxwy@add@jchar\bxwy@@heisei{E5B9B3:5E73:4A3F:jAA}
\bxwy@add@jchar\bxwy@@heisei{E68890:6210:402E:fED}
+%% \bxwy@@reiwa : kanji string 'Reiwa'
+\let\bxwy@@reiwa\@empty
+\bxwy@add@jchar\bxwy@@reiwa{E4BBA4:4EE4:4E61:l44}
+\bxwy@add@jchar\bxwy@@reiwa{E5928C:548C:4F42:l83}
%% \bxwy@@nen : kanji for 'year'
\let\bxwy@@nen\@empty
\bxwy@add@jchar\bxwy@@nen{E5B9B4:5E74:472F:i80}
@@ -304,48 +283,6 @@
\ifnum#2>\z@ \bxwy@twicex{\csname bxwy@jcd/X\endcsname}\fi
\ifnum#3>\z@ \bxwy@twicex{\csname bxwy@jcd/#3\endcsname}\fi}
-%--------------------------------------- load the new gengo
-
-%% \bxwy@new@gengo@file
-% The external data file for the new gengo.
-\def\bxwy@new@gengo@file{bxwareki2019.def}
-
-%% \bxwy@new@gengo
-% The kanji string for the new gengo if available; otherwise empty.
-\let\bxwy@new@gengo\@empty
-
-%% \bxwy@new@gengo@initial
-% The initial Latin letter for the new gengo.
-\let\bxwy@new@gengo@initial\@empty
-
-%% read the file
-\endlinechar\m@ne
-\openin\@inputcheck=\bxwy@new@gengo@file\relax
-\ifeof\@inputcheck\else % if available
- \read\@inputcheck to\bxwy@tmpa
- \ifeof\@inputcheck\else
- \edef\bxwy@next{\noexpand\bxwy@new@gengo{\bxwy@tmpa}}
- \expandafter\bxwy@add@jchar\bxwy@next
- \read\@inputcheck to\bxwy@tmpa
- \ifeof\@inputcheck
- \global\let\bxwy@new@gengo\@empty
- \else
- \edef\bxwy@next{\noexpand\bxwy@new@gengo{\bxwy@tmpa}}
- \expandafter\bxwy@add@jchar\bxwy@next
- \read\@inputcheck to\bxwy@tmpa
- \ifeof\@inputcheck
- \global\let\bxwy@new@gengo\@empty
- \else
- \let\bxwy@new@gengo@initial\bxwy@tmpa
- \fi
- \fi
- \fi
-\fi
-\endlinechar=13 %
-\def\bxwy@next#1>#2#3#4\bxwy@end{%
- \ifx#3\relax\else \let\bxwy@new@gengo@initial\@empty \fi}
-\expandafter\bxwy@next\meaning\bxwy@new@gengo@initial\relax\relax\bxwy@end
-
%--------------------------------------- calculate wareki year
%% errors
@@ -401,10 +338,8 @@
\let\bxwy@tmpb\bxwy@@heisei
\advance\@tempcntb-1988\relax
\else % the new era
- \ifx\bxwy@new@gengo\@empty\else
- \let\bxwy@tmpb\bxwy@new@gengo
- \advance\@tempcntb-2018\relax
- \fi
+ \let\bxwy@tmpb\bxwy@@reiwa
+ \advance\@tempcntb-2018\relax
\fi\fi\fi\fi\fi
%
\global\let\bxwy@g@gengo\bxwy@tmpb
@@ -418,7 +353,7 @@
\else\ifx#1\bxwy@@taisho T%
\else\ifx#1\bxwy@@showa S%
\else\ifx#1\bxwy@@heisei H%
- \else\ifx#1\bxwy@new@gengo \bxwy@new@gengo@initial
+ \else\ifx#1\bxwy@@reiwa R%
\fi\fi\fi\fi\fi\fi}
%--------------------------------------- render wareki date