# liblouis: Norwegian literary braille, 6-dot, uncontracted
#
#-name: Norsk litterær punktskrift, 6-punkt, fullskrift
#-index-name: Norwegian, uncontracted, 6-dot
#-display-name: Norwegian 6-dot uncontracted braille
#
#+language:no
#+language:nb
#+language:nn
#+type:literary
#+direction:both
#+contraction:no
#+dots:6
#+grade:0
#
#  Copyright (C) 2005 ViewPlus Technologies, Inc. www.viewplus.com
#  Copyright (C) 2009-2023 Lars Bjørndal <lars@lamasti.net>
#  Copyright (C) 2015-2018 NLB Norwegian library of talking books and braille, http://www.nlb.no/
#
#-copyright: 2005, ViewPlus Technologies, Inc. www.viewplus.com
#-copyright: 2009-2019, Lars Bjørndal
#-copyright: 2015-2018, Norwegian library of talking books and braille (NLB), http://www.nlb.no/
#-license: LGPLv2.1
#
# Created June 9, 2005 by Leon Ungier <Leon.Ungier@ViewPlus.com> with
# help and guidance from Lars Bjørndal <lars@lamasti.net>
# Updated June 2009 by Lars Bjørndal <lars@lamasti.net>
# Updated April 2015 by Jostein Austvik Jacobsen <jostein@nlb.com> and Ammar Usama <ammar.usama@nlb.no>
#
#-author: Leon Ungier <Leon.Ungier@ViewPlus.com>
#-author: Lars Bjørndal <lars@lamasti.net>
#-author: Jostein Austvik Jacobsen <jostein@nlb.no>
#-author: Ammar Usama <ammar.usama@nlb.no>
#
# Official norwegian braille specifications are collected here:
# http://liblouis.io/braille-specs/norwegian
# This specific table is based on the document "Håndbok i litterær punktskrift".
#
# Input is expected to be normalized to NFC (fully composed)
#-unicode-form:nfc
#
#  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/>.
#

include no-no.dis
include no-no-chardefs6.uti
include litdigits6Dots.uti
include braille-patterns.cti # unicode braille

# comp6 definitions
comp6 A 6-1
comp6 B 6-12
comp6 C 6-14
comp6 D 6-145
comp6 E 6-15
comp6 F 6-124
comp6 G 6-1245
comp6 H 6-125
comp6 I 6-24
comp6 J 6-245
comp6 K 6-13
comp6 L 6-123
comp6 M 6-134
comp6 N 6-1345
comp6 O 6-135
comp6 P 6-1234
comp6 Q 6-12345
comp6 R 6-1235
comp6 S 6-234
comp6 T 6-2345
comp6 U 6-136
comp6 V 6-1236
comp6 W 6-2456
comp6 X 6-1346
comp6 Y 6-13456
comp6 Z 6-1356
comp6 Æ 6-345
comp6 Ø 6-246
comp6 Å 6-16

#lowword \x2013 36-36         # make double when surrounded by white spaces
#lowword - 36-36              # make double when hyphen surrounded by white spaces

numsign 3456
capsletter 6                    # single capital letter indicator
begcapsword 6-6                  # a block of consecutive capital letters indicator
noback endcapsword 56                   # TODO
begcapsphrase 6-6-6
lencapsphrase 2
endcapsphrase after 6


emphclass italic
emphclass underline
emphclass bold

begemph italic 23
begemph bold 6-3
begemph underline 456

noback endemph italic 56
endemph bold 6-3
endemph underline 456

midnum , 2
midnum . 3
midnum + 235
midnum - 36-36-3456
midnum / 34-3456
midnum : 25
midnum = 2356

# endnum # 56-3456
noback always # 3456
endnum a 56-1
endnum b 56-12
endnum c 56-14
endnum d 56-145
endnum e 56-15
endnum f 56-124
endnum g 56-1245
endnum h 56-125
endnum i 56-24
endnum j 56-245

repeated ... 3-3-3           # points de suite
repeated --- 36-36-36
repeated ___ 456-456-456

# always \s--\s 36-36        # tiret
noback always ;\s; 0


# We have to redefine the letter æ here to prevent back translation of it to result in a space

lowercase \x00E6 345          # æ 00E6
base uppercase \x00C6 \x00E6  # æ x00C6 / 00E6

