# liblouis: Hungarian Grade 1 Braille input subtable
#
#  Copyright (C) 2018-2021 Attila Hammer from IT Foundation for the Visually Impaired - Hungary. www.infoalap.hu
#
#  This file is part of liblouis.
#
#  liblouis is free software: you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as
#  published by the Free Software Foundation, either version 2.1 of the
#  License, or (at your option) any later version.
#
#  liblouis is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with liblouis. If not, see
#  <http://www.gnu.org/licenses/>.
#
#  Maintained by Attila Hammer  hammer.attila@infoalap.hu
#
# If you found bugs with hungarian grade1 table, report it with following address:
# Attila Hammer <hammer.attila@infoalap.hu
#If you have a Launchpad account, report table related requests with following bug tracker address: https://bugs.launchpad.net/belin

#Hungarian Braille input related rules
#Exceptions for two simple equals special letter rules related (for example two literary cscs letter, two literary gygy letter, etc)
#cscs letter related input rules
nofor endnum cscs 146-5-146
noback endnum cscs 146-5-146
nofor endnum -cscs 36-146-5-146
noback endnum -cscs 36-146-5-146
nofor endnum -Cscs 36-46-146-5-146
noback endnum -Cscs 36-46-146-5-146
nofor always cscs 146-5-146
noback always cscs 146-5-146
noback pass3 $D@36%notaccentedletters.[@14-234-146] @146-5-146
noback pass3 $D@6%notaccentedletters.[@146-14-234] @146-5-146
noback pass3 $D%accentedletters.[@14-234-14-234] @146-5-146
noback pass3 $D%accentedletters.[@146-14-234] @146-5-146
noback pass4 @146-5-146 @146-146

#gygy letter related input rules
nofor endnum gygy 1456-5-1456
noback endnum gygy 1456-5-1456
nofor endnum -gygy 36-1456-5-1456
noback endnum -gygy 36-1456-5-1456
nofor endnum -Gygy 36-46-1456-5-1456
noback endnum -Gygy 36-46-1456-5-1456
nofor always gygy 1456-5-1456
noback always gygy 1456-5-1456
noback pass3 $D@36%notaccentedletters.[@1245-1456] @1456-5-1456
noback pass3 $D@6%notaccentedletters[@1245-1456] @1456-5-1456
noback pass3 $D%accentedletters.[@1456-1245-13456] @1456-5-1456
noback pass4 @1456-5-1456 @1456-1456

#nyny related input rules
nofor always nyny 1246-5-1246
noback always nyny 1246-5-1246
noback pass2 @1246-5-1246 @1246-1246

#Exceptions for lyly letter related input rules
nofor always lyly 456-5-456
noback always lyly 456-5-456
noback pass2 @456-5-456 @456-456

#Exceptions for tyty lrelated rules
nofor always tyty 1256-5-1256
noback always tyty 1256-5-1256
noback pass2 @1256-5-1256 @1256-1256

#Exception  for szsz related input
nofor always szsz 156-5-156
noback always szsz 156-5-156
noback pass2 @156-5-156 @156-156

#Exception rules for zszs input related
endnum zszs 345-5-345
endnum -zszs 36-345-5-345
prepunc zszs 345-5-345
postpunc zszs 345-5-345
nofor always zszs 345-5-345
noback always zszs 345-5-345
noback pass2 @345-5-345 @345-345

#punctuation related exceptions
nofor endnum – 5-36
nofor always – 5-36
nofor context @8 "\n"
nofor context @235-8 "!\n"
nofor context @235-0 "! "

#for plus sign related rule
nofor context @5-235 "+"
#noback context $a["+"] @5-235
noback pass2 @5-235 @235

#for [ and ] character input related old dot combinations related rules, need keeping this rules with compatibility purposes
nofor always [ 5-12356
noback always [ 5-12356
noback pass2 @5-12356 @46-2346
nofor always ] 5-23456
noback always ] 5-23456
noback pass2 @5-23456 @46-1356

#for ` related exception rules
#Compatibility purposes handle older braille 5-4 dot combination when the user trying typing the 5-4 dot combination, and not known yet the new changed 5-14 dot combination
nofor always ` 5-4
noback always ` 5-4
noback context $a1-30["`"] @5-4
noback pass2 @5-4 @5-14
nofor context @5-4 "`"	Handle the backtranslation too

#for { and } related old rules, need keeping this rules with compatibility purposes:
nofor always { 5-12345
noback always { 5-12345
noback pass2 @5-12345 @5-2346
nofor always } 5-12456
noback always } 5-12456
noback pass2 @5-12456 @5-1356

