Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/apps/interplane-site/native/translate.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / apps / interplane-site / native / translate.om` 780 lines ยท 12019 bytes Raw Blame History 1 note Script-free reader support. Uses the builder arena/output and its existing checked capacities. 2 note No translation, browser code, storage or endpoints. Transform and validate share lexical rules. 3 text trrad "rad:" 4 text trdid "did:" 5 text trzero "" 6 text trno " translate=\"no\"" 7 text trspan "" 8 text trend "" 9 text tren "" 10 text trattr "translate" 11 text trclass "class" 12 text trlang "lang" 13 text trcode "code" 14 text trpre "pre" 15 text trkbd "kbd" 16 text trsamp "samp" 17 text trbrand "brand" 18 text trmono "mono" 19 text trdigest "digest" 20 text trfiles "files" 21 text trtitle "title" 22 text trnov "no" 23 text trerr "translation protection missing or overridden (hash, ID, file, command or code)" 24 text trlayout "translation links need a head, header and footer" 25 text trtxt "index.txt" 26 text trjson "index.json" 27 text trhtml ".html" 28 text trtxext ".txt" 29 text trjsext ".json" 30 text tralt1 "\n" 33 text trhead "" 34 text trhlink "
Read in your language
" 35 text trflink "

Read in your language | Plain text | JSON source

\n" 38 text trj1 "{\"source_url\":\"" 39 text trj2 "\",\"lang\":\"" 40 text trj3 "\",\"text\":\"" 41 text trj4 "\",\"html\":\"" 42 text trj5 "\"}\n" 43 text trcspnm "content-security-policy:" 44 text trscript "script-src" 45 text trnone "'none'" 46 text trcspbad "served response must have script-src 'none' without other script sources or overrides" 47 note trq: attribute value offset/length, depth, protected depth, explicit lang depth, raw depth. 48 global trq ulong 6 49 50 fn trat a ulong e ulong t view uchar * to bool 51 if gt add a len t e 52 ret false 53 end 54 ret mistf a t false 55 end 56 57 fn trname a ulong e ulong to ulong 58 k = a 59 while lt k e bound `9223372036854775807` 60 if not namechar mg k 61 break 62 end 63 k = add k 1 64 end 65 ret k 66 end 67 68 fn trtagend a ulong e ulong to ulong 69 q = uchar 0 70 k = a 71 while lt k e bound `9223372036854775807` 72 c = mg k 73 if ne q 0 74 if eq c q 75 q = 0 76 end 77 else 78 if or eq c 34 eq c 39 79 q = c 80 else 81 if eq c 62 82 ret add k 1 83 end 84 end 85 end 86 k = add k 1 87 end 88 die ermark 89 ret e 90 end 91 92 fn trget a ulong e ulong key view uchar * to bool 93 note Parse attributes, not substrings inside other attribute values. Markup has already been checked. 94 k = a 95 put trq 0 0 96 put trq 1 0 97 while lt k e bound `9223372036854775807` 98 if space mg k 99 k = add k 1 100 continue 101 end 102 s = k 103 k = trname k e 104 if eq s k 105 ret false 106 end 107 hit = mist s sub k s key 108 while lt k e bound `9223372036854775807` 109 if not space mg k 110 break 111 end 112 k = add k 1 113 end 114 if eq mg k 61 115 k = add k 1 116 while space mg k bound `9223372036854775807` 117 k = add k 1 118 end 119 q = mg k 120 k = add k 1 121 v = k 122 while lt k e bound `9223372036854775807` 123 if eq mg k q 124 break 125 end 126 k = add k 1 127 end 128 if hit 129 put trq 0 v 130 put trq 1 sub k v 131 ret true 132 end 133 k = add k 1 134 end 135 end 136 ret false 137 end 138 139 fn trclasses a ulong e ulong to bool 140 if not trget a e trclass 141 ret false 142 end 143 k = get trq 0 144 lim = add k get trq 1 145 while lt k lim bound `9223372036854775807` 146 if space mg k 147 k = add k 1 148 continue 149 end 150 s = k 151 while lt k lim bound `9223372036854775807` 152 if space mg k 153 break 154 end 155 k = add k 1 156 end 157 n = sub k s 158 if or mist s n trbrand mist s n trmono 159 ret true 160 end 161 if or mist s n trdigest mist s n trfiles 162 ret true 163 end 164 end 165 ret false 166 end 167 168 fn trmust a ulong n ulong e ulong to bool 169 z = sub n a 170 if or mist a z trcode mist a z trpre 171 ret true 172 end 173 if or mist a z trkbd mist a z trsamp 174 ret true 175 end 176 ret trclasses n e 177 end 178 179 fn trvoid a ulong n ulong e ulong to bool 180 if eq mg sub e 2 47 181 ret true 182 end 183 z = sub n a 184 if or mist a z vtmeta mist a z vtlink 185 ret true 186 end 187 if or mist a z vtbr mist a z vtimg 188 ret true 189 end 190 if or mist a z vthr mist a z vtwbr 191 ret true 192 end 193 ret or mist a z vtinput or mist a z vtsource mist a z vtcol 194 end 195 196 fn trwc c uchar to bool 197 ret or alnum c or eq c 95 or eq c 45 or eq c 46 or eq c 47 or eq c 64 eq c 58 198 end 199 200 fn trtoken a ulong e ulong to bool 201 note Protect a hex run of 7+ (upper or lower), identifier prefixes, and path/file-like words. 202 k = a 203 hxrun = ulong 0 204 digit = false 205 dot = false 206 while lt k e bound `9223372036854775807` 207 c = mg k 208 if lt hexv c 16 209 hxrun = add hxrun 1 210 if and ge c 48 le c 57 211 digit = true 212 end 213 if and ge hxrun 7 digit 214 ret true 215 end 216 else 217 hxrun = 0 218 digit = false 219 end 220 if or eq c 46 eq c 47 221 dot = true 222 end 223 k = add k 1 224 end 225 if dot 226 ret true 227 end 228 if or trat a e trrad trat a e trdid 229 ret true 230 end 231 if ge sub e a 29 232 if eq mg a 122 233 ret true 234 end 235 end 236 ret false 237 end 238 239 fn trword s ulong k ulong mode ulong to void 240 t = k 241 while gt t s bound `9223372036854775807` 242 c = mg sub t 1 243 if not or eq c 46 or eq c 58 or eq c 45 eq c 47 244 break 245 end 246 t = sub t 1 247 end 248 hit = false 249 if gt t s 250 hit = trtoken s t 251 end 252 if and hit eq get trq 3 0 253 if eq mode 1 254 die trerr 255 end 256 ot trspan 257 om s sub t s 258 ot trend 259 om t sub k t 260 else 261 if eq mode 0 262 om s sub k s 263 end 264 end 265 end 266 267 fn trtext a ulong e ulong mode ulong to void 268 k = a 269 while lt k e bound `9223372036854775807` 270 if not trwc mg k 271 if eq mode 0 272 ob mg k 273 end 274 k = add k 1 275 continue 276 end 277 s = k 278 while lt k e bound `9223372036854775807` 279 if not trwc mg k 280 break 281 end 282 k = add k 1 283 end 284 trword s k mode 285 end 286 end 287 288 fn tropen a ulong n ulong e ulong mode ulong to void 289 must = and trmust a n e eq get trq 3 0 290 has = trget n e trattr 291 no = false 292 if has 293 no = mist get trq 0 get trq 1 trnov 294 if and not no or must ne get trq 3 0 295 die trerr 296 end 297 end 298 if and must not no 299 if eq mode 1 300 die trerr 301 end 302 no = true 303 end 304 if eq mode 0 305 om sub a 1 add sub n a 1 306 if and must not has 307 ot trno 308 end 309 om n sub e n 310 end 311 if trvoid a n e 312 ret 313 end 314 d = add get trq 2 1 315 put trq 2 d 316 if and no eq get trq 3 0 317 put trq 3 d 318 end 319 if and eq get trq 4 0 trget n e trlang 320 put trq 4 d 321 end 322 if mist a sub n a trtitle 323 put trq 5 d 324 end 325 end 326 327 fn trwalk a ulong e ulong mode ulong zh bool to void 328 for j ulong 6 329 put trq j 0 330 end 331 k = a 332 while lt k e bound `9223372036854775807` 333 if eq mg k 60 334 if trat k e tcmo 335 q = mfirst k e tcme 336 if eq q e 337 die ermark 338 end 339 q = add q len tcme 340 if eq mode 0 341 om k sub q k 342 end 343 k = q 344 continue 345 end 346 q = trtagend k e 347 j = add k 1 348 if eq mg j 47 349 d = get trq 2 350 if eq get trq 3 d 351 put trq 3 0 352 end 353 if eq get trq 4 d 354 put trq 4 0 355 end 356 if eq get trq 5 d 357 put trq 5 0 358 end 359 if gt d 0 360 put trq 2 sub d 1 361 end 362 if eq mode 0 363 om k sub q k 364 end 365 else 366 n = trname j q 367 if eq n j 368 if eq mode 0 369 om k sub q k 370 end 371 else 372 tropen j n q mode 373 end 374 end 375 k = q 376 else 377 s = k 378 while lt k e bound `9223372036854775807` 379 if eq mg k 60 380 break 381 end 382 k = add k 1 383 end 384 if ne get trq 5 0 385 if eq mode 0 386 om s sub k s 387 end 388 else 389 trtext s k mode 390 end 391 end 392 end 393 end 394 395 fn trcheck to void 396 note Validation is run on reread output too; a changed manifest does not bypass it. 397 mark = sg TOP 398 n = sg OBN 399 a = stash 400 trwalk a add a n 1 false 401 put st TOP mark 402 put st OBN n 403 end 404 405 fn trurl r ulong suffix view uchar * absolute bool to void 406 b = mul r 8 407 if absolute 408 zurl r 409 else 410 om rg add b 2 rg add b 3 411 end 412 ot suffix 413 end 414 415 fn trlinks r ulong to void 416 a = stash 417 e = add a sg FLEN 418 h = mfirst a e zhead 419 v = mfirst a e trhead 420 f = mlast a e zfoot 421 if or eq h e or eq v e eq f e 422 die trlayout 423 end 424 om a sub h a 425 ot tralt1 426 trurl r trtxt false 427 ot tralt3 428 ot tralt2 429 trurl r trjson false 430 ot tralt3 431 om h sub v h 432 ot trhlink 433 om v sub f v 434 ot trflink 435 trurl r trtxt false 436 ot trtextl 437 trurl r trjson false 438 ot trjsonl 439 om f sub e f 440 end 441 442 fn trpage r ulong to void 443 trlinks r 444 note Run the existing text policy and markup checks first so refused input keeps its diagnostic. 445 polscan true 446 chkmark true 447 a = stash 448 e = add a sg FLEN 449 trwalk a e 0 false 450 end 451 452 fn trjesc a ulong n ulong to void 453 for k ulong n bound `9223372036854775807` 454 c = mg add a k 455 if or eq c 34 eq c 92 456 ob 92 457 ob c 458 else 459 if lt c 32 460 ob 92 461 ob 117 462 ob 48 463 ob 48 464 ob hexc shr ulong c 4 465 ob hexc and ulong c 15 466 else 467 ob c 468 end 469 end 470 end 471 end 472 473 text trmaino "" 475 text trbr "br" 476 text trp "p" 477 text trli "li" 478 text trtd "td" 479 text trdiv "div" 480 text trsect "section" 481 text trrow "tr" 482 text trh1 "h1" 483 text trh2 "h2" 484 text trh3 "h3" 485 text trsvg "svg" 486 text trapos "'" 487 text trnbsp " " 488 text trarr "→" 489 text trldq "“" 490 text trrdq "”" 491 text tromega "Ω" 492 text trmidd "·" 493 text trback "```\n" 494 495 fn trnl to void 496 if gt sg OBN 0 497 if ne og sub sg OBN 1 10 498 ob 10 499 end 500 end 501 end 502 503 fn trentity k ulong e ulong to ulong 504 if trat k e hamp 505 ob 38 506 ret add k len hamp 507 end 508 if trat k e hlt 509 ob 60 510 ret add k len hlt 511 end 512 if trat k e hgt 513 ob 62 514 ret add k len hgt 515 end 516 if trat k e hquot 517 ob 34 518 ret add k len hquot 519 end 520 if trat k e trapos 521 ob 39 522 ret add k len trapos 523 end 524 if trat k e ptrade 525 ot ttm 526 ret add k len ptrade 527 end 528 if trat k e trnbsp 529 ob 32 530 ret add k len trnbsp 531 end 532 if trat k e trarr 533 ob 45 534 ob 62 535 ret add k len trarr 536 end 537 if or trat k e trldq trat k e trrdq 538 ob 34 539 ret add k len trldq 540 end 541 if trat k e tromega 542 ob 206 543 ob 169 544 ret add k len tromega 545 end 546 if trat k e trmidd 547 ob 194 548 ob 183 549 ret add k len trmidd 550 end 551 ob mg k 552 ret add k 1 553 end 554 555 fn trblock a ulong n ulong to bool 556 z = sub n a 557 if or mist a z trp mist a z trli 558 ret true 559 end 560 if or mist a z trdiv mist a z trsect 561 ret true 562 end 563 if or mist a z trrow mist a z trbr 564 ret true 565 end 566 if or mist a z trh1 mist a z trh2 567 ret true 568 end 569 ret mist a z trh3 570 end 571 572 fn trplain a ulong e ulong to void 573 note Text from the same complete HTML; tags do not turn inline words into separate words, but an 574 note element that starts right after a sibling closed is set apart, as a reader sees adjacent links. 575 n = mfirst a e trmaino 576 if eq n e 577 die erhtml 578 end 579 k = trtagend n e 580 lim = mfirst k e trmaine 581 if eq lim e 582 die erhtml 583 end 584 pre = false 585 skip = false 586 sep = false 587 while lt k lim bound `9223372036854775807` 588 if eq mg k 60 589 q = trtagend k lim 590 j = add k 1 591 cl = eq mg j 47 592 if cl 593 j = add j 1 594 end 595 n = trname j q 596 if mist j sub n j trsvg 597 skip = not cl 598 end 599 if mist j sub n j trpre 600 trnl 601 ot trback 602 pre = not cl 603 end 604 if and not skip trblock j n 605 trnl 606 sep = false 607 else 608 if and and sep not cl not skip 609 if gt sg OBN 0 610 if not space og sub sg OBN 1 611 ob 32 612 end 613 end 614 sep = false 615 end 616 if and cl not skip 617 sep = true 618 end 619 end 620 if mist j sub n j trtd 621 ob 9 622 end 623 k = q 624 else 625 if skip 626 k = add k 1 627 else 628 if eq mg k 38 629 sep = false 630 k = trentity k lim 631 else 632 c = mg k 633 if and not pre space c 634 if gt sg OBN 0 635 if not space og sub sg OBN 1 636 ob 32 637 end 638 end 639 else 640 sep = false 641 ob c 642 end 643 k = add k 1 644 end 645 end 646 end 647 end 648 trnl 649 end 650 651 fn trwrite r ulong suffix view uchar * to void 652 b = mul r 8 653 pbroot rg add b 1 654 pbaddm rg add b 2 rg add b 3 655 pbadd suffix 656 wrfile rg add b 1 657 end 658 659 fn trforms r ulong to void 660 note HTML already passed policy checks; derivative bytes are checked by exact manifest replay. 661 a = stash 662 n = sg FLEN 663 trplain a add a n 664 trwrite r trtxt 665 p = stash 666 pn = sg FLEN 667 ot trj1 668 trurl r trzero true 669 ot trj2 670 ot zen 671 ot trj3 672 trjesc p pn 673 ot trj4 674 trjesc a n 675 ot trj5 676 trwrite r trjson 677 end 678 679 fn trformpath s ulong e ulong to bool 680 if ge sub e s len trtxt 681 if mist sub e len trtxt len trtxt trtxt 682 ret true 683 end 684 end 685 if ge sub e s len trjson 686 if mist sub e len trjson len trjson trjson 687 ret true 688 end 689 end 690 ret false 691 end 692 693 fn trcli to void 694 n = argread 2 pb 0 len pb 695 if le n 0 696 die erarg 697 end 698 put st PBL ulong n 699 put st TOP 0 700 a = slurp 701 sz = sg FLEN 702 put st OBN 0 703 om a sz 704 put st CXO a 705 put st CXL 0 706 chkmark true 707 trcheck 708 end 709 710 fn trheaders to void 711 n = argread 2 pb 0 len pb 712 if le n 0 713 die erarg 714 end 715 put st PBL ulong n 716 put st TOP 0 717 a = slurp 718 lim = add a sg FLEN 719 found = false 720 k = a 721 while lt k lim bound `9223372036854775807` 722 e = eol k lim 723 if trat k e trcspnm 724 p = add k len trcspnm 725 while lt p e bound `9223372036854775807` 726 while lt p e bound `9223372036854775807` 727 if not or space mg p eq mg p 59 728 break 729 end 730 p = add p 1 731 end 732 s = p 733 while lt p e bound `9223372036854775807` 734 if or space mg p eq mg p 59 735 break 736 end 737 p = add p 1 738 end 739 is = mist s sub p s trscript 740 if and trat s p trscript not is 741 die trcspbad 742 end 743 if is 744 while lt p e bound `9223372036854775807` 745 if not space mg p 746 break 747 end 748 p = add p 1 749 end 750 if not trat p e trnone 751 die trcspbad 752 end 753 p = add p len trnone 754 while lt p e bound `9223372036854775807` 755 if not space mg p 756 break 757 end 758 p = add p 1 759 end 760 if lt p e 761 if ne mg p 59 762 die trcspbad 763 end 764 end 765 found = true 766 end 767 while lt p e bound `9223372034775807` 768 if eq mg p 59 769 break 770 end 771 p = add p 1 772 end 773 end 774 end 775 k = add e 1 776 end 777 if not found 778 die trcspbad 779 end 780 end