-
Notifications
You must be signed in to change notification settings - Fork 3
/
otaigime.eliom
54 lines (45 loc) · 1.6 KB
/
otaigime.eliom
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
{shared{
open Eliom_lib
open Eliom_content
}}
module Otaigime_app =
Eliom_registration.App (
struct
let application_name = "otaigime"
end)
let main_service =
Eliom_service.App.service ~path:[] ~get_params:Eliom_parameter.unit ()
let main_p =
let open Html5.D in
p ~a:[a_class ["plop"];to_attrib (Xml.string_attrib "contenteditable" "true")] [pcdata "ceci est un debut de texte"]
let zhuyin_service =
Eliom_registration.String.register_service
~path:["lookup";"zhuyin"]
~get_params:(Eliom_parameter.suffix (Eliom_parameter.string "input"))
(fun input () -> Lwt.return ((TaigIME.format_list (TaigIME.request_zhuyin input)), "text/plain"))
let zhuyin_fuzzy_service =
let open Eliom_parameter in
Eliom_registration.String.register_service
~path:["lookup";"fuzzy";"zhuyin"]
~get_params:(suffix (int "n" ** string "input"))
(fun (n,input) () -> Lwt.return ((TaigIME.format_list (TaigIME.request_zhuyin ~n input)), "text/plain"))
let trs_service =
Eliom_registration.String.register_service
~path:["lookup";"trs"]
~get_params:(Eliom_parameter.suffix (Eliom_parameter.string "input"))
(fun input () -> Lwt.return ((TaigIME.format_list (TaigIME.request_trs input)), "text/plain"))
let () =
Otaigime_app.register
~service:main_service
(fun () () ->
{unit{
ignore (Client.onload %main_p %Server.bus)
}};
Lwt.return
(Eliom_tools.F.html
~title:"otaigime"
~css:[["css";"otaigime.css"]]
Html5.F.(body [
h2 [pcdata "Welcome from Eliom's destillery!"];
main_p
])))