#Compatibility purposes handle older braille 5-45 dot combination when the user trying typing this dot combination he's braille display, and not known the new 5-1245 dot combination
nofor always | 5-45
noback always | 5-45
noback pass2 @5-45 @5-1245
nofor context @5-45 "|"	Handle the back translation too

#Hessmark backtranslation handling related special rule
nofor context @123456 "#"
#Now, the dot 5 and dot 6 braille input forward translation rules are commented out
#nofor pass2 $U2-30[@5]$u2-30 @56
#nofor pass2 $U2-30[@6]$u @56

#Following part implementing the new Braille standard changes
midnum : 3
midnum - 36-3456
hyphen - 36
decpoint , 2
midnum . 3-3456
endnum . 3
endnum – 36-36
always . 3
#When some punctuation characters have after end of numbers, need add a dot6 prefix before the punctuation character dots
endnum : 6-25
endnum ? 6-26
endnum ; 6-23
endnum ! 6-235
endnum " 6-236
endnum * 6-35
prepunc ' 6-3
postpunc ' 6-3
postpunc ; 23
word ; 23
postpunc : 25
prepunc ! 235
postpunc ! 235
punctuation ! 235
endnum % 3456-245-356
endnum -% 36-3456-245-356
noback pass2 $D.@36-3456-245-356[@36-6]%notaccentedletters @36
endnum / 5-2
prepunc / 5-2
postpunc / 5-2
always ' 6-3
midnum : 3
endnum : 6-25
always : 25
always ! 235
always • 6-35

#numbers related braille input rules, trying temporary fixing with numericnocontchars abcdefghij related issue (the #615 issue), link is following:
#https://github.com/liblouis/liblouis/issues/615
#cs related number exceptions
endnum cs 146
endnum -cs 36-146
#prepunc cs 146
postpunc cs 146
always cs 146
noback pass2 $D@6%notaccentedletters[@14-234] @146
noback pass2 $D@6%notaccentedletters%accentedletters.[@14-234] @146
noback pass2 $D@46%notaccentedletters[@14-234] @146
noback pass2 $D@46%notaccentedletters%accentedletters.[@14-234] @146
noback pass2 $D@46-46%notaccentedletters[@14-234] @146
noback pass2 $D@46-46%notaccentedletters%accentedletters.[@14-234] @146
noback pass2 $D[@6-146] @146
#Following rules producing regression errors with large yaml test file, temporary commented out
noback pass2 @3456$D.%accentedletters.[@14-234] @146
noback pass2 @3456$D.%accentedletters.[@14-234] @146
noback pass2 $D@36%accentedletters1-30[@14-234] @146
noback pass2 $D@46%accentedletters1-30[@14-234] @146
noback pass2 $D@36-46%accentedletters1-30[@14-234] @146
noback pass2 $D@36-46-46%accentedletters1-30[@14-234] @146
noback pass2 $D@46-46%accentedletters1-30[@14-234] @146
noback pass3 $D[@36-146-6]%notaccentedletters. @36-146
nofor pass3 $D[@36-146]%notaccentedletters. @36-146

endnum ccsz 14-14-156
endnum -ccsz 36-14-14-156
prepunc ccsz 14-14-156
postpunc ccsz 14-14-156
always ccsz 14-14-156
noback pass2 $D@6%notaccentedletters[@14-14-234-126] @14-14-156
noback pass2 $D%accentedletters1-30[@14-14-234-126] @14-14-156


endnum ccs 146-146	General need replacing ccs letters with a combined dot combination
endnum -ccs 36-146-146
prepunc ccs 146-146	General need replacing ccs letters with a combined dot combination
postpunc ccs 146-146	General need replacing ccs letters with a combined dot combination
noback pass2 $D@6%notaccentedletters[@14-14-234] @146-146
noback pass2 $D%accentedletters1-30[@14-14-234] @146-146

endnum csz 14-156
endnum -csz 36-14-156
prepunc csz 14-156
postpunc csz 14-156
noback pass3 @3456$D%accentedletters.[@146-126] @14-156
noback pass3 @3456$D@46%accentedletters.[@146-126] @14-156
noback pass3 @3456$D@46-46%accentedletters.[@146-126] @14-156
noback pass3 $D@36%accentedletters.[@146-126] @14-156
noback pass3 $D@36-46%accentedletters.[@146-126] @14-156
noback pass3 $D@36-46-46%accentedletters.[@146-126] @14-156
noback pass3 $D@6%notaccentedletters.[@146-126] @14-156
noback pass3 $D@6%notaccentedletters2-30[@146-126] @14-156

