diff options
-rw-r--r-- | lib/ur/basis.urs | 2 | ||||
-rw-r--r-- | src/elisp/urweb-mode.el | 23 | ||||
-rw-r--r-- | src/monoize.sml | 2 | ||||
-rw-r--r-- | tests/cssNull.ur | 6 |
4 files changed, 31 insertions, 2 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 8b0561c8..dc4d9ba2 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -602,6 +602,8 @@ val setval : sql_sequence -> int -> transaction unit type css_class val show_css_class : show css_class +val null : css_class +(* No special formatting *) val classes : css_class -> css_class -> css_class (* The equivalent of writing one class after the other, separated by a space, in * an HTML 'class' attribute *) diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el index c4cb3476..b9ffaf10 100644 --- a/src/elisp/urweb-mode.el +++ b/src/elisp/urweb-mode.el @@ -170,7 +170,7 @@ See doc for the variable `urweb-mode-info'." (finished nil) (answer nil) ) - (while (and (not finished) (re-search-backward "[<{}]" nil t)) + (while (and (not finished) (re-search-backward "[-<{}]" nil t)) (cond ((looking-at "{") (if (> depth 0) @@ -185,7 +185,26 @@ See doc for the variable `urweb-mode-info'." (setq answer t) (setq finished t)))) ((looking-at "</xml>") - (incf depth)))) + (incf depth)) + + ((looking-at "-") + (if (looking-at "->") + (setq finished (= depth 0)))) + + ((and (= depth 0) + (not (looking-at "<xml")) ;; ignore <xml/> + (eq font-lock-tag-face + (get-text-property (point) 'face))) + ;; previous code was highlighted as tag, seems we are in xml + (progn + (setq answer t) + (setq finished t))) + + ((= depth 0) + ;; previous thing was a tag like, but not tag + ;; seems we are in usual code or comment + (setq finished t)) + )) answer))) (defun amAttribute (face) diff --git a/src/monoize.sml b/src/monoize.sml index 9f100a3f..f6ea7255 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -2855,6 +2855,8 @@ fun monoExp (env, st, fm) (all as (e, loc)) = ((L'.ESetval (e1, e2), loc), fm) end + | L.EFfi ("Basis", "null") => ((L'.EPrim (Prim.String ""), loc), fm) + | L.EFfiApp ("Basis", "classes", [s1, s2]) => let val (s1, fm) = monoExp (env, st, fm) s1 diff --git a/tests/cssNull.ur b/tests/cssNull.ur new file mode 100644 index 00000000..4939c712 --- /dev/null +++ b/tests/cssNull.ur @@ -0,0 +1,6 @@ +style spicy + +fun main () : transaction page = return <xml><body> + <span class={null}>Boring</span> + <span class={classes null spicy}>Spicy!</span> +</body></xml> |