# URLs
nocont ://
nocont www.
nocont .com
nocont .edu
nocont .gov
nocont .mil
nocont .net
nocont .org
nocont .no
nocont .nu
nocont .se
nocont .dk
nocont .fi
nocont .ini
nocont .doc
nocont .docx
nocont .xml
nocont .xsl
nocont .htm
nocont .html
nocont .tex
nocont .txt
nocont .gif
nocont .jpg
nocont .png
nocont .wav
nocont .mp3
nocont .m3u
nocont .tar
nocont .gz
nocont .bz2
nocont .zip

# Fix input where less than / greater than already are surrounding the
# URL / email address.
noback pass2 @126-246-3 @126
noback pass2 @135-2-345 @345
noback pass2 @3456-3456 @3456-6-3456
noback pass2 @5-356-0-6-14 @5-356-6-14
noback pass2 @5-356-0-6-124 @5-356-6-124
noback pass2 @5-356-0-6-13 @5-356-6-13

# subscript
# ---------

emphclass sub
emphletter sub 16
begemph sub 16-236
endemph sub 356

digit ₀ 245a
digit ₁ 1a
digit ₂ 12a
digit ₃ 14a
digit ₄ 145a
digit ₅ 15a
digit ₆ 124a
digit ₇ 1245a
digit ₈ 125a
digit ₉ 24a

# ₊ ₋ ₌ ₍ ₎ ₐ ₑ ₒ ₓ ₔ ⱼ ᵢ ᵣ ᵤ ᵥ ᵦ ᵧ ᵨ ᵩ ᵪ

attribute sub ₀₁₂₃₄₅₆₇₈₉

noback pass2 %sub%sub. @16-236*
noback pass2 %sub @16*
noback pass3 %sub%sub. *@356

# fix order of sub sign and number sign
noback pass3 @3456-16-236 @16-236-3456
noback pass3 @3456-16 @16-3456

noback pass4 @245a  @245  # ₀
noback pass4 @1a    @1    # ₁
noback pass4 @12a   @12   # ₂
noback pass4 @14a   @14   # ₃
noback pass4 @145a  @145  # ₄
noback pass4 @15a   @15   # ₅
noback pass4 @124a  @124  # ₆
noback pass4 @1245a @1245 # ₇
noback pass4 @125a  @125  # ₈
noback pass4 @24a   @24   # ₉

# superscript
# -----------

emphclass super
emphletter super 46
begemph super 46-236
endemph super 346

digit ⁰ 245b
digit ¹ 1b
digit ² 12b
digit ³ 14b
digit ⁴ 145b
digit ⁵ 15b
digit ⁶ 124b
digit ⁷ 1245b
digit ⁸ 125b
digit ⁹ 24b

# ⁱ ⁺ ⁻ ⁼ ⁽ ⁾ ⁿ ª º ⱽ ᴮ ᴯ ᴰ ᴱ ᴲ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴻ ᴼ ᴽ ᴾ ᴿ ᵀ ᵁ ᵂ ᵃ ᵄ ᵅ ᵆ ᵇ ᵈ ᵉ ᵊ ᵋ ᵌ ᵍ ᵏ ᵐ ᵑ ᵒ ᵓ ᵖ ᵗ ᵘ ᵚ ᵛ ᵝ ᵞ ᵟ ᵠ ᵡ

attribute super ⁰¹²³⁴⁵⁶⁷⁸⁹

noback pass2 %super%super. @46-236*
noback pass2 %super @46*
noback pass3 %super%super. *@356

# fix order of super sign and number sign
noback pass3 @3456-46-236 @46-236-3456
noback pass3 @3456-46 @46-3456

noback pass4 @245b  @245  # ⁰
noback pass4 @1b    @1    # ¹
noback pass4 @12b   @12   # ²
noback pass4 @14b   @14   # ³
noback pass4 @145b  @145  # ⁴
noback pass4 @15b   @15   # ⁵
noback pass4 @124b  @124  # ⁶
noback pass4 @1245b @1245 # ⁷
noback pass4 @125b  @125  # ⁸
noback pass4 @24b   @24   # ⁹

# 9.6 Percent/promille
noback context [$s]"%" ?
noback context [$s]"‰" ?
noback context "%"[")"] @6-356
noback context "‰"[")"] @6-356

# 11.3 Pound sign
noback joinnum \x00A3 123