endnum cszs 146-345
endnum -cszs 36-146-345
prepunc cszs 146-345
postpunc cszs 146-345
noback pass4 $D$l1-30[@14-156-234] @146-345
noback pass4 $D@6%notaccentedletters[@14-156-234] @146-345
noback pass4 $D[@6-14-156-234] @146-345
#noback pass4 $D%accentedletters1-30[@14-156-234] @146-345

noback endnum gy 1456	General need replacing gy letters with a combined dot combination
endnum -gy 36-1456	General need replacing gy letters with a combined dot combination
prepunc gy 1456	General need replacing gy letters with a combined dot combination
postpunc gy 1456	General need replacing gy letters with a combined dot combination
noback pass2 $D.[@6-1456] @1456
noback pass2 $D.[@36-1456-6]%notaccentedletters. @36-1456
noback pass3 $D.%accentedletters.[@1245-13456] @1456
noback pass2 $D.@46%accentedletters.[@1245-13456] @1456
noback pass2 $D.@46-46%accentedletters.[@1245-13456] @1456
noback pass2 $D.@36%accentedletters.[@1245-13456] @1456
noback pass2 $D.@36-46%accentedletters.[@1245-13456] @1456
noback pass2 $D.@36-46-46%accentedletters1-30[@1245-13456] @1456
noback pass3 $D.@6%notaccentedletters1-30[@1245-13456] @1456

endnum ggy 1456-1456	General need replacing ggy letters with a combined dot combination
endnum -ggy 36-1456-1456	General need replacing ggy letters with a combined dot combination
prepunc ggy 1456-1456	General need replacing ggy letters with a combined dot combination
postpunc ggy 1456-1456	General need replacing ggy letters with a combined dot combination
always ggy 1456-1456

endnum ly 456
endnum -ly 36-456
prepunc ly 456
postpunc ly 456
always ly 456
noback pass2 $D.[@36-456-6]%notaccentedletters. @36-456

endnum lly 456-456	General need replacing ly letters with a combined dot combination
endnum -lly 36-456-456	General need replacing ly letters with a combined dot
prepunc lly 456-456	General need replacing ly letters with a combined dot combination
postpunc lly 456-456	General need replacing ly letters with a combined dot combination
always lly 456-456

endnum ny 1246
endnum -ny 36-1246
prepunc ny 1246	General need replacing ny letters with a combined dot combination
postpunc ny 1246	General need replacing ny letters with a combined dot combination
noback pass2 $D.[@6-1246] @1246
noback pass2 $D.[@36-1246-6]%notaccentedletters. @36-1246

endnum nny 1246-1246	General need replacing nny letters with a combined dot combination
endnum -nny 36-1246-1246	General need replacing nny letters with a combined dot combination
prepunc nny 1246-1246	General need replacing nny letters with a combined dot combination
postpunc nny 1246-1246	General need replacing nny letters with a combined dot combination
always nny 1246-1246

endnum ty 1256	General need replacing ty letter pairs with a combined dot combination
endnum -ty 36-1256	General need replacing ty letter pairs with a combined dot combination
prepunc ty 1256	General need replacing ty letter pairs with a combined dot combination
postpunc ty 1256	General need replacing ty letter pairs with a combined dot combination
always ty 1256
noback pass2 $D.[@36-1256-6]%notaccentedletters. @36-1256

endnum tty 1256-1256		General need replacing ty letter pairs with a combined dot combination
endnum -tty 36-1256-1256		General need replacing ty letter pairs with a combined dot combination
prepunc tty 1256-1256		General need replacing ty letter pairs with a combined dot combination
postpunc tty 1256-1256		General need replacing ty letter pairs with a combined dot combination
always tty 1256-1256	General need replacing ty letter pairs with a combined dot combination

endnum sz 156	General need replacing sz letters with a combined dot combination
endnum -sz 36-156	General need replacing sz letters with a combined dot combination
prepunc sz 156	General need replacing sz letters with a combined dot combination
postpunc sz 156	General need replacing sz letters with a combined dot combination
always sz 156
noback pass2 $D.[@6-156] @156
noback pass2 $D.[@36-156-6]%notaccentedletters. @36-156
#noback pass3 $D.%accentedletters[@234-126] @156
noback pass2 $D.@46%accentedletters.[@234-126] @156
noback pass2 $D.@46-46%accentedletters.[@234-126] @156
noback pass3 $D.$p%accentedletters.[@234-126] @156
noback pass2 $D.@36-46%accentedletters.[@234-126] @156
noback pass2 $D.@36-46-46%accentedletters1-30[@234-126] @156
noback pass3 $D.@6%notaccentedletters.[@234-126] @156
noback pass3 $D.@6%notaccentedletters%accentedletters.[@234-126] @156
noback pass2 [@156-156-6] @156-156

