src/Pure/GUI/rich_text.scala
author wenzelm
Sun, 10 Nov 2024 11:55:36 +0100
changeset 81416 206dd586f3d7
child 81417 964b85e04f1f
permissions -rw-r--r--
clarified modules;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
81416
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/GUI/rich_text.scala
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     3
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     4
Support for rendering of rich text, based on individual messages (XML.Elem).
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     5
*/
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     6
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     7
package isabelle
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     8
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
     9
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    10
object Rich_Text {
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    11
  def command(
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    12
    body: XML.Body = Nil,
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    13
    id: Document_ID.Command = Document_ID.none,
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    14
    results: Command.Results = Command.Results.empty
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    15
  ): Command = {
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    16
    val source = XML.content(body)
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    17
    val markups = Command.Markups.init(Markup_Tree.from_XML(body))
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    18
    Command.unparsed(source, id = id, results = results, markups = markups)
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    19
  }
206dd586f3d7 clarified modules;
wenzelm
parents:
diff changeset
    20
}