#var lib_ui_beautify[META] { {NAME} {美化插件} {DESC} {美化你的 TinTin++,对齐你的表格。} {AUTHOR} {担子炮} }; #func {lib_ui_beautify.Init} { #class data/lib/ui/beautify open; #var beautify-switch {OFF}; #var beautify-eol-mark {.}; #class data/lib/ui/beautify close; beautify.On; #return true; }; #var beautify-table { {┌|┎|╭|╓|└|┖|╰|╙} {─} {─|┬|┭|┰|┱|╥} {─} {├|┞|┟|┠|╟} {─} {┼|╁|╀|╂|┽|╃|╅|╉|╫} {─} {┴|┵|┸|┹|╨} {─} {┏|┍|┗|┕} {━} {━|┳|┲|┯|┮} {━} {┣|┢|┡|┝} {━} {╋|╇|╈|┿|╊|╆|╄|┾} {━} {┻|┺|┷|┶} {━} {╔|╦|╠|╬|╚|╩|═|╒|╤|╞|╪|╘|╧} {═} {│|┃|║|┆|┇|┊|┋|┤|┨|┫|╣|╢|╡|▕} {left-align} {┐|┓|┒|╮|╗|┘|┛|┚|╯|╝|╲|╱|∕} {left-align} {■|‖|▉|▊|▋|▌|▍|▎|▏|◢|◣|◥|◤|▓} {left-align} {▁|▂|▃|▄|▅|▆|▇|█|▀|▔|┄|┅|┈|┉|—|ˉ} {double} {▼|▲|△|▽|□|◇|◆|☆|★} {left-align} {•|◎|⊙|☉|○|●|Θ|⊕|Ο} {left-align} {·|∶|∴|∷|˙|¨} {left-align} {≤|≧|≥|≮|≯|∨|∧|≌|╳|×} {left-align} {↙|↘|↗|↖|←|↑|→|↓} {left-align} {※|Ψ|Ж|ξ|ф|∩|⊥|♀|∞|≈|√|⌒|Ω|¤|ō||ψ|ζ|∽} {left-align} {①|②|③|④|⑤|⑥|⑦|⑧|⑨|⑩} {left-align} {“|‘} {right-align} {”|’|…} {left-align} {⭕️|🐎|🌊|🔥|🎭|🐀|🔅} {left-align} }; #alias {beautify.On} { #class beautify-sub kill; #class beautify-sub open; #local charset {}; #foreach {*{beautify-table[]}} {charset} { #local type {${beautify-table[$charset]}}; #switch {"$type"} { #case {"double"} {#substitute {{$charset}} {%%1%%1}}; #case {"left-align"} {#substitute {{$charset}} {%%1 }}; #case {"right-align"} {#substitute {{$charset}} { %%1}}; #default {#line sub var #substitute {{$charset}} {%%1$type}}; }; }; #substitute {%S%!s{https?://[[:graph:]]+}\s*{\S|$}} {%%1 %%2 %%3}; #nop 行尾空格因为肉眼不可见因此常常导致无法匹配触发。这里把它可视化一下。; #action {~^%*%+1S%+1..s%c{|ID=beautify}$} { #line ignore #showme {@Beautify{{%%1%%2%%3}}$beautify-eol-mark}; #line gag; } {9.999}; #class beautify-sub close; #var beautify-switch {ON}; okLog 宽字符美化已启用。; warnLog 出于美化需要,接下来你在屏幕上看到的内容可能和服务器实际传送的内容不一致。; warnLog 这可能会给编写触发带来困扰,此时你可以通过快捷键或者 beautify.Off 暂时禁用美化。; prompt.Set {{beautify}{<129>已启用}}; prompt.refresh; }; #alias {beautify.Off} { #class beautify-sub kill; #var beautify-switch {OFF}; warnLog 宽字符美化已禁用。你可以通过快捷键或者 beautify.On 重新启用。; prompt.Set {{beautify}{<119>已禁用}}; prompt.refresh; }; #func {Beautify} { #local text {%1}; #if { "${beautify-switch}" != "ON" } { #return {$text}; }; #local charset {}; #foreach {*{beautify-table[]}} {charset} { #local type {${beautify-table[$charset]}}; #switch {"$type"} { #case {"double"} {#replace {text} {{$charset}} {&1&1}}; #case {"left-align"} {#replace {text} {{$charset}} {&1 }}; #case {"right-align"} {#replace {text} {{$charset}} { &1}}; #default {#line sub var #replace {text} {{$charset}} {&1$type}}; }; }; #return {$text}; }; #alias {beautify.SetEolMark} { #local mark {%1}; #if { "$mark" == "" } { #local mark {.}; }; #var beautify-eol-mark {$mark}; }; #alias {beautify.ToggleSwitch} { #if { "${beautify-switch}" == "ON" } { beautify.Off; }; #else { beautify.On; }; };