| author | wenzelm | 
| Wed, 16 Oct 2024 21:41:05 +0200 | |
| changeset 81177 | 137ea3d464be | 
| parent 81121 | 7cacedbddba7 | 
| child 81294 | 108284c8cbfd | 
| permissions | -rw-r--r-- | 
| 36683 | 1 | /* Title: Pure/General/pretty.scala | 
| 2 | Author: Makarius | |
| 3 | ||
| 36687 | 4 | Generic pretty printing module. | 
| 36683 | 5 | */ | 
| 6 | ||
| 7 | package isabelle | |
| 8 | ||
| 71601 | 9 | import scala.annotation.tailrec | 
| 10 | ||
| 36683 | 11 | |
| 75393 | 12 | object Pretty {
 | 
| 61871 | 13 | /* XML constructors */ | 
| 14 | ||
| 61874 | 15 | val space: XML.Body = List(XML.Text(Symbol.space)) | 
| 16 | def spaces(n: Int): XML.Body = | |
| 17 | if (n == 0) Nil | |
| 18 | else if (n == 1) space | |
| 19 | else List(XML.Text(Symbol.spaces(n))) | |
| 48704 
85a3de10567d
tuned signature -- make Pretty less dependent on Symbol;
 wenzelm parents: 
45666diff
changeset | 20 | |
| 80940 | 21 | val bullet: XML.Body = XML.elem(Markup.BULLET, space) :: space | 
| 22 | ||
| 81121 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 23 | def block(body: XML.Body, | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 24 | open_block: Boolean = false, | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 25 | consistent: Boolean = false, | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 26 | indent: Int = 2 | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 27 |   ): XML.Tree = {
 | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 28 | val markup = Markup.Block(open_block = open_block, consistent = consistent, indent = indent) | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 29 | XML.Elem(markup, body) | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 30 | } | 
| 48704 
85a3de10567d
tuned signature -- make Pretty less dependent on Symbol;
 wenzelm parents: 
45666diff
changeset | 31 | |
| 61871 | 32 | def brk(width: Int, indent: Int = 0): XML.Tree = | 
| 81120 | 33 | XML.Elem(Markup.Break(width = width, indent = indent), spaces(width)) | 
| 61871 | 34 | |
| 69867 | 35 | val fbrk: XML.Tree = XML.newline | 
| 65130 | 36 | def fbreaks(ts: List[XML.Tree]): XML.Body = Library.separate(fbrk, ts) | 
| 61871 | 37 | |
| 38 | val Separator: XML.Body = List(XML.elem(Markup.SEPARATOR, space), fbrk) | |
| 75958 | 39 | def separate(ts: List[XML.Tree], sep: XML.Body = Separator): XML.Body = | 
| 40 | Library.separate(sep, ts.map(List(_))).flatten | |
| 41 | ||
| 42 |   val comma: XML.Body = List(XML.Text(","), brk(1))
 | |
| 43 | def commas(ts: List[XML.Tree]): XML.Body = separate(ts, sep = comma) | |
| 44 | ||
| 45 | def `enum`(ts: List[XML.Tree], | |
| 46 |     bg: String = "(",
 | |
| 47 | en: String = ")", | |
| 48 | sep: XML.Body = comma, | |
| 49 | indent: Int = 2 | |
| 50 | ): XML.Tree = Pretty.block(XML.enclose(bg, en, separate(ts, sep = sep)), indent = indent) | |
| 61864 | 51 | |
| 48704 
85a3de10567d
tuned signature -- make Pretty less dependent on Symbol;
 wenzelm parents: 
45666diff
changeset | 52 | |
| 51492 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 53 | /* text metric -- standardized to width of space */ | 
| 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 54 | |
| 75393 | 55 |   abstract class Metric {
 | 
| 51492 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 56 | val unit: Double | 
| 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 57 | def apply(s: String): Double | 
| 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 58 | } | 
| 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 59 | |
| 75393 | 60 |   object Default_Metric extends Metric {
 | 
| 51492 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 61 | val unit = 1.0 | 
| 80806 | 62 | def apply(s: String): Double = Codepoint.length(s).toDouble | 
| 51492 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 63 | } | 
| 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 64 | |
| 
eaa1c4cc1106
more explicit Pretty.Metric, with clear distinction of unit (space width) vs. average char width (for visual adjustments) -- NB: Pretty formatting works via full space characters (despite a981a5c8a505 and 70f7483df9cb);
 wenzelm parents: 
51470diff
changeset | 65 | |
| 36687 | 66 | /* markup trees with physical blocks and breaks */ | 
| 67 | ||
| 62820 | 68 | private def force_nat(i: Int): Int = i max 0 | 
| 69 | ||
| 61874 | 70 |   private sealed abstract class Tree { def length: Double }
 | 
| 71 | private case class Block( | |
| 80800 | 72 | markup: Markup, | 
| 73 | markup_body: Option[XML.Body], | |
| 81121 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 74 | open_block: Boolean, | 
| 80798 | 75 | consistent: Boolean, | 
| 76 | indent: Int, | |
| 77 | body: List[Tree], | |
| 78 | length: Double | |
| 79 | ) extends Tree | |
| 75393 | 80 |   private case class Break(force: Boolean, width: Int, indent: Int) extends Tree {
 | 
| 81 | def length: Double = width.toDouble | |
| 82 | } | |
| 61874 | 83 | private case class Str(string: String, length: Double) extends Tree | 
| 36683 | 84 | |
| 61874 | 85 | private val FBreak = Break(true, 1, 0) | 
| 36683 | 86 | |
| 80940 | 87 | private def make_block(body: List[Tree], | 
| 88 | markup: Markup = Markup.Empty, | |
| 89 | markup_body: Option[XML.Body] = None, | |
| 81121 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 90 | open_block: Boolean = false, | 
| 80940 | 91 | consistent: Boolean = false, | 
| 92 | indent: Int = 0 | |
| 75393 | 93 |   ): Tree = {
 | 
| 62785 
70b9c7d4ed7f
more robust pretty printing: permissive treatment of bad values;
 wenzelm parents: 
61883diff
changeset | 94 | val indent1 = force_nat(indent) | 
| 
70b9c7d4ed7f
more robust pretty printing: permissive treatment of bad values;
 wenzelm parents: 
61883diff
changeset | 95 | |
| 75393 | 96 |     @tailrec def body_length(prts: List[Tree], len: Double): Double = {
 | 
| 61883 
c0f34fe6aa61
clarified length of block with pre-existant forced breaks;
 wenzelm parents: 
61875diff
changeset | 97 | val (line, rest) = | 
| 
c0f34fe6aa61
clarified length of block with pre-existant forced breaks;
 wenzelm parents: 
61875diff
changeset | 98 |         Library.take_prefix[Tree]({ case Break(true, _, _) => false case _ => true }, prts)
 | 
| 73359 | 99 |       val len1 = (line.foldLeft(0.0) { case (l, t) => l + t.length }) max len
 | 
| 71781 | 100 |       (rest: @unchecked) match {
 | 
| 61883 
c0f34fe6aa61
clarified length of block with pre-existant forced breaks;
 wenzelm parents: 
61875diff
changeset | 101 | case Break(true, _, ind) :: rest1 => | 
| 62785 
70b9c7d4ed7f
more robust pretty printing: permissive treatment of bad values;
 wenzelm parents: 
61883diff
changeset | 102 | body_length(Break(false, indent1 + ind, 0) :: rest1, len1) | 
| 61883 
c0f34fe6aa61
clarified length of block with pre-existant forced breaks;
 wenzelm parents: 
61875diff
changeset | 103 | case Nil => len1 | 
| 
c0f34fe6aa61
clarified length of block with pre-existant forced breaks;
 wenzelm parents: 
61875diff
changeset | 104 | } | 
| 
c0f34fe6aa61
clarified length of block with pre-existant forced breaks;
 wenzelm parents: 
61875diff
changeset | 105 | } | 
| 81121 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 106 | Block(markup, markup_body, open_block, consistent, indent1, body, body_length(body, 0.0)) | 
| 61883 
c0f34fe6aa61
clarified length of block with pre-existant forced breaks;
 wenzelm parents: 
61875diff
changeset | 107 | } | 
| 36683 | 108 | |
| 61874 | 109 | |
| 80845 | 110 | /* no formatting */ | 
| 76086 
338adf8d423c
support Pretty.unformatted, similar to ML version;
 wenzelm parents: 
75958diff
changeset | 111 | |
| 80871 | 112 | def output_content(pure: Boolean, output: XML.Body): String = | 
| 113 | XML.content(if (pure) Protocol_Message.clean_output(output) else output) | |
| 114 | ||
| 80807 | 115 | def unbreakable(input: XML.Body): XML.Body = | 
| 76086 
338adf8d423c
support Pretty.unformatted, similar to ML version;
 wenzelm parents: 
75958diff
changeset | 116 |     input flatMap {
 | 
| 
338adf8d423c
support Pretty.unformatted, similar to ML version;
 wenzelm parents: 
75958diff
changeset | 117 | case XML.Wrapped_Elem(markup, body1, body2) => | 
| 80807 | 118 | List(XML.Wrapped_Elem(markup, body1, unbreakable(body2))) | 
| 119 | case XML.Elem(Markup.Break(width, _), _) => spaces(width) | |
| 120 | case XML.Elem(markup, body) => List(XML.Elem(markup, unbreakable(body))) | |
| 76086 
338adf8d423c
support Pretty.unformatted, similar to ML version;
 wenzelm parents: 
75958diff
changeset | 121 | case XML.Text(text) => XML.string(split_lines(text).mkString(Symbol.space)) | 
| 
338adf8d423c
support Pretty.unformatted, similar to ML version;
 wenzelm parents: 
75958diff
changeset | 122 | } | 
| 80807 | 123 | |
| 80871 | 124 | def unformatted_string_of(input: XML.Body, pure: Boolean = false): String = | 
| 125 | output_content(pure, unbreakable(input)) | |
| 76086 
338adf8d423c
support Pretty.unformatted, similar to ML version;
 wenzelm parents: 
75958diff
changeset | 126 | |
| 
338adf8d423c
support Pretty.unformatted, similar to ML version;
 wenzelm parents: 
75958diff
changeset | 127 | |
| 80845 | 128 | /* formatting */ | 
| 61874 | 129 | |
| 75393 | 130 |   private sealed case class Text(tx: XML.Body = Nil, pos: Double = 0.0, nl: Int = 0) {
 | 
| 61874 | 131 | def newline: Text = copy(tx = fbrk :: tx, pos = 0.0, nl = nl + 1) | 
| 132 | def string(s: String, len: Double): Text = | |
| 133 | copy(tx = if (s == "") tx else XML.Text(s) :: tx, pos = pos + len) | |
| 134 | def blanks(wd: Int): Text = string(Symbol.spaces(wd), wd.toDouble) | |
| 135 | def content: XML.Body = tx.reverse | |
| 136 | } | |
| 137 | ||
| 138 | private def break_dist(trees: List[Tree], after: Double): Double = | |
| 139 |     trees match {
 | |
| 140 | case (_: Break) :: _ => 0.0 | |
| 141 | case t :: ts => t.length + break_dist(ts, after) | |
| 142 | case Nil => after | |
| 36689 
379f5b1e7f91
replaced slightly odd fbreak markup by plain "\n", which also coincides with regular linebreaks produced outside the ML pretty engine;
 wenzelm parents: 
36687diff
changeset | 143 | } | 
| 
379f5b1e7f91
replaced slightly odd fbreak markup by plain "\n", which also coincides with regular linebreaks produced outside the ML pretty engine;
 wenzelm parents: 
36687diff
changeset | 144 | |
| 61874 | 145 | private def force_break(tree: Tree): Tree = | 
| 146 |     tree match { case Break(false, wd, ind) => Break(true, wd, ind) case _ => tree }
 | |
| 71601 | 147 | private def force_all(trees: List[Tree]): List[Tree] = trees.map(force_break) | 
| 51570 
3633828d80fc
basic support for Pretty.item, which is considered as logical markup and interpreted in Isabelle/Scala, but ignored elsewhere (TTY, latex etc.);
 wenzelm parents: 
51569diff
changeset | 148 | |
| 61874 | 149 | private def force_next(trees: List[Tree]): List[Tree] = | 
| 150 |     trees match {
 | |
| 151 | case Nil => Nil | |
| 152 | case (t: Break) :: ts => force_break(t) :: ts | |
| 153 | case t :: ts => t :: force_next(ts) | |
| 154 | } | |
| 51570 
3633828d80fc
basic support for Pretty.item, which is considered as logical markup and interpreted in Isabelle/Scala, but ignored elsewhere (TTY, latex etc.);
 wenzelm parents: 
51569diff
changeset | 155 | |
| 71601 | 156 | val default_margin: Double = 76.0 | 
| 157 | val default_breakgain: Double = default_margin / 20 | |
| 36820 | 158 | |
| 67547 
aefe7a7b330a
clarified breakgain: keeping it constant avoids margin fluctuation in Pretty_Tooltip vs. Pretty_Text_Area;
 wenzelm parents: 
65130diff
changeset | 159 | def formatted(input: XML.Body, | 
| 67896 | 160 | margin: Double = default_margin, | 
| 161 | breakgain: Double = default_breakgain, | |
| 75393 | 162 | metric: Metric = Default_Metric | 
| 163 |   ): XML.Body = {
 | |
| 51569 
4e084727faae
maintain integer indentation during formatting -- it needs to be implemented by repeated spaces eventually;
 wenzelm parents: 
51568diff
changeset | 164 | val emergencypos = (margin / 2).round.toInt | 
| 36687 | 165 | |
| 61874 | 166 | def make_tree(inp: XML.Body): List[Tree] = | 
| 167 |       inp flatMap {
 | |
| 168 | case XML.Wrapped_Elem(markup, body1, body2) => | |
| 80940 | 169 | List(make_block(make_tree(body2), markup = markup, markup_body = Some(body1))) | 
| 61874 | 170 | case XML.Elem(markup, body) => | 
| 171 |           markup match {
 | |
| 81121 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 172 | case Markup.Block(open_block, consistent, indent) => | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 173 | List( | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 174 | make_block(make_tree(body), | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 175 | open_block = open_block, consistent = consistent, indent = indent)) | 
| 61874 | 176 | case Markup.Break(width, indent) => | 
| 62785 
70b9c7d4ed7f
more robust pretty printing: permissive treatment of bad values;
 wenzelm parents: 
61883diff
changeset | 177 | List(Break(false, force_nat(width), force_nat(indent))) | 
| 61874 | 178 | case Markup(Markup.ITEM, _) => | 
| 80941 
fd7a70babec1
more markup <expression kind="item"> in Isabelle/Scala, with pro-forma Markup_Kind.setup in Isabelle/ML;
 wenzelm parents: 
80940diff
changeset | 179 | List(make_block(make_tree(bullet ::: body), | 
| 
fd7a70babec1
more markup <expression kind="item"> in Isabelle/Scala, with pro-forma Markup_Kind.setup in Isabelle/ML;
 wenzelm parents: 
80940diff
changeset | 180 | markup = Markup.Expression.item, indent = 2)) | 
| 61874 | 181 | case _ => | 
| 81121 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 182 | List(make_block(make_tree(body), markup = markup, open_block = true)) | 
| 61874 | 183 | } | 
| 184 | case XML.Text(text) => | |
| 185 | Library.separate(FBreak, split_lines(text).map(s => Str(s, metric(s)))) | |
| 36817 
ed97e877ff2d
more precise pretty printing based on actual font metrics;
 wenzelm parents: 
36763diff
changeset | 186 | } | 
| 
ed97e877ff2d
more precise pretty printing based on actual font metrics;
 wenzelm parents: 
36763diff
changeset | 187 | |
| 61871 | 188 | def format(trees: List[Tree], blockin: Int, after: Double, text: Text): Text = | 
| 36687 | 189 |       trees match {
 | 
| 190 | case Nil => text | |
| 191 | ||
| 81121 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 192 | case (block: Block) :: ts if block.open_block => | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 193 | val btext = format(block.body, blockin, break_dist(ts, after), text.copy(tx = Nil)) | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 194 | val ts1 = if (text.nl < btext.nl) force_next(ts) else ts | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 195 | val btext1 = btext.copy(tx = XML.Elem(block.markup, btext.content) :: text.tx) | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 196 | format(ts1, blockin, after, btext1) | 
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 197 | |
| 
7cacedbddba7
support for pretty blocks that are "open" and thus have no impact on formatting, only on markup;
 wenzelm parents: 
81120diff
changeset | 198 | case Block(markup, markup_body, _, consistent, indent, body, blen) :: ts => | 
| 51569 
4e084727faae
maintain integer indentation during formatting -- it needs to be implemented by repeated spaces eventually;
 wenzelm parents: 
51568diff
changeset | 199 | val pos1 = (text.pos + indent).ceil.toInt | 
| 36687 | 200 | val pos2 = pos1 % emergencypos | 
| 61868 | 201 | val blockin1 = if (pos1 < emergencypos) pos1 else pos2 | 
| 61864 | 202 | val d = break_dist(ts, after) | 
| 203 | val body1 = if (consistent && text.pos + blen > margin - d) force_all(body) else body | |
| 61871 | 204 | val btext = | 
| 80800 | 205 | if (markup.is_empty && markup_body.isEmpty) format(body1, blockin1, d, text) | 
| 206 |             else {
 | |
| 207 | val btext0 = format(body1, blockin1, d, text.copy(tx = Nil)) | |
| 208 | val elem = | |
| 209 |                 markup_body match {
 | |
| 210 | case None => XML.Elem(markup, btext0.content) | |
| 211 | case Some(body1) => XML.Wrapped_Elem(markup, body1, btext0.content) | |
| 212 | } | |
| 213 | btext0.copy(tx = elem :: text.tx) | |
| 61871 | 214 | } | 
| 61864 | 215 | val ts1 = if (text.nl < btext.nl) force_next(ts) else ts | 
| 36687 | 216 | format(ts1, blockin, after, btext) | 
| 217 | ||
| 61871 | 218 | case Break(force, wd, ind) :: ts => | 
| 219 | if (!force && | |
| 220 | text.pos + wd <= ((margin - break_dist(ts, after)) max (blockin + breakgain))) | |
| 36687 | 221 | format(ts, blockin, after, text.blanks(wd)) | 
| 61862 
e2a9e46ac0fb
support pretty break indent, like underlying ML systems;
 wenzelm parents: 
55551diff
changeset | 222 | else format(ts, blockin, after, text.newline.blanks(blockin + ind)) | 
| 36687 | 223 | |
| 61871 | 224 | case Str(s, len) :: ts => format(ts, blockin, after, text.string(s, len)) | 
| 36687 | 225 | } | 
| 61874 | 226 | format(make_tree(input), 0, 0.0, Text()).content | 
| 36687 | 227 | } | 
| 36734 
d9b10c173330
Pretty.formatted operates directly on XML trees, treating XML.Elem like a pro-forma block of indentation 0, like the ML version;
 wenzelm parents: 
36689diff
changeset | 228 | |
| 67547 
aefe7a7b330a
clarified breakgain: keeping it constant avoids margin fluctuation in Pretty_Tooltip vs. Pretty_Text_Area;
 wenzelm parents: 
65130diff
changeset | 229 | def string_of(input: XML.Body, | 
| 80871 | 230 | margin: Double = default_margin, | 
| 231 | breakgain: Double = default_breakgain, | |
| 232 | metric: Metric = Default_Metric, | |
| 233 | pure: Boolean = false | |
| 234 |   ): String = {
 | |
| 235 | output_content(pure, formatted(input, margin = margin, breakgain = breakgain, metric = metric)) | |
| 236 | } | |
| 36683 | 237 | } |