#
#  Copyright (C) 2010-2011 by DocArch <http://www.docarch.be>
#  Copyright (C) 2014-2015 by Bert Frees
#  Copyright (C) 2014 by CBB <http://www.cbb.nl>
#  Copyright (C) 2015, 2016 by Dedicon <http://www.dedicon.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 based on the braille standard of 2005
#
#     Created by Bert Frees <bertfrees@gmail.com>
#     Modified by Henri Apperloo <h.apperloo@cbb.nl>
#     Modified by Davy Kager <DavyKager@dedicon.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/braille-specs/master/Belgium/Eindtekst-zonder-voorblad-dec-2005.doc][1]
#
# ----------------------------------------------------------------------------------------------

include nl-chardefs.uti
include braille-patterns.cti

hyphen    \x002D  36

# §3.1 Het cijferteken [1]

midnum    \x002C  2    # COMMA
midnum    \x002E  256  # FULL STOP
midnum    \x003A  25   # COLON

# §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
noback context ["E"]"\x00E9"  @123456

# §3.6 Graad-, minuut- en secondeteken [1]
noback context $d["''"] @4-35-35
noback context $d["'"] @4-35

# 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    # 1st class = $w
noback context     $d[]%digitletter       @6
noback context     $d","[]%digitletter    @6
noback context     $d"."[]%digitletter    @6
noback context     $d":"[]%digitletter    @6
# Multiple dots 6 are collapsed into a single dot 6.
noback pass2       [@6]@6                 ?
noback pass3       $d[@6]@456             ?

# §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                     +&     # 2nd class = $x
class    noplusamp                   -.'    # 3rd class = $y
noback pass4    %noplusamp[]%plusamp        @5
noback pass4    $l[]%plusamp                @5
noback pass4    [@235a]%plusamp             @235-5
noback pass4    [@12346a]%plusamp           @12346-5
noback pass4    [@235a]                     @235
noback pass4    [@12346a]                   @12346

numsign  3456

# §1.58 Drukwijzigingsteken [1]
emphclass italic
emphclass underline
emphclass bold

lenemphphrase italic 4
begemphword italic 456
endemphword italic 6
begemphphrase italic 456-456
endemphphrase italic before 456
emphletter italic 456

lenemphphrase bold 4
begemphword bold 456
endemphword bold 6
begemphphrase bold 456-456
endemphphrase bold before 456
emphletter bold 456

lenemphphrase underline 4
begemphword underline 456
endemphword underline 6
begemphphrase underline 456-456
endemphphrase underline before 456
emphletter underline 456

# §2.12 Hoofdletters [1]

# 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).
capsmodechars -+&.'
# The same goes for the emphasis "state". This is not yet supported.
# See: https://github.com/liblouis/liblouis/issues/116
#emphmodechars -+&.'

lencapsphrase 4
begcapsword 45
endcapsword 6
begcapsphrase 45-45
endcapsphrase before 45
capsletter 46
