diff --git a/source/outputs/implementations/tex.ts b/source/outputs/implementations/tex.ts new file mode 100644 index 0000000..6388b4c --- /dev/null +++ b/source/outputs/implementations/tex.ts @@ -0,0 +1,267 @@ + +/** + */ +class type_output_tex implements type_output +{ + public readonly kind : string = "tex"; + public readonly data : {}; + public constructor(data : {}) {this.data = data;} + + + /** + */ + private static coin( + template : string, + arguments_ : Record + ) : string + { + return lib_plankton.string.coin( + template, + arguments_, + { + "open": "<<", + "close": ">>", + } + ); + } + + + /** + */ + private render_object_internal( + object : type_object, + options : { + level ?: int; + depth ?: int; + } = {} + ) : string + { + options = Object.assign( + { + "level": 0, + "depth": 0, + }, + options + ); + return lib_plankton.call.distinguish( + object, + { + "text": ({"content": content}) => content, + "code": ({"content": content}) => type_output_tex.coin( + "\\( <> \\)", + { + "content": content, + } + ), + "link": ({"target": target, "label": label}) => type_output_tex.coin( + "\\href{<>}{<