summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-12-29 23:24:31 +0000
committerKarl Berry <karl@freefriends.org>2014-12-29 23:24:31 +0000
commit0d356cbc4fb5137e063b6ed23e55e913298bf338 (patch)
tree626bd7e7586ec657a9264bdeee18639e4590a6ec /Master/texmf-dist/source
parent9a0f0d057b7f36dcc8f060ed5efdcdf0408ad201 (diff)
xpinyin (25dec14)
git-svn-id: svn://tug.org/texlive/trunk@35921 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx36
1 files changed, 11 insertions, 25 deletions
diff --git a/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx b/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx
index 5b11fb4a31c..34757cc9032 100644
--- a/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx
+++ b/Master/texmf-dist/source/latex/xpinyin/xpinyin.dtx
@@ -161,19 +161,19 @@ and some specific Chinese Simplified fonts (TrueType or OpenType).
%<*driver|package>
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: xpinyin.dtx 746 2014-12-23 13:58:49Z sobenlee@gmail.com $
+\GetIdInfo$Id: xpinyin.dtx 749 2014-12-24 15:05:15Z sobenlee@gmail.com $
{Automatically add pinyin to Chinese characters}
%<*driver>
\ProvidesExplFile{\ExplFileName.\ExplFileExtension}
%</driver>
%<package>\ProvidesExplPackage{\ExplFileName}
- {\ExplFileDate}{2.0}{\ExplFileDescription}
+ {\ExplFileDate}{2.1}{\ExplFileDescription}
%<*driver>
\ExplSyntaxOff
%</driver>
%</driver|package>
%<database>\ProvidesFile{xpinyin-database.def}%
-%<database> [2014/12/23 v2.0 xpinyin database]
+%<database> [2014/12/24 v2.1 xpinyin database]
%
%<*driver>
\documentclass[full,a4paper]{l3doc}
@@ -1295,20 +1295,18 @@ end
%
% \begin{macrocode}
xpinyin = {
- svnid = "$Id: xpinyin.dtx 746 2014-12-23 13:58:49Z sobenlee@gmail.com $",
+ svnid = "$Id: xpinyin.dtx 749 2014-12-24 15:05:15Z sobenlee@gmail.com $",
uchar = unicode.utf8.char,
- ugsub = unicode.utf8.gsub,
readings = { },
fixreadings = {
% \end{macrocode}
% 为汉字“〇”增加拼音。
% \begin{macrocode}
- {"U+3007", "Mandarin", "líng"},
+ {"U+3007", "Mandarin", "líng"}
+ },
% \end{macrocode}
-% 修改汉字“女”的错误拼音。
+%
% \begin{macrocode}
- {"U+5973", "HanyuPinlu", "nǚ(1129) rǔ(37)"}
- },
database = {
source = "http://www.unicode.org/Public/UNIDATA/Unihan.zip",
file = "Unihan_Readings.txt",
@@ -1317,15 +1315,6 @@ xpinyin = {
dbfile = "xpinyin.db"
},
% \end{macrocode}
-% \texttt{Unihan} 的 \texttt{kHanyuPinlu} 数据把韵母 |ou| 的音调都标在了 |u| 上。
-% \begin{macrocode}
- outones = {
- oū = "ōu" ,
- oú = "óu" ,
- oǔ = "ǒu" ,
- où = "òu"
- },
-% \end{macrocode}
% \pkg{DocStrip} 会将一行开头的 |%%| 替换成 \tn{MetaPrefix},因此我们在行首加了
% 空格,需要把它去掉。
% \begin{macrocode}
@@ -1400,7 +1389,7 @@ end
% 往拼音表中加入项目。
% \begin{macrocode}
function xpinyin.insert (unicode, prop, value)
- local index = tonumber(unicode:sub(3), 16)
+ local index = tonumber(unicode:match("%x+$"), 16)
if not xpinyin.readings[index] then
xpinyin.readings[index] = { }
end
@@ -1445,14 +1434,11 @@ function xpinyin.pairsByKeys (t, f)
end
% \end{macrocode}
%
-% 按照 \texttt{HanyuPinlu}、\texttt{Mandarin}、\texttt{XHC1983}、\texttt{HanyuPinyin}
-% 的顺序选择最常用的拼音。
+% 按照 \texttt{Mandarin}、\texttt{XHC1983}、\texttt{HanyuPinyin}
+% 的顺序选择最常用的拼音。\texttt{HanyuPinlu} 的质量较差,不采用。
% \begin{macrocode}
function xpinyin.grep (pyt)
- if pyt.HanyuPinlu then
- return xpinyin.ugsub(pyt.HanyuPinlu:match("[^%(]+"), "o[ūúǔù]$", xpinyin.outones),
- "HanyuPinlu"
- elseif pyt.Mandarin then
+ if pyt.Mandarin then
return pyt.Mandarin:match("%S+"), "Mandarin"
elseif pyt.XHC1983 then
return pyt.XHC1983:match(":(%S+)"), "XHC1983"