#
# Copyright (C) 2010, 2011 by DocArch <http://www.docarch.be>
# Copyright (C) 2014 by Bert Frees
# Copyright (C) 2014 by CBB <http://www.cbb.nl>
#
# 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 3 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/>.
#
# -------------------------------------------------------------------------------
#
# Dutch Braille (the Netherlands)
# Created by Bert Frees <bertfrees@gmail.com>
# Modified and maintained by Henri Apperloo <h.apperloo@cbb.nl>
# See also: « Braillestandaard voor algemeen gebruik in het Nederlandse taalgebied,
# Van toepassing vanaf 1 september 2005 »
# (Federatie Slechtzienden- en Blindenbelang en
# Belgische Confederatie voor Blinden en Slechtzienden, 2005)
# [https://cdn.rawgit.com/liblouis/liblouis/formal_braille_spec/Eindtekst-zonder-voorblad-dec-2005.doc][1]
#
# ----------------------------------------------------------------------------------------------
include nl-NL-chardefs.cti
include braille-patterns.cti
# ----------------------------------------------------------------------------------------------
# Emphasis opcodes
# ----------------------------------------------------------------------------------------------
# §1.58 Drukwijzigingsteken [1]
lenitalphrase 3
italsign 456
begital 456
endital 6
firstwordital 456-456
lenboldphrase 3
boldsign 456
begbold 456
endbold 6
firstwordbold 456-456
lenunderphrase 3
undersign 456
begunder 456
endunder 6
firstwordunder 456-456
# ----------------------------------------------------------------------------------------------
# Special symbol opcodes
# ----------------------------------------------------------------------------------------------
decpoint \x002C 2
decpoint \x002E 256
hyphen \x002D 36
# ----------------------------------------------------------------------------------------------
# Translation opcodes
# ----------------------------------------------------------------------------------------------
# §1.55 Paragraafteken [1]
begword \x00A7 346-0
midword \x00A7 0-346-0
endword \x00A7 0-346
# §2.18 Procent- en promilleteken [1]
endnum \x0025 0-123456
endnum \x2030 0-123456-123456
# §3.2 De basisrekentekens (spatieregel) [1]
# isgelijkteken =
begword \x003D 2356-0
midword \x003D 0-2356
endword \x003D 0-2356-0
# plusteken +
begword \x002B 235-0
endnum \x002B 5-235
# deelteken ÷
begword \x00F7 256-0
midword \x00F7 0-256-0
endword \x00F7 0-256
# maalteken ×
begword \x00D7 236-0
midword \x00D7 0-236-0
endword \x00D7 0-236
# §1.5 euroteken € (zonder spatie vóór het getal) [1]
noback joinnum \x20AC 15
# §1.4 dollarteken $ (zonder spatie vóór het getal) [1]
noback joinnum \x0024 145
# §1.16 pondteken £ (zonder spatie vóór het getal) [1]
noback joinnum \x00A3 1234
# §1.24 yenteken ¥ (zonder spatie vóór het getal) [1]
noback joinnum \x00A5 13456
# Eén
context ["E"]"\x00E9" @123456
# ----------------------------------------------------------------------------------------------
# Various
# ----------------------------------------------------------------------------------------------
# Roman page numbers
replace \\_
# §2.11 Herstelteken [1]
# For numbers that are immediately followed by a letter a-j, a sign must be
# inserted for terminating the number.
class digitletter abcdefghij
context $d[]%digitletter @6
context $d"."[]%digitletter @6
context $d","[]%digitletter @6
# §2.12 Hoofdletters [1]
# Capitalisation is implemented using multipass rules because the existing
# opcodes for capitalisation (capsign, begcaps and endcaps) are insufficient.
# Certain characters can appear within an uppercase string without cancelling
# the uppercase "state". These characters are - (HYPHEN MINUS), + (PLUS SIGN), &
# (AMPERSAND), . (FULL STOP) and ' (APOSTROPHE). When using the existing
# opcodes, these characters would cause a new capsign or begcaps to be inserted
# after each appearance in a uppercase string.
class uppersign -+&.' # 2nd class = $x
context $U[]$u @6
context $U%uppersign.[]$u @6
pass2 [@46]$U%uppersign.@46 @45
pass2 [@46]$U%uppersign.@45 @45
pass3 @45$xl.[]@45 @1b # $xl = %uppersign or $l (letter)
pass3 @45$xl.[@46] ?
pass3 @46$U[@6] ?
pass3 @46$U%uppersign.[@6] ?
pass4 [@1b-45] ?
pass4 [@6]@6 ?
# §2.20 Sleutelteken tweede betekenis [1]
# §2.3 Ampersandteken [1]
# When an AMPERSAND appears within a word (e.g. an initialism like AT&T) it must be
# preceded by a "second meaning" sign because its first meaning is LETTER C WITH
# CEDILLA (ç).
# When a PLUS SIGN appears within a word (e.g. 30+'er) it must be preceded by a
# "second meaning" sign because its first meaning is EXCLAMATION MARK.
class plusamp +& # 3th class = $y
class noplusamp -.' # 4th class = $z
pass4 $zl[]%plusamp @5 # $zl = %noplusamp or $l (letter)
pass4 $zl[]%plusamp @5
pass4 [@235a]%plusamp @235-5
pass4 [@12346a]%plusamp @12346-5
pass4 [@235a] @235
pass4 [@12346a] @12346
# ----------------------------------------------------------------------------------------------
# Braille indicator opcodes
# ----------------------------------------------------------------------------------------------
numsign 3456
capsign 46
begcaps 45
# endcaps 6
# ----------------------------------------------------------------------------------------------