]> gitweb.factorcode.org Git - factor.git/commitdiff
Un-breaking Chloe
authorDaniel Ehrenberg <littledan@Macintosh-103.local>
Wed, 28 Jan 2009 23:49:21 +0000 (17:49 -0600)
committerDaniel Ehrenberg <littledan@Macintosh-103.local>
Wed, 28 Jan 2009 23:49:21 +0000 (17:49 -0600)
basis/html/templates/chloe/compiler/compiler.factor
basis/html/templates/chloe/syntax/syntax.factor

index 331b565b98e8c47f3be4a6b83dd1f3ccb6e62f80..4410cd75994141bf9d2472b875dbe14bd8a56402 100644 (file)
@@ -7,16 +7,16 @@ html.templates html.templates.chloe.syntax continuations ;
 IN: html.templates.chloe.compiler
 
 : chloe-attrs-only ( assoc -- assoc' )
-    [ drop url>> chloe-ns = ] assoc-filter ;
+    [ drop chloe-name? ] assoc-filter ;
 
 : non-chloe-attrs-only ( assoc -- assoc' )
-    [ drop url>> chloe-ns = not ] assoc-filter ;
+    [ drop chloe-name? not ] assoc-filter ;
 
 : chloe-tag? ( tag -- ? )
     dup xml? [ body>> ] when
     {
         { [ dup tag? not ] [ f ] }
-        { [ dup url>> chloe-ns = not ] [ f ] }
+        { [ dup chloe-name? not ] [ f ] }
         [ t ]
     } cond nip ;
 
@@ -49,7 +49,7 @@ DEFER: compile-element
     reset-buffer "@" ?head [ , [ value present ] % ] [ , ] if ;
 
 : compile-attrs ( assoc -- )
-    [
+    attrs>> [
         " " [write]
         swap name>string [write]
         "=\"" [write]
index 90c171917bab0eec227a3a4d9bde90782ed30930..fb457ff1df4d0b74e0ddb0b0f15dbc46f80b9a92 100644 (file)
@@ -21,14 +21,14 @@ tags global [ H{ } clone or ] change-at
 
 : chloe-ns "http://factorcode.org/chloe/1.0" ; inline
 
-: chloe-name ( string -- name )
-    name new
-        swap >>main
-        chloe-ns >>url ;
+: chloe-name? ( name -- ? )
+    url>> chloe-ns = ;
+
+XML-NS: chloe-name http://factorcode.org/chloe/1.0
 
 : required-attr ( tag name -- value )
-    dup chloe-name rot at*
-    [ nip ] [ drop " attribute is required" append throw ] if ;
+    tuck chloe-name attr
+    [ nip ] [ " attribute is required" append throw ] if* ;
 
 : optional-attr ( tag name -- value )
-    chloe-name swap at ;
+    chloe-name attr ;