add \Box
[wix.git] / src / Html.lhs
index a6cfeea..a3ff54f 100644 (file)
@@ -1,4 +1,8 @@
 \begin{code}
+-- Copyright 2008 the Contributors, as shown in the revision logs.
+-- Licensed under the Apache Public Source License 2.0 ("the License").
+-- You may not use this file except in compliance with the License.
+
 module Html
 where
 import Edu_Berkeley_Sbp_Haskell_SBP
@@ -27,7 +31,7 @@ style =
   " LI { margin-top: 5px; }\n"++
   " body { color: #333333; }\n"++
   " blockquote { font-style: italic; width: 100% }\n"++
-  " div.warn { border: 1px solid red; background-color: #fbb; color: white; }\n"++
+  " div.warn { border: 1px solid #f44; border-top: 5px solid #f44; background-color: #fbb; color: white; }\n"++
   " td.warn { color: black; }\n"++
   " div.announce { border: 1px solid green; background-color: #bfb; color: white; }\n"++
   " td.announce { color: black; }\n"++
@@ -179,8 +183,9 @@ instance ToHtml Paragraph where
  toHtml (P t)          = stag "p"  $ toHtml t
 
 
-link ref body = "<a href='"++ref++"'>"++icon++body++"</a>"
+link ref body = "<a href='"++(urlify ref)++"'>"++icon++body++"</a>"
  where
+  urlify = toHtml
   icon = if      ".pdf" `isSuffixOf` ref then "<img "++img++" src='"++pdfIconBase64++"'>&nbsp;"
          else if "mailto:" `isPrefixOf` ref then "<img "++img++" src='"++emailIconBase64++"'>&nbsp;"
          else ""
@@ -195,6 +200,7 @@ instance ToHtml Text where
  toHtml (Quotes x)                = "&#8220;"++(toHtml x)++"&#8221;"
  toHtml (Verbatim x)              = pre x
  toHtml (Link t ref)              = link (show ref) (toHtml t)
+ toHtml (Command "comment" y)     = ""
  toHtml (Command "url" y)         = "<tt>"++(link (toHtml y) (toHtml y))++"</tt>"
  toHtml (Command "WiX" y)         = "W<span style='vertical-align:-20%'>I</span>X"
  toHtml (Command "TeX" y)         = "T<span style='vertical-align:-20%'>E</span>X"
@@ -231,6 +237,8 @@ instance ToHtml Text where
  toHtml (Command "green" y)       = "<font color=green>"++(toHtml y)++"</font>"
  toHtml (Command "sc" y)          = "<sc>"++(toHtml y)++"</sc>"
  toHtml (Command "image" y)       = "<img src='"++(toHtml y)++"'/>"
+ toHtml (Command "imagec" y)      = "<center><img src='"++(toHtml y)++"'/></center>"
+ toHtml (Command "image2" y)      = "<img width=180px src='"++(toHtml y)++"'/>"
  toHtml (Command "image3" y)      = "<img width=200px src='"++(toHtml y)++"'/>"
  toHtml (Command "image4" y)      = "<center><img width=550px src='"++(toHtml y)++"'/></center>"
  toHtml (Command "warn" y)        = "\n<div class=warn>\n<table border=0 cellpadding=5px>\n"
@@ -267,7 +275,7 @@ instance ToHtml Text where
  toHtml (GlyphText TradeMark)     = "&#8482;"
  toHtml (GlyphText ServiceMark)   = "&#8482;"
  toHtml (GlyphText Emdash)        = "&mdash;"
- toHtml (GlyphText Ellipsis)      = "&#0133;"
+ toHtml (GlyphText Ellipsis)      = "&#0133;"  -- &cdots;?
  toHtml (GlyphText Cent)          = "&#189;"
  toHtml (GlyphText Daggar)        = "&#8224;"
  toHtml (GlyphText DoubleDaggar)  = "&#8225;"
@@ -277,7 +285,8 @@ instance ToHtml Text where
  toHtml (GlyphText Sharp)         = "&#8920;"
  toHtml (GlyphText CheckMark)     = "&#10003;"
  toHtml (GlyphText XMark)         = "&#10007;"
- toHtml (GlyphText LeftArrow)            = "&#;"  -- FIXME
+ toHtml (GlyphText LeftArrow)            = "&larr;"
+ toHtml (GlyphText RightArrow)           = "&rarr;"
  toHtml (GlyphText DoubleLeftArrow)      = "&#;"  -- FIXME
  toHtml (GlyphText DoubleRightArrow)     = "&#;"  -- FIXME
  toHtml (GlyphText DoubleLeftRightArrow) = "&#;"  -- FIXME
@@ -305,7 +314,7 @@ htmlEscapeChar '\'' = "&apos;"
 htmlEscapeChar '\"' = "&quot;"
 htmlEscapeChar c    = [c]
 
-pre x = "\n<div class=pre>"++ (pre' x) ++ "\n</div>\n"
+pre x = "\n<div class=pre style='white-space:nowrap'>"++ (pre' x) ++ "\n</div>\n"
  where
   pre' (' ':b)         = "&nbsp;"++(pre' b)
   pre' ('\n':b)        = "<br/>\n"++(pre' b)