summaryrefslogtreecommitdiff
path: root/src/GF/Text/LatinASupplement.hs
blob: f42423c9112cf78ca6d9fe203ca1953c446fb0f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
----------------------------------------------------------------------
-- |
-- Module      : LatinASupplement
-- Maintainer  : (Maintainer)
-- Stability   : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/04/21 16:23:39 $ 
-- > CVS $Author: bringert $
-- > CVS $Revision: 1.5 $
--
-- (Description of the module)
-----------------------------------------------------------------------------

module GF.Text.LatinASupplement (mkLatinASupplement) where

mkLatinASupplement :: String -> String
mkLatinASupplement = mkLatinASupplementWord

mkLatinASupplementWord :: String -> String
mkLatinASupplementWord str = case str of
  [] -> []
  '<' : cs -> '<' : spoolMarkup cs
  -- Romanian & partly Turkish
  's' : ',' : cs -> toEnum 0x015f : mkLatinASupplementWord cs
  'a' : '%' : cs -> toEnum 0x0103 : mkLatinASupplementWord cs
  -- Slavic and more
  'c' : '^' : cs -> toEnum 0x010d : mkLatinASupplementWord cs
  's' : '^' : cs -> toEnum 0x0161 : mkLatinASupplementWord cs
  'c' : '\'' : cs -> toEnum 0x0107 : mkLatinASupplementWord cs
  'z' : '^' : cs -> toEnum 0x017e : mkLatinASupplementWord cs
  -- Turkish
  'g' : '%' : cs -> toEnum 0x011f : mkLatinASupplementWord cs
  'I' : cs -> toEnum 0x0131 : mkLatinASupplementWord cs
  'c' : ',' : cs -> toEnum 0x00e7 : mkLatinASupplementWord cs
  -- Polish
  'e' : ',' : cs -> toEnum 0x0119 : mkLatinASupplementWord cs
  'a' : ',' : cs -> toEnum 0x0105 : mkLatinASupplementWord cs
  'l' : '/' : cs -> toEnum 0x0142 : mkLatinASupplementWord cs
  'z' : '.' : cs -> toEnum 0x017c : mkLatinASupplementWord cs
  'n' : '\'' : cs -> toEnum 0x0144 : mkLatinASupplementWord cs
  's' : '\'' : cs -> toEnum 0x015b : mkLatinASupplementWord cs
-- 'c' : '\'' : cs -> toEnum 0x0107 : mkLatinASupplementWord cs

  -- Hungarian 
  'o' : '%' : cs -> toEnum 0x0151 : mkLatinASupplementWord cs
  'u' : '%' : cs -> toEnum 0x0171 : mkLatinASupplementWord cs

  -- Mongolian
  'j' : '^' : cs -> toEnum 0x0135 : mkLatinASupplementWord cs

  -- Khowar (actually in Combining diacritical marks not Latin-A Suppl.)
  'o' : '.' : cs -> 'o' : (toEnum 0x0323 : mkLatinASupplementWord cs)

  -- Length bars over vowels e.g korean
  'a' : ':' : cs -> toEnum 0x0101 : mkLatinASupplementWord cs
  'e' : ':' : cs -> toEnum 0x0113 : mkLatinASupplementWord cs
  'i' : ':' : cs -> toEnum 0x012b : mkLatinASupplementWord cs
  'o' : ':' : cs -> toEnum 0x014d : mkLatinASupplementWord cs
  'u' : ':' : cs -> toEnum 0x016b : mkLatinASupplementWord cs

  -- Default 
  c : cs -> c : mkLatinASupplementWord cs

spoolMarkup :: String -> String
spoolMarkup s = case s of
   [] -> [] -- Shouldn't happen
   '>' : cs -> '>' : mkLatinASupplementWord cs
   c1 : cs -> c1 : spoolMarkup cs