endnum ssz 156-156
endnum -ssz 36-156-156
prepunc ssz 156-156
postpunc ssz 156-156
always ssz 156-156
noback pass3 $D.@6%notaccentedletters1-30[@234-234-126] @156-156
noback pass3 $D.[@36-156-6]%notaccentedletters. @36-156-156
noback pass3 $l.[@156-6]$a @156

endnum zsz 126-156
endnum -zsz 36-126-156
prepunc zsz 126-156
postpunc zsz 126-156
always zsz 126-156

endnum zs 345	General need replacing zs letters with a combined dot combination
endnum -zs 36-345	General need replacing zs letters with a combined dot combination
prepunc zs 345
postpunc zs 345
always zs 345
noback pass2 $D.[@36-345-6]%notaccentedletters. @36-345

endnum zzs 345-345	General need replacing zs letters with a combined dot combination
endnum -zzs 36-345-345	General need replacing zs letters with a combined dot combination
prepunc zzs 345-345	General need replacing zs letters with a combined dot combination
postpunc zzs 345-345	General need replacing zs letters with a combined dot combination
always zzs 345-345	General need replacing zs letters with a combined dot combination

#Special punctuation simbols
prepunc " 236	Opening quotation simbol
postpunc " 356	Closing quotation simbol
prepunc « 236
postpunc » 356
prepunc » 236
postpunc « 356
prepunc « 236
postpunc » 356
prepunc ‘ 236
postpunc ’ 356
prepunc ‚ 236
postpunc ‚ 356
prepunc “ 236
prepunc ” 236
postpunc ” 356
prepunc „ 236
postpunc „ 356

#some left and right parentheses related rules, with affecting only the back translation
nofor partword ( 2346	For example with csinál(hat) word correct backtranslation related
nofor partword ) 1356	Same the left parenthese related rule, this rule need only to Liblouis result correct back translation if inside a word have a right parenthese character
endnum ( 2346
prepunc ( 2346	Opening left parenthese
punctuation ( 2346	Opening left parenthese
postpunc ( 2346	Need this rule to the user always see 2346 dot combination
endnum ) 1356	Need this rule to the user always see 1356 dot combination if type first ) character a text
prepunc ) 1356	Need this rule to the user always see 1356 dot
postpunc ) 1356	Need this rule to the user always see 1356 dot

#Other exceptions With need marking different dot combination
endnum # 123456
prepunc # 123456
postpunc # 123456
punctuation # 123456
endnum $ 5-145
prepunc $ 5-145
postpunc $ 5-145
endnum ~ 5-2345
prepunc ~ 5-2345
punctuation ~ 5-2345
postpunc ~ 5-2345
endnum < 5-13
prepunc < 5-13
postpunc < 5-13
endnum > 46-2
prepunc > 46-2
postpunc > 46-2
endnum | 5-1245
prepunc | 5-1245
postpunc | 5-1245
endnum { 5-2346
prepunc { 5-2346
postpunc { 5-2346
endnum } 5-1356
prepunc } 5-1356
postpunc } 5-1356
endnum [ 46-2346
prepunc [ 46-2346
postpunc [ 46-2346
endnum ] 46-1356
prepunc ] 46-1356
postpunc ] 46-1356
endnum \\ 5-16
prepunc \\ 5-16
postpunc \\ 5-16
endnum ^ 5-124
prepunc ^ 5-124
postpunc ^ 5-124
endnum ` 5-14
prepunc ` 5-14
postpunc ` 5-14
punctuation ` 5-14
endnum lyú 456-346
endnum lysz 456-156
endnum ä 5-1
prepunc ä 5-1
postpunc ä 5-1
noback context $l$p["–"] @36-36
noback context $l["–"] @36-36
nofor correct $D1-30["--annyi"] "--ai"
nofor correct $D1-30["--ennyi"] "--ei"
#nofor correct $D1-30["-'annyi"] "-ai"
nofor correct $D1-30["-ennyi"] "-ei"

nofor correct $D["'"]$l ?
nofor correct $D["'"]$U ?
nofor correct ["—'"]$l "--"
nofor correct ["--'"]$l "-"
nofor correct ["-'"]$l "-"
