From 102790d53d5c0d09fb3b2b1f7a4583eb3ab90995 Mon Sep 17 00:00:00 2001 From: totoro Date: Fri, 8 Mar 2019 14:08:54 +0900 Subject: [PATCH] add some CoreAttrs according to HTML5 and Anubis specific tooltip --- mail/types/generated/email_address.anubis | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mail/types/generated/email_to_send.anubis | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/CXM_http_get.anubis | 629 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- web/CXM_making_a_web_site.anubis | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------- 4 files changed, 649 insertions(+), 427 deletions(-) create mode 100644 mail/types/generated/email_address.anubis create mode 100644 mail/types/generated/email_to_send.anubis diff --git a/mail/types/generated/email_address.anubis b/mail/types/generated/email_address.anubis new file mode 100644 index 0000000..7425426 --- /dev/null +++ b/mail/types/generated/email_address.anubis @@ -0,0 +1,71 @@ +/* + * Created by 伝作 (Densaku). + * Types & Messages generator written by フランスのトトロ aka (David RENÉ) + * Date: 2018-12-07 + * Time: 00:57:44 + * + */ + +transmit system/muscle.anubis +transmit system/convert.anubis +transmit tools/basis.anubis + + + + +public type Email_Address: + email_address( + String name, + String address + ) +. + + Email_Address message format + ============================ + + +public define Message + to_Message + ( + Email_Address _email_address + )= + with _email_address_message = message((Word32)0), // + forget(add_string(_email_address_message, "__TYPE__", "Email_Address")); + if _email_address is + { + //Alternative email_address + email_address(_name, _address) then + forget(add_string(_email_address_message, "__TYPE_ALT__", "email_address")); + // [type = String] email_address.name + forget(add_string(_email_address_message, "name", _name)); + // [type = String] email_address.address + forget(add_string(_email_address_message, "address", _address)), + + }; + _email_address_message +. + +public define Maybe(Email_Address) + from_Message + ( + Message _email_address_message + )= + if find_string(_email_address_message, "__TYPE__") is {failure then failure, success(__type__) then + if find_string(_email_address_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then + if __type__ = "Email_Address" then + //Alternative email_address + if __type_alt__ = "email_address" then //Alternative email_address + // [type = String] email_address.name + if find_string(_email_address_message, "name") is {failure then failure, success(_name_) then + // [type = String] email_address.address + if find_string(_email_address_message, "address") is {failure then failure, success(_address_) then + + success(email_address(_name_, _address_)) + }} + else + failure //No valid Alternative found ! + else + failure //Type not found in message ! + }} +. + diff --git a/mail/types/generated/email_to_send.anubis b/mail/types/generated/email_to_send.anubis new file mode 100644 index 0000000..6eaa627 --- /dev/null +++ b/mail/types/generated/email_to_send.anubis @@ -0,0 +1,111 @@ +/* + * Created by 伝作 (Densaku). + * Types & Messages generator written by フランスのトトロ aka (David RENÉ) + * Date: 2018-12-07 + * Time: 01:14:06 + * + */ + +transmit system/muscle.anubis +transmit system/convert.anubis +transmit tools/basis.anubis + +transmit calexium_lib/mail/types/generated/email_address.anubis + + + +public type Email_to_send: + data_to_send( + Email_Address from, //email sent from that sender + List(Email_Address) to, //email sent to that list of recipients + List(Email_Address) cc, //email sent as copy to that list of recipients + List(Email_Address) bcc, //email sent as blank carbon copy to that list of recipients + String subject, //subject of email. Supposed to be UTF8 + String content, //content of the email + List(String) files, //list of files + Bool send_copy, //send copy to sender by bcc (useful when the email is sent by an automat) + String reply_to //reply to !! + ) +. + + Email_to_send message format + ============================ + + +public define Message + to_Message + ( + Email_to_send _email_to_send + )= + with _email_to_send_message = message((Word32)0), // + forget(add_string(_email_to_send_message, "__TYPE__", "Email_to_send")); + if _email_to_send is + { + //Alternative data_to_send + data_to_send(_from, __to, __cc, __bcc, _subject, _content, __files, _send_copy, _reply_to) then + forget(add_string(_email_to_send_message, "__TYPE_ALT__", "data_to_send")); + // [type = Email_Address] data_to_send.from + forget(add_message(_email_to_send_message, "from", to_Message(_from))); + // [type = List(Email_Address)] data_to_send.to + map_forget((Email_Address _to) |-> add_message(_email_to_send_message, "to", to_Message(_to)), __to); + // [type = List(Email_Address)] data_to_send.cc + map_forget((Email_Address _cc) |-> add_message(_email_to_send_message, "cc", to_Message(_cc)), __cc); + // [type = List(Email_Address)] data_to_send.bcc + map_forget((Email_Address _bcc) |-> add_message(_email_to_send_message, "bcc", to_Message(_bcc)), __bcc); + // [type = String] data_to_send.subject + forget(add_string(_email_to_send_message, "subject", _subject)); + // [type = String] data_to_send.content + forget(add_string(_email_to_send_message, "content", _content)); + // [type = List(String)] data_to_send.files + map_forget((String _files) |-> add_string(_email_to_send_message, "files", _files), __files); + // [type = Bool] data_to_send.send_copy + forget(add_bool(_email_to_send_message, "send_copy", _send_copy)); + // [type = String] data_to_send.reply_to + forget(add_string(_email_to_send_message, "reply_to", _reply_to)), + + }; + _email_to_send_message +. + +public define Maybe(Email_to_send) + from_Message + ( + Message _email_to_send_message + )= + if find_string(_email_to_send_message, "__TYPE__") is {failure then failure, success(__type__) then + if find_string(_email_to_send_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then + if __type__ = "Email_to_send" then + //Alternative data_to_send + if __type_alt__ = "data_to_send" then //Alternative data_to_send + // [type = Email_Address] data_to_send.from + if find_message(_email_to_send_message, "from") is {failure then failure, success(_from__msg) then + if (Maybe(Email_Address))from_Message(_from__msg) is {failure then failure, success(_from_) then + // [type = List(Email_Address)] data_to_send.to + with mb__to_ = map_escape(( Message msg ) |-> (Maybe(Email_Address)) from_Message(msg), find_messages(_email_to_send_message, "to")), + if mb__to_ is {failure then failure, success(_to_) then + // [type = List(Email_Address)] data_to_send.cc + with mb__cc_ = map_escape(( Message msg ) |-> (Maybe(Email_Address)) from_Message(msg), find_messages(_email_to_send_message, "cc")), + if mb__cc_ is {failure then failure, success(_cc_) then + // [type = List(Email_Address)] data_to_send.bcc + with mb__bcc_ = map_escape(( Message msg ) |-> (Maybe(Email_Address)) from_Message(msg), find_messages(_email_to_send_message, "bcc")), + if mb__bcc_ is {failure then failure, success(_bcc_) then + // [type = String] data_to_send.subject + if find_string(_email_to_send_message, "subject") is {failure then failure, success(_subject_) then + // [type = String] data_to_send.content + if find_string(_email_to_send_message, "content") is {failure then failure, success(_content_) then + // [type = List(String)] data_to_send.files + with _files_ = find_string_list(_email_to_send_message, "files"), + // [type = Bool] data_to_send.send_copy + if find_bool(_email_to_send_message, "send_copy") is {failure then failure, success(_send_copy_) then + // [type = String] data_to_send.reply_to + if find_string(_email_to_send_message, "reply_to") is {failure then failure, success(_reply_to_) then + + success(data_to_send(_from_, _to_, _cc_, _bcc_, _subject_, _content_, _files_, _send_copy_, _reply_to_)) + }}}}}}}}} + else + failure //No valid Alternative found ! + else + failure //Type not found in message ! + }} +. + diff --git a/web/CXM_http_get.anubis b/web/CXM_http_get.anubis index be3e1c9..e9a8fa0 100644 --- a/web/CXM_http_get.anubis +++ b/web/CXM_http_get.anubis @@ -1,311 +1,318 @@ - *Project* The Anubis Project - - *Title* Getting a document from the Web. - - *Copyright* Copyright (c) Alain Prouté 2001. - - - *Author* Alain Prouté - - - - *Overview* - This file defines the function 'http_get' which retrieves a document from the world - wide web (a similar function 'https_get' for secured documents is defined in - 'https_get.anubis'). The function simulates the behavior of a browser, at least just - what is needed to retrieve the document. It does not display the document, but returns - it (if found) in the form of a string. It also returns the response line from the - server, and the list af all HTTP headers. - - The function 'http_get' takes the following arguments: - - - the name of the server to which the request is to be sent, - - the name (including the path) of the document on this server, - - a list of headers to be added to mandatory standard headers, - - a list of 'arguments' in the form of pairs of strings '(name,value)' to be sent as - the body of the request. - - - The result returned by 'http_get' has the following type, which defines the problems - which may happen: - - -read tools/basis.anubis -read system/string.anubis -read web/CXM_common.anubis -read web/CXM_http_get_common.anubis - - -public type HTTP_GET_Result: - cannot_resolve_server_name(DNS_Result), - cannot_connect_to_server(NetworkConnectError), - transmission_problem, - request_refused_by_server, - ok(String response, // HTTP response line from the server - List(HTTP_header) headers, // HTTP headers received from the server - String document). // The HTML document itself - - -public define HTTP_GET_Result - http_get - ( //-------- example: ----------------------- - String server_name, // "www.machin.com" - String document_name, // "/truc/bidule.html" - List(HTTP_header) headers, // [http_header("Cookie","..."),...] - List(HTTP_argument) arguments // [http_argument("ga","bu"),...] - ). - - The same one without the 'headers' argument: - -public define HTTP_GET_Result - http_get - ( //-------- example: ----------------------- - String server_name, // "www.machin.com" - String document_name, // "/truc/bidule.html" - List(HTTP_argument) arguments // [http_argument("ga","bu"),...] - ) = http_get(server_name,document_name,[],arguments). - - - - This file also defines the command 'http_get' to be used directly from the system - prompt. To learn about the syntax, just type 'http_get' at the system prompt, or have - a look at the end of this file - - --- That's all for public definitions. ------------------------------------------------ - - - - We need two functions for sending and receiving bytes. - -define Maybe(One) - send - ( - RWStream conn, // where to send the text - String text, // the text to be sent - Word32 n // start sending at character number 'n' in 'text' - ) = - if nth(to_Int(n),text) is - { - failure then success(unique), - success(c) then - if conn <- c is - { - failure then failure, - success(_) then send(conn,text,n+1) - } - }. - -define Maybe(String) - receive_text_chunk - ( - RWStream conn, - List(Word8) so_far, - Word32 count - ) = - if count = 100 - then success(implode(reverse(so_far))) - else if *conn is // *conn waits for data to be readable from connection - { - failure then success(implode(reverse(so_far))), // means 'connection closed by peer' - success(c) then receive_text_chunk(conn,[c . so_far],count+1) - }. - - -define HTTP_GET_Result - receive - ( - RWStream conn, - String headers, - String text_so_far, - Bool double_crlf_seen - ) = - if receive_text_chunk(conn,[],0) is - { - failure then if separate_headers(headers) is - { - [ ] then ok("",[],text_so_far), - [h . t] then if h is http_header(a,b) then ok(a,t,text_so_far) - }, - - success(s) then - if s = "" - then if separate_headers(headers) is - { - [ ] then ok("",[],text_so_far), - [h . t] then if h is http_header(a,b) then ok(a,t,text_so_far) - } - else with new_s = text_so_far+s, - if double_crlf_seen - then receive(conn,headers,new_s,true) - else if has_double_crlf(new_s) is - { - failure then receive(conn,headers,new_s,false), - success(n) then - if sub_string(new_s,n+4,length(new_s)-n-4) is - { - failure then alert, - success(s1) then - if sub_string(new_s,0,n) is - { - failure then alert, - success(h) then receive(conn,h,s1,true) - } - } - } - }. - - - - The next function has a valid TCP/IP connection to the server, and tries to retrieve - the document. - - -define HTTP_GET_Result - http_get - ( - Bool print_all, - RWStream conn, - String server_name, - String document_name, - List(HTTP_header) headers, - List(HTTP_argument) arguments, - ) = - // - // Send the HTTP request, and receive the answer: - // - with body = format_http_args(arguments), - with request = (if arguments = [] then "GET " else "POST ") - + document_name + " HTTP/1.0" + crlf + - "Host: " + server_name + crlf + - "Accept-Charset: iso-8859-1,*,utf-8" + crlf + - (if arguments = [] then "" - else "Content-type: application/x-www-form-urlencoded" + crlf + - "Content-length: " + to_decimal(length(body))+ crlf) + - format_headers(headers) + - crlf + - body, - (if print_all then - ( - print("----- request ----\n"); - print(request); - print("\n") - ) else unique); - if send(conn,request,0) is - { - failure then transmission_problem, - success(_) then receive(conn,"","",false) - }. - - - The next function retrieves the document using the numerical (resolved) server address. - -define HTTP_GET_Result - http_get - ( - Bool print_all, - Word32 server_addr, - Word32 server_port, - String server_name, - String document_name, - List(HTTP_header) headers, - List(HTTP_argument) arguments, - ) = - // - // try to connect to the server before sending the request - // - if (Result(NetworkConnectError,RWStream))connect(server_addr,server_port) is - { - error(e) then cannot_connect_to_server(e), - ok(conn) then http_get(print_all,conn,server_name,document_name,headers,arguments) - }. - - -define HTTP_GET_Result - http_get - ( - Bool print_all, - String server_name, - String document_name, - List(HTTP_header) headers, - List(HTTP_argument) arguments, - ) = - if separate_name_port(server_name,80) is (name,port) then - // - // resolve server name and call 'http_get' with numeric server address: - // - with a = dns(name), - if a is ok(addr) - then http_get(print_all,addr,port,name,document_name,headers,arguments) - else cannot_resolve_server_name(a). - - - Now, here is our public tool: - -define HTTP_GET_Result - http_get - ( - String server_name, - String document_name, - List(HTTP_header) headers, - List(HTTP_argument) arguments, - ) = http_get(false,server_name,document_name,headers,arguments). - - - - Finally, we construct the executable module 'http_get': - -define One - recall_syntax = - print("\nUsage: http_get [options] =
... - ...\n"); - print(" Options are:\n"); - print(" -print_all print request, response line, headers and document\n"); - print(" (default is to print only the document)\n"). - - - - -global define One - http_get - ( - List(String) args - ) = - if args is - { - [ ] then recall_syntax, - [server . t] then if t is - { - [ ] then recall_syntax, - [document . rest] then - with print_all = member(rest,"-print_all"), - headers = get_headers(rest), - arguments = get_arguments(rest), - if http_get(print_all,server,document,headers,arguments) is - { - cannot_resolve_server_name(dns_error) then - print("Cannot resolve server name: " + format(dns_error) + ".\n"), - - cannot_connect_to_server(connect_error) then - print("Cannot connect to server: " + format(connect_error) + ".\n"), - - transmission_problem then - print("Transmission problem.\n"), - - request_refused_by_server then - print("The request has been refused by server: " + server + ".\n"), - - ok(response,headers1,document1) then - ( - if print_all - then ( - print("\n----- response ----\n"); - print(response); - print("\n----- headers -----\n"); - print_headers(headers1); - print("----- document ----\n") - ) else unique - ); - print(document1) // on the screen (use a redirection to get it in a file) - } - } - }. - + *Project* The Anubis Project + + *Title* Getting a document from the Web. + + *Copyright* Copyright (c) Alain Prouté 2001. + + + *Author* Alain Prouté + + + + *Overview* + This file defines the function 'http_get' which retrieves a document from the world + wide web (a similar function 'https_get' for secured documents is defined in + 'https_get.anubis'). The function simulates the behavior of a browser, at least just + what is needed to retrieve the document. It does not display the document, but returns + it (if found) in the form of a string. It also returns the response line from the + server, and the list af all HTTP headers. + + The function 'http_get' takes the following arguments: + + - the name of the server to which the request is to be sent, + - the name (including the path) of the document on this server, + - a list of headers to be added to mandatory standard headers, + - a list of 'arguments' in the form of pairs of strings '(name,value)' to be sent as + the body of the request. + + + The result returned by 'http_get' has the following type, which defines the problems + which may happen: + + +read tools/basis.anubis +read system/string.anubis +transmit calexium_lib/web/CXM_common.anubis +transmit calexium_lib/web/CXM_http_get_common.anubis + + +public type HTTP_GET_Result: + cannot_resolve_server_name(DNS_Result), + cannot_connect_to_server(NetworkConnectError), + transmission_problem, + request_refused_by_server, + ok(String response, // HTTP response line from the server + List(HTTP_header) headers, // HTTP headers received from the server + String document). // The HTML document itself + + +public define HTTP_GET_Result + http_get + ( //-------- example: ----------------------- + String server_name, // "www.machin.com" + String document_name, // "/truc/bidule.html" + List(HTTP_header) headers, // [http_header("Cookie","..."),...] + List(HTTP_argument) arguments // [http_argument("ga","bu"),...] + ). + + The same one without the 'headers' argument: + +public define HTTP_GET_Result + http_get + ( //-------- example: ----------------------- + String server_name, // "www.machin.com" + String document_name, // "/truc/bidule.html" + List(HTTP_argument) arguments // [http_argument("ga","bu"),...] + ) = http_get(server_name,document_name,[],arguments). + + + + This file also defines the command 'http_get' to be used directly from the system + prompt. To learn about the syntax, just type 'http_get' at the system prompt, or have + a look at the end of this file + + --- That's all for public definitions. ------------------------------------------------ + + + + We need two functions for sending and receiving bytes. + +define Maybe(One) + send + ( + RWStream conn, // where to send the text + String text, // the text to be sent + Word32 n // start sending at character number 'n' in 'text' + ) = + if nth(to_Int(n),text) is + { + failure then success(unique), + success(c) then + if conn <- c is + { + failure then failure, + success(_) then send(conn,text,n+1) + } + }. + +define Maybe(String) + receive_text_chunk + ( + RWStream conn, + List(Word8) so_far, + Word32 count + ) = + if count = 1000 then + success(implode(reverse(so_far))) + else if *conn is // *conn waits for data to be readable from connection + { + failure then success(implode(reverse(so_far))), // means 'connection closed by peer' + success(c) then + receive_text_chunk(conn, [c . so_far], count+1) + }. + + +define HTTP_GET_Result + receive + ( + RWStream conn, + String headers, + String text_so_far, + Bool double_crlf_seen + ) = + if receive_text_chunk(conn,[],0) is + { + failure then if separate_headers(headers) is + { + [ ] then ok("",[],text_so_far), + [h . t] then if h is http_header(a,b) then ok(a,t,text_so_far) + }, + + success(s) then + if s = "" then + if separate_headers(headers) is + { + [ ] then ok("",[],text_so_far), + [h . t] then if h is http_header(a,b) then ok(a,t,text_so_far) + } + else + with new_s = text_so_far+s, + if double_crlf_seen then + with len = length(s), + println("content received : "+len+" bytes"); + receive(conn, headers, new_s, true) + else if has_double_crlf(new_s) is + { + failure then + receive(conn, headers, new_s, false), + success(n) then + //extract the begin of data + if sub_string(new_s,n+4,length(new_s)-n-4) is + { + failure then alert, + success(s1) then + //extract end of the header + if sub_string(new_s, 0, n) is + { + failure then alert, + success(h) then receive(conn, h, s1, true) + } + } + } + }. + + + + The next function has a valid TCP/IP connection to the server, and tries to retrieve + the document. + + +define HTTP_GET_Result + http_get + ( + Bool print_all, + RWStream conn, + String server_name, + String document_name, + List(HTTP_header) headers, + List(HTTP_argument) arguments, + ) = + // + // Send the HTTP request, and receive the answer: + // + with body = format_http_args(arguments), + with request = (if arguments = [] then "GET " else "POST ") + + document_name + " HTTP/1.1" + crlf + + "Host: " + server_name + crlf + + "Accept-Charset: iso-8859-1,*,utf-8" + crlf + + (if arguments = [] then "" + else "Content-type: application/x-www-form-urlencoded" + crlf + + "Content-length: " + to_decimal(length(body))+ crlf) + + format_headers(headers) + + crlf + + body, + (if print_all then + ( + print("----- request ----\n"); + print(request); + print("\n") + ) else unique); + if send(conn,request,0) is + { + failure then transmission_problem, + success(_) then receive(conn,"","",false) + }. + + + The next function retrieves the document using the numerical (resolved) server address. + +define HTTP_GET_Result + http_get + ( + Bool print_all, + Word32 server_addr, + Word32 server_port, + String server_name, + String document_name, + List(HTTP_header) headers, + List(HTTP_argument) arguments, + ) = + // + // try to connect to the server before sending the request + // + if (Result(NetworkConnectError,RWStream))connect(server_addr,server_port) is + { + error(e) then cannot_connect_to_server(e), + ok(conn) then http_get(print_all,conn,server_name,document_name,headers,arguments) + }. + + +public define HTTP_GET_Result + http_get + ( + Bool print_all, + String server_name, + String document_name, + List(HTTP_header) headers, + List(HTTP_argument) arguments, + ) = + if separate_name_port(server_name,80) is (name,port) then + // + // resolve server name and call 'http_get' with numeric server address: + // + with a = dns(name), + if a is ok(addr) + then http_get(print_all,addr,port,name,document_name,headers,arguments) + else cannot_resolve_server_name(a). + + + Now, here is our public tool: + +public define HTTP_GET_Result + http_get + ( + String server_name, + String document_name, + List(HTTP_header) headers, + List(HTTP_argument) arguments, + ) = http_get(false,server_name,document_name,headers,arguments). + + + + Finally, we construct the executable module 'http_get': + +define One + recall_syntax = + print("\nUsage: http_get [options] =
... - ...\n"); + print(" Options are:\n"); + print(" -print_all print request, response line, headers and document\n"); + print(" (default is to print only the document)\n"). + + + + + global define One + http_get + ( + List(String) args + ) = + if args is + { + [ ] then recall_syntax, + [server . t] then if t is + { + [ ] then recall_syntax, + [document . rest] then + with print_all = member(rest,"-print_all"), + headers = get_headers(rest), + arguments = get_arguments(rest), + if http_get(print_all,server,document,headers,arguments) is + { + cannot_resolve_server_name(dns_error) then + print("Cannot resolve server name: " + format(dns_error) + ".\n"), + + cannot_connect_to_server(connect_error) then + print("Cannot connect to server: " + format(connect_error) + ".\n"), + + transmission_problem then + print("Transmission problem.\n"), + + request_refused_by_server then + print("The request has been refused by server: " + server + ".\n"), + + ok(response,headers1,document1) then + ( + if print_all + then ( + print("\n----- response ----\n"); + print(response); + print("\n----- headers -----\n"); + print_headers(headers1); + print("----- document ----\n") + ) else unique + ); + print(document1) // on the screen (use a redirection to get it in a file) + } + } + }. + diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 576062c..5f5dae5 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -1002,6 +1002,33 @@ public define Printable_tree [WebArgName x . Printable_tree y] = str_pt(x.name public define Printable_tree [WebArgValue x . Printable_tree y] = str_pt(x.value, y). public define Printable_tree [InitialValue x . Printable_tree y] = str_pt(x.value, y). +public type HTML_tooltip: + html_tooltip + ( + String title, + String keyword, + Int width, + ), + html_tooltip_ext + ( + String title, + String extend_type, + String class_suffix, + List((String, String)) ext_args + ), + html_tooltip_ext //same without class suffix. This means we use awesome font + ( + String title, + String extend_type, + List((String, String)) ext_args + ), + html_tooltip + ( + String title, + WEB_Action_Name wan, + List((String, String)) ext_args + ). + public type HtmlEvents: // Window Event Attributes @@ -1087,18 +1114,31 @@ public type HtmlEvents: public type CoreAttrs: empty, - id (String), - class (String), - style (String), - title (String), - lang (String), - dir (Reading_Way), - accesskey (Word8), - tabindex (Int), - attr (String, String), - event (HtmlEvents, String), + id (String), //A unique identifier for the element. + //There must not be multiple elements in a document that have the same id value. + class (String), //A name of a classification, or list of names of classifications, to which the element belongs + style (String), //Specifies zero or more CSS declarations that apply to the element [CSS]. + title (String), //Advisory information associated with the element. + lang (String), //Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text. + dir (Reading_Way), //Specifies the element’s text directionality. + accesskey (Word8), //A key label or list of key labels with which to associate the element; each key label represents + //a keyboard shortcut which UAs can use to activate the element or give focus to the element. + tabindex (Int), //Specifies whether the element represents an element that is is focusable (that is, an element which is part of the + //sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable + //elements in the document. + //Anubis specific + attr (String, String), //intended to provide unknown attritute + event (HtmlEvents, String), + tooltip (HTML_tooltip), + //HTML5 - data (String name, String value). + data (String name, String value), + contenteditable(Bool), //Specifies whether the contents of the element are editable + contextmenu(String), //Identifies a menu with which to associate the element as a context menu. + draggable(Bool), //Specifies whether the element is draggable. + hidden(Bool), //Specifies that the element represents an element that is not yet, or is no longer, relevant. + spellcheck(Bool) //Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking. +. public define CoreAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). @@ -1577,32 +1617,6 @@ public define HTML_Head_Tag -public type HTML_tooltip: - html_tooltip - ( - String title, - String keyword, - Int width, - ), - html_tooltip_ext - ( - String title, - String extend_type, - String class_suffix, - List((String, String)) ext_args - ), - html_tooltip_ext //same without class suffix. This means we use awesome font - ( - String title, - String extend_type, - List((String, String)) ext_args - ), - html_tooltip - ( - String title, - WEB_Action_Name wan, - List((String, String)) ext_args - ). public define HTML_tooltip @@ -4801,6 +4815,8 @@ define String current + format_attrs(t, classes, styles) }. +public define List(CoreAttrs) extract_attributes(HTML_tooltip htt). + define String format_attrs ( @@ -4814,41 +4830,60 @@ define String (if length(classes) = 0 then "" else " class=\""+join(" ",classes)+"\"")+ if length(styles) = 0 then "" else " style=\""+join(";",styles)+"\"", [h . t] then - with new_classes = if h is class(class_name) then [class_name. classes] else classes, - new_styles = if h is style(style_string) then [style_string . styles] else styles, - current = if h is - { - empty then "", - id(id_name) then - " id=\"" + id_name + "\"", - class(class_name) then "", //do nothing here, because we accumulate the class until we have some other attributes - style(style_string) then "", //do nothing here, because we accumulate the style until we have some other attributes - title(title_string) then - " title=\"" + title_string + "\"", - - lang(lang) then - " xml:lang=" + lang, - dir(reading_Way) then - if reading_Way is - { - ltr then " dir=ltr", - rtl then " dir=rtl" - }, - - accesskey(key) then - " accesskey=\"" + key + "\"", - tabindex(index) then - " tabindex=\"" + index + "\"", - - attr(name, value) then - " " + name + "=\"" + value + "\"", - - event(e, value) then - " " + event_name(e) + "=\"" + value + "\"", - data(name, value) then - " data-" + to_lower(name) + "=\"" + value + "\"", - }, - current + format_attrs(t, new_classes, new_styles) + with new_classes = if h is class(class_name) then [class_name. classes] else classes, + new_styles = if h is style(style_string) then [style_string . styles] else styles, + new_attrs = if h is tooltip(tt) then extract_attributes(tt) else [], + + current = if h is + { + empty then "", + id(id_name) then + " id=\"" + id_name + "\"", + class(class_name) then "", //do nothing here, because we accumulate the class until we have some other attributes + style(style_string) then "", //do nothing here, because we accumulate the style until we have some other attributes + title(title_string) then + " title=\"" + title_string + "\"", + + lang(lang) then + " xml:lang=" + lang, + dir(reading_Way) then + if reading_Way is + { + ltr then " dir=ltr", + rtl then " dir=rtl" + }, + + accesskey(key) then + " accesskey=\"" + key + "\"", + tabindex(index) then + " tabindex=\"" + index + "\"", + + attr(name, value) then + " " + name + "=\"" + value + "\"", + + event(e, value) then + " " + event_name(e) + "=\"" + value + "\"", + tooltip(_) then "", //do nothing here, because we extract attributes at first in new_attrs + data(name, value) then + " data-" + to_lower(name) + "=\"" + value + "\"", + + contenteditable(value)then //boolean value + " contenteditable=\""+ to_String(value)+ "\"" + + contextmenu(id_name) then //ID value + " contextmenu=\"" + id_name + "\"", + + draggable(value) then //boolean value + " draggable=\""+ to_String(value)+ "\"" + + hidden(value) then //boolean value + " hidden=\""+ (if value then "hidden" else "") + "\"" + + spellcheck(value) then //boolean value + " spellcheck=\""+ to_String(value)+ "\"" + + }, + current + format_attrs(t + new_attrs, new_classes, new_styles) }. define String @@ -4878,50 +4913,13 @@ define String (if length(core_attrs) = 0 then "" else format_attrs(core_attrs)) . -//define String -// _format -// ( -// List(CoreAttrs) opt -// )= -// if opt is -// { -// [] then "", -// [h .t] then -// with current = if h is -// { -// id(id_name) then -// " id=\"" + id_name + "\"", -// class(class_name) then -// " class=\"" + class_name + "\"", -// style(style_string) then -// " style=\"" + style_string + "\"", -// -// title(title_string) then -// " title=\"" + title_string + "\"", -// lang(lang) then -// " xml:lang=" + lang, -// dir(reading_Way) then -// if reading_Way is -// { -// ltr then " dir=ltr", -// rtl then " dir=rtl" -// }, -// attr(name, value) then -// " " + name + "=\"" + value + "\"", -// event(e, value) then -// " " + event_name(e) + "=\"" + value + "\"" -// }, -// current + _format(t) -// } -// . - define Printable_tree format_div_option ( List(CoreAttrs) options )= - [""] . - + [""] +. define Maybe(String) extract_id @@ -4930,11 +4928,12 @@ define Maybe(String) ) = if attrbs is { - [] then failure, + [] then failure, [h . t] then if h is id(value) then success(value) else extract_id(t) - }. + } +. define Maybe(String) extract_id @@ -5774,6 +5773,39 @@ define Printable_tree // [""] // }. +public define List(CoreAttrs) + extract_attributes + ( + HTML_tooltip tooltip + )= + if tooltip is + { + html_tooltip(title, keyword, width) then //TODO + [] + //[" 0 then ["&width=",width,"\""] else ["\""]), ">"], + + html_tooltip_ext(title, extend_type, class_suffix, ext_args) then //TODO + [] + //with extra_args = format_extra_operands(ext_args), + //[""] + + html_tooltip_ext(title, extend_type, ext_args) then //TODO + [] + //with extra_args = format_extra_operands(ext_args), + //[""], + + html_tooltip(title, web_action, extra_args) then + [ id("jTip"), class("jTipu"), data("name", title), data("href", "/"+format_web_action_name(web_action, extra_args)) + ] + + //[""], + + } +. + + literal_pt([""]), + + public define Printable_tree format ( @@ -5794,7 +5826,8 @@ public define Printable_tree html_tooltip(title, web_action, extra_args) then [""], - }. + } +. public define HTML_Off_Form html_tooltip @@ -5805,9 +5838,9 @@ public define HTML_Off_Form HTML_Off_Form html_element, )= sequence([ - literal_pt([""]), + literal_pt([""]), html_element, - literal_pt([""]) + literal_pt([""]) ]) . -- libgit2 0.21.4