diff options
author | Norbert Preining <norbert@preining.info> | 2020-04-21 03:02:38 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-04-21 03:02:38 +0000 |
commit | 8731cc5ad70723b9a155917df509d857579c355d (patch) | |
tree | f6594e2b25c3e0aaf4838d7ada0e8885af3fd532 /language/spanish/hyphen-spanish/eshyph-make.lua | |
parent | 2a6dafa8ee740f345650d6a697665bf85a57cc77 (diff) |
CTAN sync 202004210302
Diffstat (limited to 'language/spanish/hyphen-spanish/eshyph-make.lua')
-rw-r--r-- | language/spanish/hyphen-spanish/eshyph-make.lua | 89 |
1 files changed, 77 insertions, 12 deletions
diff --git a/language/spanish/hyphen-spanish/eshyph-make.lua b/language/spanish/hyphen-spanish/eshyph-make.lua index 4fd0193295..7ceaa1b49d 100644 --- a/language/spanish/hyphen-spanish/eshyph-make.lua +++ b/language/spanish/hyphen-spanish/eshyph-make.lua @@ -1,7 +1,39 @@ -- (encoding:utf-8) --- (c) Javier Bezos 2009 --- License: LPPL. v. 4.5 +-- GUIONIZADO DE PALABRAS +-- ~~~~~~~~~~~~~~~~~~~~~ +-- v 5.0 +-- +-- License: MIT/X11 +-- +-- Copyright (c) 1993, 1997 Javier Bezos +-- Copyright (c) 2001-2019 Javier Bezos and CervanTeX +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentation files (the "Software"), to deal +-- in the Software without restriction, including without limitation the rights +-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-- SOFTWARE. +-- +-- For further info, bug reports and comments: +-- +-- https://github.com/jbezos/tex-hyphen-spanish + +---------- + +-- ethymologic, trailing no, bad words, prefixes, consonant + h, tl patfile = io.open('eshyph.tex', 'w') patfile:write('\\patterns{\n') @@ -11,26 +43,33 @@ patfile:write('\\patterns{\n') digraphs = 'ch ll' liquids = 'bl cl fl gl kl pl vl br cr dr fr gr kr pr rr tr vr' -avoid = 'tl' +avoid = 'tl ts tx tz' silent = 'h' +chrl = 'chr chl' letters = 'bcdfghjklmnpqrstvwxyz' +hyphen_silent = false + for n in letters:gmatch('.') do if silent:find(n) then - patfile:write('2' .. n .. '.') + patfile:write(' 4' .. n .. '.') else - patfile:write('1' .. n .. ' 2' .. n .. '.') + patfile:write('1' .. n .. ' 4' .. n .. '. .' .. n .. '2') end for m in letters:gmatch('.') do pat = n .. m if digraphs:find(pat) then - patfile:write(' ' .. n .. '4'.. m .. ' 2' .. pat .. '.') + patfile:write(' ') elseif liquids:find(pat) then - patfile:write(' ' .. n .. '2'.. m .. ' 2' .. pat .. '.') + patfile:write(' ') elseif avoid:find(pat) then - patfile:write(' 2' .. n .. '2'.. m) + patfile:write(' ') elseif silent:find(m) then - patfile:write(' 2' .. n .. '1' .. m) + if hyphen_silent then + patfile:write(' 2' .. n .. '1' .. m) + else + patfile:write(' 2' .. pat) + end else patfile:write(' 2' .. pat) end @@ -38,7 +77,28 @@ for n in letters:gmatch('.') do patfile:write('\n') end -patfile:write('1ñ 2ñ.\n') +patfile:write('1ñ 4ñ.\n') + +for n in digraphs:gmatch('%S+') do + patfile:write(n:sub(1,1) .. '4' .. n:sub(2,2) .. ' 4' .. n .. '.') + for m in letters:gmatch('.') do + pat = n .. m + if chrl:find(pat) then + patfile:write(' ' .. n .. '2' .. m) + else + patfile:write(' 2' .. pat) + end + end + patfile:write('\n') +end + +for n in liquids:gmatch('%S+') do + patfile:write(n:sub(1,1) .. '2' .. n:sub(2,2) .. ' 4' .. n .. '.') + for m in letters:gmatch('.') do + patfile:write(' 2' .. n .. '2' .. m) + end + patfile:write('\n') +end letters = 'bcdlmnrstxy' etim = 'pt ct cn ps mn gn ft pn cz tz ts' @@ -58,11 +118,16 @@ function prefix(p) patfile:write(p:sub(1,-2) .. '3r\n') elseif p:match('[aeiou]$') then p = p .. '1' - patfile:write(p .. 'h\n') end + if not hyphen_silent then + if p:match('[123456789]$') then + patfile:write(p:sub(1,-2) .. '1h\n') + else + patfile:write(p .. '1h\n') + end + end patfile:write(p .. 'a2 ' .. p .. 'e2 ' .. p .. 'i2 ' .. p .. 'o2 ' .. p .. 'u2\n') patfile:write(p .. 'á2 ' .. p .. 'é2 ' .. p .. 'í2 ' .. p .. 'ó2 ' .. p .. 'ú2\n') - end for ln in src:lines() do |