UniFormal / MMT

The MMT Language and System
https://uniformal.github.io/
Other
68 stars 23 forks source link

Document usage of MMTSyntaxPresenter #444

Closed ComFreek closed 3 years ago

ComFreek commented 5 years ago

Simple example:

val T: Theory = ...
val renderingHandler: StringBuilder = new StringBuilder()

val presenter = new MMTSyntaxPresenter()
ctrl.extman.addExtension(presenter)
presenter(T)(renderingHandler)

// Do something with the output string in renderingHandler.get

Example 2 (write to console):

import info.kwarc.mmt.api.presentation.ConsoleWriter
presenter(T)(ConsoleWriter)

Also stress the fact that any item it should present must be known to the controller. Otherwise, one gets a "no backend applicable" error. Adding a new theory created on-the-fly (e.g. with my ModuleCreator on the moduleutils branch) to the backend is as simple as

ctrl.add(T)