Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1import defineFunction, {ordargument} from "../defineFunction";2import type {TextFont} from "../types/fonts";3import {makeSpan} from "../buildCommon";4 5import * as html from "../buildHTML";6import * as mml from "../buildMathML";7import type Options from "../Options";8import type {ParseNode} from "../parseNode";9 10// Non-mathy text, possibly in a font11const textFontFamilies: Record<string, TextFont | undefined> = {12 "\\text": undefined,13 "\\textrm": "textrm",14 "\\textsf": "textsf",15 "\\texttt": "texttt",16 "\\textnormal": "textrm",17};18 19const textFontWeights: Record<string, "textbf" | "textmd"> = {20 "\\textbf": "textbf",21 "\\textmd": "textmd",22};23 24const textFontShapes: Record<string, "textit" | "textup"> = {25 "\\textit": "textit",26 "\\textup": "textup",27};28 29const optionsWithFont = (group: ParseNode<"text">, options: Options): Options => {30 const font = group.font;31 // Checks if the argument is a font family or a font style.32 if (!font) {33 return options;34 } else if (textFontFamilies[font]) {35 return options.withTextFontFamily(textFontFamilies[font]);36 } else if (textFontWeights[font]) {37 return options.withTextFontWeight(textFontWeights[font]);38 } else if (font === "\\emph") {39 return options.fontShape === "textit" ?40 options.withTextFontShape("textup") :41 options.withTextFontShape("textit");42 }43 44 return options.withTextFontShape(textFontShapes[font] as "textit" | "textup");45};46 47defineFunction({48 type: "text",49 names: [50 // Font families51 "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal",52 // Font weights53 "\\textbf", "\\textmd",54 // Font Shapes55 "\\textit", "\\textup", "\\emph",56 ],57 props: {58 numArgs: 1,59 argTypes: ["text"],60 allowedInArgument: true,61 allowedInText: true,62 },63 handler({parser, funcName}, args) {64 const body = args[0];65 return {66 type: "text",67 mode: parser.mode,68 body: ordargument(body),69 font: funcName,70 };71 },72 htmlBuilder(group, options) {73 const newOptions = optionsWithFont(group, options);74 const inner = html.buildExpression(group.body, newOptions, true);75 return makeSpan(["mord", "text"], inner, newOptions);76 },77 mathmlBuilder(group, options) {78 const newOptions = optionsWithFont(group, options);79 return mml.buildExpressionRow(group.body, newOptions);80 },81});82 