package rosenbridge import "core:os" import "core:fmt" import "core:strings" css :: ` @import url('https://fonts.googleapis.com/css2?family=Victor+Mono:ital@0;1&display=swap'); * { font-family: 'Victor Mono', monospace; color: white; margin: 0px; } body { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAABlBMVEVeNDRXJS7l3UTlAAAAAnRSTlP//8i138cAAAG4SURBVFiFvVZRssQgCJP7X/rN7ms1IYltpzPLnwghBLUd47Cq8cLqYy/z30Tfzv/GKdvPGlxm+3TVMgnYRKx1AjirFpmpEBlQYELoIUyhwVNITZlzgUHiNq2PbeXYVVieWkUPCg6AelBE1AaLBBnFBxRsCz0yuSkf6bLAobH/9TonAgATQ7YWoCu+zletQBdJdwGLFAIgHyCQAFrPBRssFmp/V/XpRu3thHu+8MLhFa0mqdzYZIDdsT6iuAcom7BiEsIqStuiXuoBUgJF0iZNYYdwJm8AducH1xlAEES1YbbbzduawBvPs/xHpu09BvhFCmU/YfxC3nOM6YHf0NPPI8PyoY4IFsCcX3+GM8B6kmqH0Crw89w3CaGmTD7A0DcBBgCeo0HDkVkFgK4Cl6QKGORlVMRhAC4/OaN7Wz6Wo+4yLDTkAEqt85oAXTE/kgAgkpnq+o7Ppafmqpf9fzD3l1PpC+uOn7nvWXVSbsEVL09SuTEDQAJVd7hPI3TXE2A+Xlhp4ZyECr9h8C0ZKAIVFwAls0hybmQKGwRcxwABaJSPS3VZYWST7SNhn7XJN56L9PvRFuBu5B/jTAaBWUHcggAAAABJRU5ErkJggg=="); background-attachment: fixed; } .page { background-color: black; width: 600px; padding: 25px; min-height: calc(100vh - 50px); margin: auto; } h1, h2, h3 { color: #ffc0a8; font-style:italic; } h2, h3 { margin-top: 5px; margin-bottom: 5px; } h1 { text-align: center; } h2:before { content: "> "; } .bullet { /*color: #cad2ff;*/ color: white; margin-left: 2ch; font-weight: 700; } .bullet:before { content: "• "; } a { color: #ff5c5c; margin-left: 2ch; text-decoration: none; } a:hover { background-color: #ff5c5c; color: black; } a:before { content: "➤ "; } p { margin-left: 2ch; color: #e0e0e0; font-size: small; } pre { color: #ffd381; border: solid 1px; border-radius: 5px; padding: 5px; margin-left: 2ch; max-width: fit-content; overflow-x: auto; font-size: small; line-height: 16px; letter-spacing: -1px; } .quote { color: #ff8181; white-space: pre-wrap; font-style: italic; border-left: 1px solid; margin-left: 4ch; padding-left: 1ch; }` main :: proc() { data, success := os.read_entire_file_from_filename(os.args[1]) if success == false { fmt.eprintln("Error reading file") os.exit(1) } in_string := transmute(string)data // Remove trailing whitespace eof : int = 0 for chr, i in in_string { if ( chr != ' ' && chr != ' ' && chr != '\n' ) { eof = i+1 } } lines := strings.split_lines(in_string[0:eof]) fmt.print("\n\n") defer fmt.print("\n") fmt.printf("
\n\n\n\n", css) fmt.print("") } else { fmt.print("\n") } continue } // Print preform if preform { fmt.printf("%s\n", entity_substitution(line)) continue } // Headings-------------------------- // h1 if line_len >= 2 && line[0:2] == "# " { fmt.printf("
%s
\n", entity_substitution(line[2:])) continue } // Quote----------------------------- if line_len >= 1 && line[0:1] == ">" { fmt.printf("%s
", entity_substitution(line)) } } entity_substitution :: proc(s: string) -> string { amp, _ := strings.replace_all(s, "&", "&") gt, _ := strings.replace_all(amp, ">", ">") lt, _ := strings.replace_all(gt, "<", "<") tab, _ := strings.replace_all(lt, " ", " ") return tab }