# HG changeset patch # User haftmann # Date 1260004703 -3600 # Node ID e4fb0daadcffd58a46b8f1a1cd90cbabd4dbe1ed # Parent c54498f88a77a58eb6792e8a27eb5c974ce92ee7# Parent ebf231de0c5cecf0ef60cf9c47ae9038355c6ec9 merged diff -r ebf231de0c5c -r e4fb0daadcff src/Pure/IsaMakefile --- a/src/Pure/IsaMakefile Fri Dec 04 18:52:55 2009 +0100 +++ b/src/Pure/IsaMakefile Sat Dec 05 10:18:23 2009 +0100 @@ -128,7 +128,7 @@ System/cygwin.scala System/gui_setup.scala \ System/isabelle_process.scala System/isabelle_syntax.scala \ System/isabelle_system.scala System/platform.scala \ - Thy/completion.scala Thy/thy_header.scala + Thy/completion.scala Thy/html.scala Thy/thy_header.scala JAR_DIR = $(ISABELLE_HOME)/lib/classes PURE_JAR = $(JAR_DIR)/Pure.jar diff -r ebf231de0c5c -r e4fb0daadcff src/Pure/Thy/html.ML --- a/src/Pure/Thy/html.ML Fri Dec 04 18:52:55 2009 +0100 +++ b/src/Pure/Thy/html.ML Sat Dec 05 10:18:23 2009 +0100 @@ -49,7 +49,8 @@ local val html_syms = Symtab.make - [("\\", (2, "  ")), + [("'", (1, "'")), + ("\\", (2, "  ")), ("\\", (1, "¡")), ("\\", (1, "¢")), ("\\", (1, "£")), @@ -197,7 +198,8 @@ fun output_sym s = if Symbol.is_raw s then (1, Symbol.decode_raw s) else - (case Symtab.lookup html_syms s of SOME x => x + (case Symtab.lookup html_syms s of + SOME x => x | NONE => (size s, XML.text s)); fun output_sub s = apsnd (enclose "" "") (output_sym s); diff -r ebf231de0c5c -r e4fb0daadcff src/Pure/Thy/html.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Pure/Thy/html.scala Sat Dec 05 10:18:23 2009 +0100 @@ -0,0 +1,41 @@ +/* Title: Pure/Thy/html.scala + Author: Makarius + +Basic HTML output. +*/ + +package isabelle + +object HTML +{ + // common elements and attributes + + val BODY = "body" + val DIV = "div" + val SPAN = "span" + val BR = "br" + val CLASS = "class" + + + // document markup + + def body(trees: List[XML.Tree]): XML.Tree = + XML.Elem(BODY, Nil, trees) + + def div(trees: List[XML.Tree]): XML.Tree = + XML.Elem(DIV, Nil, trees) + + val br: XML.Tree = XML.Elem(BR, Nil, Nil) + + def spans(tree: XML.Tree): List[XML.Tree] = + tree match { + case XML.Elem(name, _, ts) => + List(XML.Elem(SPAN, List((CLASS, name)), ts.flatMap(spans))) + case text @ XML.Text(txt) => + txt.split("\n").toList match { + case line :: lines if !lines.isEmpty => + XML.Text(line) :: lines.flatMap(l => List(br, XML.Text(l))) + case _ => List(text) + } + } +}