--- a/src/Pure/PIDE/xml.scala Sat Jan 30 17:06:13 2021 +0100
+++ b/src/Pure/PIDE/xml.scala Sat Jan 30 17:15:14 2021 +0100
@@ -128,22 +128,22 @@
val header: String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
- def output_char(s: StringBuilder, c: Char)
+ def output_char(s: StringBuilder, c: Char, permissive: Boolean = false)
{
c match {
case '<' => s ++= "<"
case '>' => s ++= ">"
case '&' => s ++= "&"
- case '"' => s ++= """
- case '\'' => s ++= "'"
+ case '"' if !permissive => s ++= """
+ case '\'' if !permissive => s ++= "'"
case _ => s += c
}
}
- def output_string(s: StringBuilder, str: String)
+ def output_string(s: StringBuilder, str: String, permissive: Boolean = false)
{
if (str == null) s ++= str
- else str.iterator.foreach(c => output_char(s, c))
+ else str.iterator.foreach(output_char(s, _, permissive = permissive))
}
def string_of_body(body: Body): String =
--- a/src/Pure/Thy/html.scala Sat Jan 30 17:06:13 2021 +0100
+++ b/src/Pure/Thy/html.scala Sat Jan 30 17:15:14 2021 +0100
@@ -26,21 +26,10 @@
def is_control(sym: Symbol.Symbol): Boolean = control.isDefinedAt(sym)
- def output_char_permissive(s: StringBuilder, c: Char)
- {
- c match {
- case '<' => s ++= "<"
- case '>' => s ++= ">"
- case '&' => s ++= "&"
- case _ => s += c
- }
- }
-
def output(s: StringBuilder, text: String, hidden: Boolean, permissive: Boolean)
{
def output_char(c: Char): Unit =
- if (permissive) output_char_permissive(s, c)
- else XML.output_char(s, c)
+ XML.output_char(s, c, permissive = permissive)
def output_string(str: String): Unit =
str.iterator.foreach(output_char)