Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,23 @@
let () =
let buf = Buffer.create 1 in
let s = Buffer.add_string buf in
Random.self_init();
s "<table>";
s "<thead align='right'>";
s "<tr><th></th>";
List.iter (fun v ->
s ("<td>" ^ v ^ "</td>")
) ["X"; "Y"; "Z"];
s "</tr>";
s "</thead>";
s "<tbody align='right'>";
for i = 0 to pred 3 do
s ("<tr><td>" ^ string_of_int i ^ "</td>");
for j = 0 to pred 3 do
s ("<td>" ^ string_of_int (Random.int 1000) ^ "</td>");
done;
s "</tr>";
done;
s "</tbody>";
s "</table>";
print_endline (Buffer.contents buf)

View file

@ -0,0 +1,39 @@
open XHTML.M_01_01
let _td s = td [pcdata s]
let _th s = th [pcdata s]
let my_table =
table ~a:[a_border 1]
(tr
(_th "") [
(_th "X");
(_th "Y");
(_th "Z")]
)
[
(tr
(_td "1") [
(_td "aa");
(_td "bb");
(_td "cc")]
);
(tr
(_td "2") [
(_td "dd");
(_td "ee");
(_td "ff")]
);
]
let my_page =
html
(head (title (pcdata "My Page")) [])
(body
[ h1 [pcdata "My Table"];
my_table;
]
)
let () =
pretty_print ~width:80 print_string my_page

View file

@ -0,0 +1,25 @@
#use "topfind"
#require "tyxml"
module X = Xhtml.M_01_01 (* XHTML 1.1 *)
module P = Xhtml.P_01_01
let make_table () =
let td1 = X.td [X.pcdata "1"] in
let td2 = X.td [X.pcdata "2"] in
let td3 = X.td [X.pcdata "3"] in
let my_tr = X.tr td1 [td2; td3] in
let my_table = X.table my_tr [] in
(my_table)
let () =
let my_title = X.title (X.pcdata "My Page") in
let my_head = X.head my_title [] in
let my_h1 = X.h1 [X.pcdata "My Table"] in
let my_table = make_table () in
let my_body = X.body [my_h1; my_table] in
let my_html = X.html my_head my_body in
P.print print_endline my_html;
;;

View file

@ -0,0 +1,11 @@
let make_table () =
let br = X.a_border 1 in
let th s = X.th [X.pcdata s] in
let td s = X.td [X.pcdata s] in
let my_thead = X.thead (X.tr (th "") [th "X"; th "Y"; th "Z"]) [] in
let my_tr1 = X.tr (td "1") [td "AAA"; td "BBB"; td "CCC"] in
let my_tr2 = X.tr (td "2") [td "DDD"; td "EEE"; td "FFF"] in
let my_tr3 = X.tr (td "3") [td "GGG"; td "HHH"; td "III"] in
let my_tbody = X.tbody my_tr1 [my_tr2; my_tr3] in
let my_table = X.tablex ~thead:my_thead ~a:[br] my_tbody [] in
(my_table)