From 4593948fd27e6cdc4c24a0b008ce1beac4df2560 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Fri, 15 Jul 2011 18:45:03 -0400 Subject: Tutorial tweaks --- src/elisp/urweb-mode.el | 4 +--- src/tutorial.sml | 49 +++++++++++++++++++++++-------------------------- 2 files changed, 24 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el index c9fe5f19..0beed1f9 100644 --- a/src/elisp/urweb-mode.el +++ b/src/elisp/urweb-mode.el @@ -181,13 +181,11 @@ See doc for the variable `urweb-mode-info'." ((save-excursion (backward-char 1) (or (looking-at "=>") (looking-at "->") (looking-at "<>"))) - nil) + (setq finished t)) ((or (looking-at "< ") (looking-at "<=")) nil) ((looking-at "<") (setq finished t)) - ((save-excursion (backward-char 1) (looking-at " >")) - nil) ((looking-at ">") (cond ((> depth 0) diff --git a/src/tutorial.sml b/src/tutorial.sml index a2156adc..f6b9defb 100644 --- a/src/tutorial.sml +++ b/src/tutorial.sml @@ -54,10 +54,10 @@ fun fixupFile (fname, title) = in if Substring.isEmpty after then TextIO.outputSubstr (outf, source) - else if Substring.size after >= 8 andalso Substring.string (Substring.slice (after, 1, SOME 7)) = "amp;lt;" then + else if Substring.size after >= 4 andalso Substring.string (Substring.slice (after, 1, SOME 3)) = "lt;" then (TextIO.outputSubstr (outf, befor); TextIO.output (outf, "<"); - proseLoop (Substring.slice (after, 8, NONE))) + proseLoop (Substring.slice (after, 4, NONE))) else if Substring.size after >= 4 andalso Substring.string (Substring.slice (after, 1, SOME 3)) = "gt;" then (TextIO.outputSubstr (outf, befor); TextIO.output (outf, ">"); @@ -75,26 +75,7 @@ fun fixupFile (fname, title) = val (befor, after) = Substring.position "(* " source in if Substring.isEmpty after then - let - val (befor, after) = Substring.position "(** " source - in - if Substring.isEmpty after then - TextIO.outputSubstr (outf, source) - else - let - val (befor', after) = Substring.position " *)" - (Substring.slice (after, 65, NONE)) - in - if Substring.isEmpty after then - TextIO.outputSubstr (outf, source) - else - (TextIO.outputSubstr (outf, befor); - TextIO.output (outf, "

"); - proseLoop befor'; - TextIO.output (outf, "

"); - loop (Substring.slice (after, 49, NONE))) - end - end + TextIO.outputSubstr (outf, source) else let val (befor', after) = Substring.position "
*)" @@ -104,9 +85,16 @@ fun fixupFile (fname, title) = TextIO.outputSubstr (outf, source) else (TextIO.outputSubstr (outf, befor); - TextIO.output (outf, "
"); - proseLoop befor'; - TextIO.output (outf, "
"); + TextIO.output (outf, ""); + if Substring.size befor' >= 1 andalso Substring.sub (befor', 0) = #"*" then + (TextIO.output (outf, "

"); + proseLoop (Substring.slice (befor', 2, NONE)); + TextIO.output (outf, "

")) + else + (TextIO.output (outf, "
"); + proseLoop befor'; + TextIO.output (outf, "
")); + TextIO.output (outf, "
");
                              loop (Substring.slice (after, 49, NONE)))
                     end
             end
@@ -130,6 +118,14 @@ fun fixupFile (fname, title) =
              TextIO.output (outf, "\t\tbackground-color: #99FF99;\n");
              TextIO.output (outf, "\t\tpadding: 5px;\n");
              TextIO.output (outf, "\t}\n");
+             TextIO.output (outf, "\ta:link {\n");
+             TextIO.output (outf, "\t\ttext-decoration: underline;\n");
+             TextIO.output (outf, "\t\tcolor: blue;\n");
+             TextIO.output (outf, "\t}\n");
+             TextIO.output (outf, "\ta:visited {\n");
+             TextIO.output (outf, "\t\ttext-decoration: underline;\n");
+             TextIO.output (outf, "\t\tcolor: red;\n");
+             TextIO.output (outf, "\t}\n");
              TextIO.output (outf, "-->\n");
              TextIO.output (outf, "\n");
              TextIO.output (outf, "");
@@ -287,13 +283,14 @@ fun doUr fname =
                                           ^ "/\\\") "
                                           ^ "(load \\\"urweb-mode-startup\\\") "
                                           ^ "(urweb-mode) "
-                                          ^ "(find-file \\\"/tmp/final.ur\\\") "
+                                          ^ "(find-file \\\"/tmp/final2.ur\\\") "
                                           ^ "(switch-to-buffer (htmlize-buffer)) "
                                           ^ "(write-file \\\"/tmp/final.html\\\") "
                                           ^ "(kill-emacs))\""
                             in
                                 eatNls befor;
                                 TextIO.closeOut outf;
+                                ignore (OS.Process.system "sed -e 's/</</g;s/&/\\&/g' </tmp/final.ur >/tmp/final2.ur");
                                 ignore (OS.Process.system cmd);
                                 fixupFile (fname, title)
                             end
-- 
cgit v1.2.3