summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-02-10 17:26:02 +0000
committerhallgren <hallgren@chalmers.se>2012-02-10 17:26:02 +0000
commit73827b9bf7ed18ed9437b1214e9a01f81e227923 (patch)
tree635923f0fb1ef4ad710e0c610a4102474bfa4b99 /src/compiler
parent6b29296060a0fcbc32ddb27fe56325bccff144e0 (diff)
gfse: stay on the same page when compiling grammars
The link to the minibar (or compiler errors) are now shown below the grammar on the same page. If you go to the minibar, you only have to press the back button once to get back to the editor. Also some output formatting changes in GFServer.hs.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/GFServer.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs
index 149cb1864..685b9d76f 100644
--- a/src/compiler/GFServer.hs
+++ b/src/compiler/GFServer.hs
@@ -224,18 +224,17 @@ handle state0 cache execute1
resultpage cwd dir cmd (ecode,stdout,stderr) files =
unlines $
"<!DOCTYPE html>":
- "<title>Uploaded</title>":
+ wrap "title" "Uploaded":
"<link rel=stylesheet type=\"text/css\" HREF=\"/gfse/editor.css\" title=\"Normal\">":
- "<h1>Uploaded</h1>":
- "<pre>":escape cmd:"":escape (rel stderr):escape (rel stdout):
- "</pre>":
+ wrap "h1" "Uploaded":
+ concatMap (pre.escape) [cmd,rel stderr,rel stdout]:
(if ecode==ExitSuccess
- then "<h3>OK</h3>":links
+ then wrap "h3" "OK":links
else "<h3 class=error_message>Error</h3>":listing)
where
links = "<dl>":
("<dt>▸ <a href=\"/minibar/minibar.html?"++dir++pgf++"\">Minibar</a>"):
- "<dt>◂ <a href=\"javascript:history.back()\">Back to Editor</a>":
+ "<dt class=back_to_editor>◂ <a href=\"javascript:history.back()\">Back to Editor</a>":
"</dl>":
[]
@@ -246,12 +245,17 @@ resultpage cwd dir cmd (ecode,stdout,stderr) files =
listing = concatMap listfile files
listfile (name,source) =
- ("<h4>"++name++"</h4><pre class=plain>"):number source:"</pre>":[]
+ (wrap "h4" name++"<pre class=plain>"):number source:"</pre>":[]
number = unlines . zipWith num [1..] . lines
num n s = pad (show n)++" "++escape s
pad s = replicate (5-length s) ' '++s
+ pre = wrap "pre"
+ wrap t s = tag t++s++endtag t
+ tag t = "<"++t++">"
+ endtag t = tag ('/':t)
+
rel = unlines . map relative . lines
-- remove absolute file paths from error messages: