]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/html/elements/elements.factor
factor: trim using lists
[factor.git] / extra / html / elements / elements.factor
index 85df4f7b27bcaab694f0211072306663b3e07d56..176e9c564d63dae573d670ff3fd210adecd7a4fa 100644 (file)
@@ -1,9 +1,6 @@
 ! Copyright (C) 2004, 2009 Chris Double, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: io io.styles kernel namespaces prettyprint quotations
-sequences strings words xml.entities compiler.units effects
-xml.data urls math math.parser combinators
-present fry io.streams.string xml.writer html ;
+USING: io.styles kernel present sequences words xml.entities ;
 IN: html.elements
 
 SYMBOL: html
@@ -16,69 +13,69 @@ SYMBOL: html
 
 <<
 
-: elements-vocab ( -- vocab-name ) "html.elements" ;
+CONSTANT: elements-vocab "html.elements"
 
 : html-word ( name def effect -- )
-    #! Define 'word creating' word to allow
-    #! dynamically creating words.
-    [ elements-vocab create ] 2dip define-declared ;
+    ! Define 'word creating' word to allow
+    ! dynamically creating words.
+    [ elements-vocab create-word ] 2dip define-declared ;
 
 : <foo> ( str -- <str> ) "<" ">" surround ;
 
 : def-for-html-word-<foo> ( name -- )
-    #! Return the name and code for the <foo> patterned
-    #! word.
+    ! Return the name and code for the <foo> patterned
+    ! word.
     dup <foo> swap '[ _ <foo> write-html ]
-    (( -- )) html-word ;
+    ( -- ) html-word ;
 
 : <foo ( str -- <str ) "<" prepend ;
 
 : def-for-html-word-<foo ( name -- )
-    #! Return the name and code for the <foo patterned
-    #! word.
+    ! Return the name and code for the <foo patterned
+    ! word.
     <foo dup '[ _ write-html ]
-    (( -- )) html-word ;
+    ( -- ) html-word ;
 
 : foo> ( str -- foo> ) ">" append ;
 
 : def-for-html-word-foo> ( name -- )
-    #! Return the name and code for the foo> patterned
-    #! word.
-    foo> [ ">" write-html ] (( -- )) html-word ;
+    ! Return the name and code for the foo> patterned
+    ! word.
+    foo> [ ">" write-html ] ( -- ) html-word ;
 
 : </foo> ( str -- </str> ) "</" ">" surround ;
 
 : def-for-html-word-</foo> ( name -- )
-    #! Return the name and code for the </foo> patterned
-    #! word.
-    </foo> dup '[ _ write-html ] (( -- )) html-word ;
+    ! Return the name and code for the </foo> patterned
+    ! word.
+    </foo> dup '[ _ write-html ] ( -- ) html-word ;
 
 : <foo/> ( str -- <str/> ) "<" "/>" surround ;
 
 : def-for-html-word-<foo/> ( name -- )
-    #! Return the name and code for the <foo/> patterned
-    #! word.
+    ! Return the name and code for the <foo/> patterned
+    ! word.
     dup <foo/> swap '[ _ <foo/> write-html ]
-    (( -- )) html-word ;
+    ( -- ) html-word ;
 
 : foo/> ( str -- str/> ) "/>" append ;
 
 : def-for-html-word-foo/> ( name -- )
-    #! Return the name and code for the foo/> patterned
-    #! word.
-    foo/> [ "/>" write-html ] (( -- )) html-word ;
+    ! Return the name and code for the foo/> patterned
+    ! word.
+    foo/> [ "/>" write-html ] ( -- ) html-word ;
 
 : define-closed-html-word ( name -- )
-    #! Given an HTML tag name, define the words for
-    #! that closable HTML tag.
+    ! Given an HTML tag name, define the words for
+    ! that closable HTML tag.
     dup def-for-html-word-<foo>
     dup def-for-html-word-<foo
     dup def-for-html-word-foo>
     def-for-html-word-</foo> ;
 
 : define-open-html-word ( name -- )
-    #! Given an HTML tag name, define the words for
-    #! that open HTML tag.
+    ! Given an HTML tag name, define the words for
+    ! that open HTML tag.
     dup def-for-html-word-<foo/>
     dup def-for-html-word-<foo
     def-for-html-word-foo/> ;
@@ -92,13 +89,13 @@ SYMBOL: html
 
 : define-attribute-word ( name -- )
     dup "=" prepend swap
-    '[ _ write-attr ] (( string -- )) html-word ;
+    '[ _ write-attr ] ( string -- ) html-word ;
 
 ! Define some closed HTML tags
 [
     "h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8" "h9"
     "ol" "li" "form" "a" "p" "html" "head" "body" "title"
-    "b" "i" "ul" "table" "tbody" "tr" "td" "th" "pre" "textarea"
+    "b" "i" "ul" "table" "thead" "tfoot" "tbody" "tr" "td" "th" "pre" "textarea"
     "script" "div" "span" "select" "option" "style" "input"
     "strong"
 ] [ define-closed-html-word ] each