From cc89943c085d02f7a590a64908627beffd2dc35e Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 5 Feb 2009 14:34:55 -0600 Subject: [PATCH 1/4] Getting rid of html.elements from most vocabs --- basis/furnace/chloe-tags/chloe-tags.factor | 26 +++++++++++++------ basis/furnace/furnace-tests.factor | 2 +- basis/furnace/sessions/sessions.factor | 2 +- basis/furnace/utilities/utilities.factor | 9 +++---- basis/html/templates/chloe/chloe-docs.factor | 6 ++--- basis/html/templates/chloe/chloe-tests.factor | 2 +- basis/html/templates/chloe/chloe.factor | 12 ++++----- .../templates/chloe/compiler/compiler.factor | 3 +++ basis/html/templates/templates.factor | 23 +++++++++++----- extra/webapps/user-admin/user-admin.factor | 1 - 10 files changed, 52 insertions(+), 34 deletions(-) diff --git a/basis/furnace/chloe-tags/chloe-tags.factor b/basis/furnace/chloe-tags/chloe-tags.factor index dd24d8dcde..be24eb5224 100644 --- a/basis/furnace/chloe-tags/chloe-tags.factor +++ b/basis/furnace/chloe-tags/chloe-tags.factor @@ -66,16 +66,26 @@ CHLOE: write-atom drop [ write-atom-feeds ] [code] ; tri [ =href a> ] [code] ; -: a-end-tag ( tag -- ) - drop [ ] [code] ; +: process-attrs ( assoc -- newassoc ) + [ "@" ?head [ value present ] when ] assoc-map ; + +: non-chloe-attrs ( tag -- ) + attrs>> non-chloe-attrs-only [ process-attrs ] [code-with] ; + +: a-attrs ( tag -- ) + [ non-chloe-attrs ] + [ compile-link-attrs ] + [ compile-a-url ] tri + [ swap "href" swap set-at ] [code] ; CHLOE: a - [ - [ a-start-tag ] [ compile-children ] [ a-end-tag ] tri - ] compile-with-scope ; + [ a-attrs ] + [ compile-children>string ] bi + [ [XML <-> XML] swap >>attrs ] + [xml-code] ; CHLOE: base - compile-a-url [ ] [code] ; + compile-a-url [ [XML /> XML] ] [xml-code] ; : compile-hidden-form-fields ( for -- ) '[ @@ -121,13 +131,13 @@ CHLOE: form
- XML> ; + XML> body>> clone ; : add-tag-attrs ( attrs tag -- ) attrs>> swap update ; CHLOE: button - button-tag-markup body>> + button-tag-markup { [ [ attrs>> chloe-attrs-only ] dip add-tag-attrs ] [ [ attrs>> non-chloe-attrs-only ] dip "button" deep-tag-named add-tag-attrs ] diff --git a/basis/furnace/furnace-tests.factor b/basis/furnace/furnace-tests.factor index f6e5434997..f01260c68b 100644 --- a/basis/furnace/furnace-tests.factor +++ b/basis/furnace/furnace-tests.factor @@ -30,7 +30,7 @@ M: base-path-check-responder call-responder* "a/b/c" split-path main-responder get call-responder body>> ] unit-test -[ "" ] +[ "" ] [ [ "&&&" "foo" hidden-form-field ] with-string-writer ] unit-test diff --git a/basis/furnace/sessions/sessions.factor b/basis/furnace/sessions/sessions.factor index 8b7e1ab83f..52e705c153 100644 --- a/basis/furnace/sessions/sessions.factor +++ b/basis/furnace/sessions/sessions.factor @@ -5,7 +5,7 @@ strings random accessors quotations hashtables sequences continuations fry calendar combinators combinators.short-circuit destructors alarms io.sockets db db.tuples db.types http http.server http.server.dispatchers http.server.filters -html.elements furnace.cache furnace.scopes furnace.utilities ; +furnace.cache furnace.scopes furnace.utilities ; IN: furnace.sessions TUPLE: session < scope user-agent client ; diff --git a/basis/furnace/utilities/utilities.factor b/basis/furnace/utilities/utilities.factor index e09047b74a..4a9f71e8a9 100755 --- a/basis/furnace/utilities/utilities.factor +++ b/basis/furnace/utilities/utilities.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: namespaces make assocs sequences kernel classes splitting words vocabs.loader accessors strings combinators arrays -continuations present fry urls html.elements http http.server +continuations present fry urls http http.server xml.literals xml.writer http.server.redirection http.server.remapping ; IN: furnace.utilities @@ -83,11 +83,8 @@ M: object modify-form drop ; : hidden-form-field ( value name -- ) over [ - + [XML name=<->/> XML] + write-xml ] [ 2drop ] if ; : nested-forms-key "__n" ; diff --git a/basis/html/templates/chloe/chloe-docs.factor b/basis/html/templates/chloe/chloe-docs.factor index f6408d3b59..b2259e629e 100644 --- a/basis/html/templates/chloe/chloe-docs.factor +++ b/basis/html/templates/chloe/chloe-docs.factor @@ -128,7 +128,7 @@ ARTICLE: "html.templates.chloe.tags.form" "Chloe link and form tags" "" " View" - "s" + "" } } } { { $snippet "t:base" } { "Outputs an HTML " { $snippet "" } " tag. The attributes are interpreted in the same manner as the attributes of " { $snippet "t:a" } "." } } @@ -261,8 +261,8 @@ $nl ARTICLE: "html.templates.chloe.extend.components.example" "An example of a custom Chloe component" "As an example, let's develop a custom Chloe component which renders an image stored in a form value. Since the component does not require any configuration, we can define a singleton class:" { $code "SINGLETON: image" } -"Now we define a method on the " { $link render* } " generic word which renders the image using " { $vocab-link "html.elements" } ":" -{ $code "M: image render* 2drop ;" } +"Now we define a method on the " { $link render* } " generic word which renders the image using " { $vocab-link "xml.literals" } ":" +{ $code "M: image render* 2drop [XML /> XML] ;" } "Finally, we can define a Chloe component:" { $code "COMPONENT: image" } "We can use it as follows, assuming the current form has a value named " { $snippet "image" } ":" diff --git a/basis/html/templates/chloe/chloe-tests.factor b/basis/html/templates/chloe/chloe-tests.factor index 19b67f7018..184f57051a 100644 --- a/basis/html/templates/chloe/chloe-tests.factor +++ b/basis/html/templates/chloe/chloe-tests.factor @@ -135,7 +135,7 @@ TUPLE: person first-name last-name ; [ ] [ H{ { "a" H{ { "b" "c" } } } } values set ] unit-test -[ "
" ] [ +[ "
" ] [ [ "test10" test-template call-template ] run-template diff --git a/basis/html/templates/chloe/chloe.factor b/basis/html/templates/chloe/chloe.factor index e5b40fcfaa..99afbc31bd 100644 --- a/basis/html/templates/chloe/chloe.factor +++ b/basis/html/templates/chloe/chloe.factor @@ -8,7 +8,6 @@ logging continuations xml.data xml.writer xml.literals strings html.forms html -html.elements html.components html.templates html.templates.chloe.compiler @@ -28,7 +27,9 @@ CHLOE: write-title drop "head" tag-stack get member? "title" tag-stack get member? not and - [ write-title ] [ write-title ] ? [code] ; + [ get-title [XML <-> XML] ] + [ get-title ] ? + [xml-code] ; CHLOE: style dup "include" optional-attr [ @@ -39,10 +40,9 @@ CHLOE: style CHLOE: write-style drop [ - - ] [code] ; + get-style + [XML XML] + ] [xml-code] ; CHLOE: even [ "index" value even? swap when ] process-children ; diff --git a/basis/html/templates/chloe/compiler/compiler.factor b/basis/html/templates/chloe/compiler/compiler.factor index 7180e8cdbc..394b5ef359 100644 --- a/basis/html/templates/chloe/compiler/compiler.factor +++ b/basis/html/templates/chloe/compiler/compiler.factor @@ -42,6 +42,9 @@ DEFER: compile-element : [code-with] ( obj quot -- ) reset-buffer [ , ] [ % ] bi* ; +: [xml-code] ( quot -- ) + [ write-xml ] compose [code] ; + : expand-attr ( value -- ) [ value present write ] [code-with] ; diff --git a/basis/html/templates/templates.factor b/basis/html/templates/templates.factor index efaf8d6a62..c0fec8d1b6 100644 --- a/basis/html/templates/templates.factor +++ b/basis/html/templates/templates.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel fry io io.encodings.utf8 io.files debugger prettyprint continuations namespaces boxes sequences -arrays strings html io.streams.string +arrays strings html io.streams.string assocs quotations xml.data xml.writer xml.literals ; IN: html.templates @@ -34,8 +34,11 @@ SYMBOL: title : set-title ( string -- ) title get >box ; +: get-title ( -- string ) + title get value>> ; + : write-title ( -- ) - title get value>> write ; + get-title write ; SYMBOL: style @@ -43,24 +46,30 @@ SYMBOL: style "\n" style get push-all style get push-all ; +: get-style ( -- string ) + style get >string ; + : write-style ( -- ) - style get >string write ; + get-style write ; SYMBOL: atom-feeds : add-atom-feed ( title url -- ) 2array atom-feeds get push ; -: write-atom-feeds ( -- ) +: get-atom-feeds ( -- xml ) atom-feeds get [ - first2 [XML + [XML href=<->/> - XML] write-xml - ] each ; + XML] + ] { } assoc>map ; + +: write-atom-feeds ( -- ) + get-atom-feeds write-xml ; SYMBOL: nested-template? diff --git a/extra/webapps/user-admin/user-admin.factor b/extra/webapps/user-admin/user-admin.factor index 9d4e348596..c0cd601af5 100644 --- a/extra/webapps/user-admin/user-admin.factor +++ b/extra/webapps/user-admin/user-admin.factor @@ -3,7 +3,6 @@ USING: kernel sequences accessors namespaces combinators words assocs db.tuples arrays splitting strings validators urls html.forms -html.elements html.components furnace furnace.boilerplate From 28e644209c1c82c5e59cd49bf0680999f45c79bc Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Fri, 6 Feb 2009 00:42:46 -0600 Subject: [PATCH 2/4] Unicode.case supports lithuanian properly (hopefully) --- basis/unicode/case/case-tests.factor | 16 +++++++++++++-- basis/unicode/case/case.factor | 30 ++++++++++++++++++---------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/basis/unicode/case/case-tests.factor b/basis/unicode/case/case-tests.factor index 6e26a36a19..52a8d9755e 100644 --- a/basis/unicode/case/case-tests.factor +++ b/basis/unicode/case/case-tests.factor @@ -1,4 +1,7 @@ -USING: unicode.case tools.test namespaces ; +! Copyright (C) 2008, 2009 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. +USING: unicode.case unicode.case.private tools.test namespaces strings unicode.normalize ; +IN: unicode.case.tests \ >upper must-infer \ >lower must-infer @@ -9,12 +12,21 @@ USING: unicode.case tools.test namespaces ; [ "\u0003C3a\u0003C2 \u0003C3\u0003C2 \u0003C3a\u0003C2" ] [ "\u0003A3A\u0003A3 \u0003A3\u0003A3 \u0003A3A\u0003A3" >lower ] unit-test [ t ] [ "hello how are you?" lower? ] unit-test [ + [ f ] [ i-dot? ] unit-test + [ f ] [ lt? ] unit-test "tr" locale set + [ t ] [ i-dot? ] unit-test + [ f ] [ lt? ] unit-test [ "i\u000131i \u000131jj" ] [ "i\u000131I\u000307 IJj" >lower ] unit-test [ "I\u000307\u000131i Ijj" ] [ "i\u000131I\u000307 IJj" >title ] unit-test [ "I\u000307II\u000307 IJJ" ] [ "i\u000131I\u000307 IJj" >upper ] unit-test "lt" locale set - ! Lithuanian casing tests + [ f ] [ i-dot? ] unit-test + [ t ] [ lt? ] unit-test + [ "i\u000307\u000300" ] [ HEX: CC 1string nfd >lower ] unit-test + [ "\u00012f\u000307" ] [ HEX: 12E 1string nfd >lower nfc ] unit-test + [ "I\u000300" ] [ "i\u000307\u000300" >upper ] unit-test +! [ "I\u000300" ] [ "i\u000307\u000300" >title ] unit-test ] with-scope [ t ] [ "asdf" lower? ] unit-test diff --git a/basis/unicode/case/case.factor b/basis/unicode/case/case.factor index 65fab0ac38..3ac98cd57f 100644 --- a/basis/unicode/case/case.factor +++ b/basis/unicode/case/case.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2008 Daniel Ehrenberg. +! Copyright (C) 2008, 2009 Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. USING: unicode.data sequences namespaces sbufs make unicode.syntax unicode.normalize math hints -unicode.categories combinators unicode.syntax assocs +unicode.categories combinators unicode.syntax assocs combinators.short-circuit strings splitting kernel accessors unicode.breaks fry locals ; QUALIFIED: ascii IN: unicode.case @@ -26,6 +26,9 @@ SYMBOL: locale ! Just casing locale, or overall? : i-dot? ( -- ? ) locale get { "tr" "az" } member? ; +: lt? ( -- ? ) + locale get "lt" = ; + : lithuanian? ( -- ? ) locale get "lt" = ; : dot-over ( -- ch ) HEX: 307 ; @@ -37,18 +40,21 @@ SYMBOL: locale ! Just casing locale, or overall? : mark-above? ( ch -- ? ) combining-class 230 = ; -: with-rest ( seq quot: ( seq -- seq ) -- seq ) - [ unclip ] dip swap slip prefix ; inline +:: with-rest ( seq quot: ( seq -- seq ) -- seq ) + seq unclip quot dip prefix ; inline : add-dots ( seq -- seq ) - [ [ "" ] [ - dup first mark-above? - [ CHAR: combining-dot-above prefix ] when + [ [ { } ] [ + [ + dup first + { [ mark-above? ] [ CHAR: combining-ogonek = ] } 1|| + [ CHAR: combining-dot-above prefix ] when + ] map ] if-empty ] with-rest ; inline : lithuanian>lower ( string -- lower ) - "i" split add-dots "i" join - "j" split add-dots "i" join ; inline + "I" split add-dots "I" join + "J" split add-dots "J" join ; inline : turk>upper ( string -- upper-i ) "i" "I\u000307" replace ; inline @@ -88,13 +94,16 @@ SYMBOL: locale ! Just casing locale, or overall? PRIVATE> : >lower ( string -- lower ) - i-dot? [ turk>lower ] when final-sigma + i-dot? [ turk>lower ] when + lt? [ lithuanian>lower ] when + final-sigma [ lower>> ] [ ch>lower ] map-case ; HINTS: >lower string ; : >upper ( string -- upper ) i-dot? [ turk>upper ] when + lt? [ lithuanian>upper ] when [ upper>> ] [ ch>upper ] map-case ; HINTS: >upper string ; @@ -103,6 +112,7 @@ HINTS: >upper string ; : (>title) ( string -- title ) i-dot? [ turk>upper ] when + lt? [ lithuanian>upper ] when [ title>> ] [ ch>title ] map-case ; inline : title-word ( string -- title ) From b206c5a2d1cbe95a99a37c8e961422c97b1d0b11 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Fri, 6 Feb 2009 10:54:13 -0600 Subject: [PATCH 3/4] Finishing getting rid of html.elements from basis --- basis/furnace/chloe-tags/chloe-tags.factor | 76 +++++++++---------- basis/furnace/utilities/utilities.factor | 2 +- basis/html/components/components.factor | 7 +- {basis => extra}/html/elements/authors.txt | 0 .../html/elements/elements-docs.factor | 0 .../html/elements/elements-tests.factor | 0 .../html/elements/elements.factor | 0 {basis => extra}/html/elements/summary.txt | 0 {basis => extra}/html/elements/tags.txt | 0 9 files changed, 43 insertions(+), 42 deletions(-) rename {basis => extra}/html/elements/authors.txt (100%) rename {basis => extra}/html/elements/elements-docs.factor (100%) rename {basis => extra}/html/elements/elements-tests.factor (100%) rename {basis => extra}/html/elements/elements.factor (100%) rename {basis => extra}/html/elements/summary.txt (100%) rename {basis => extra}/html/elements/tags.txt (100%) diff --git a/basis/furnace/chloe-tags/chloe-tags.factor b/basis/furnace/chloe-tags/chloe-tags.factor index 2be19c00c3..2bdaacdcba 100644 --- a/basis/furnace/chloe-tags/chloe-tags.factor +++ b/basis/furnace/chloe-tags/chloe-tags.factor @@ -10,7 +10,6 @@ xml.writer xml.traversal xml.syntax html.components -html.elements html.forms html.templates html.templates.chloe @@ -58,14 +57,6 @@ CHLOE: write-atom drop [ write-atom-feeds ] [code] ; #! Side-effects current namespace. '[ [ [ _ ] dip link-attr ] each-responder ] [code] ; -: a-start-tag ( tag -- ) - [ > non-chloe-attrs-only compile-attrs ] - [ compile-link-attrs ] - [ compile-a-url ] - tri - [ =href a> ] [code] ; - : process-attrs ( assoc -- newassoc ) [ "@" ?head [ value present ] when ] assoc-map ; @@ -76,54 +67,61 @@ CHLOE: write-atom drop [ write-atom-feeds ] [code] ; [ non-chloe-attrs ] [ compile-link-attrs ] [ compile-a-url ] tri - [ swap "href" swap set-at ] [code] ; + [ present swap "href" swap [ set-at ] keep ] [code] ; CHLOE: a - [ a-attrs ] - [ compile-children>string ] bi - [ [XML <-> XML] swap >>attrs ] - [xml-code] ; + [ + [ a-attrs ] + [ compile-children>string ] bi + [ [XML <-> XML] second swap >>attrs ] + [xml-code] + ] compile-with-scope ; CHLOE: base compile-a-url [ [XML /> XML] ] [xml-code] ; +USE: io.streams.string + : compile-hidden-form-fields ( for -- ) '[ -
+ [ _ [ "," split [ hidden render ] each ] when* nested-forms get " " join f like nested-forms-key hidden-form-field [ modify-form ] each-responder -
+ ] with-string-writer + [XML
<->
XML] ] [code] ; -: compile-form-attrs ( method action attrs -- ) - [
] [code] ; +: (compile-form-attrs) ( method action -- ) + ! Leaves an assoc on the stack at runtime + [ compile-attr [ "method" pick set-at ] [code] ] + [ compile-attr [ resolve-base-path "action" pick set-at ] [code] ] + bi* ; -: form-start-tag ( tag -- ) - [ - [ "method" optional-attr "post" or ] - [ "action" required-attr ] - [ attrs>> non-chloe-attrs-only ] tri - compile-form-attrs - ] - [ "for" optional-attr compile-hidden-form-fields ] bi ; +: compile-method/action ( tag -- ) + ! generated code is ( assoc -- assoc ) + [ "method" optional-attr "post" or ] + [ "action" required-attr ] bi + (compile-form-attrs) ; -: form-end-tag ( tag -- ) - drop [
] [code] ; +: compile-form-attrs ( tag -- ) + [ non-chloe-attrs ] + [ compile-link-attrs ] + [ compile-method/action ] tri ; + +: hidden-fields ( tag -- ) + "for" optional-attr compile-hidden-form-fields ; CHLOE: form [ - { - [ compile-link-attrs ] - [ form-start-tag ] - [ compile-children ] - [ form-end-tag ] - } cleave + [ compile-form-attrs ] + [ hidden-fields ] + [ compile-children>string ] tri + [ + [XML
<-><->
XML] second + swap >>attrs + write-xml + ] [code] ] compile-with-scope ; : button-tag-markup ( -- xml ) diff --git a/basis/furnace/utilities/utilities.factor b/basis/furnace/utilities/utilities.factor index 4a9f71e8a9..716e708303 100755 --- a/basis/furnace/utilities/utilities.factor +++ b/basis/furnace/utilities/utilities.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: namespaces make assocs sequences kernel classes splitting words vocabs.loader accessors strings combinators arrays -continuations present fry urls http http.server xml.literals xml.writer +continuations present fry urls http http.server xml.syntax xml.writer http.server.redirection http.server.remapping ; IN: furnace.utilities diff --git a/basis/html/components/components.factor b/basis/html/components/components.factor index 82bb75015e..2b18e28351 100644 --- a/basis/html/components/components.factor +++ b/basis/html/components/components.factor @@ -11,7 +11,7 @@ IN: html.components GENERIC: render* ( value name renderer -- xml ) -: render ( name renderer -- ) +: render>xml ( name renderer -- xml ) prepare-value [ dup validation-error? @@ -20,7 +20,10 @@ GENERIC: render* ( value name renderer -- xml ) if ] 2dip render* - swap 2array write-xml ; + swap 2array ; + +: render ( name renderer -- ) + render>xml write-xml ; SINGLETON: label diff --git a/basis/html/elements/authors.txt b/extra/html/elements/authors.txt similarity index 100% rename from basis/html/elements/authors.txt rename to extra/html/elements/authors.txt diff --git a/basis/html/elements/elements-docs.factor b/extra/html/elements/elements-docs.factor similarity index 100% rename from basis/html/elements/elements-docs.factor rename to extra/html/elements/elements-docs.factor diff --git a/basis/html/elements/elements-tests.factor b/extra/html/elements/elements-tests.factor similarity index 100% rename from basis/html/elements/elements-tests.factor rename to extra/html/elements/elements-tests.factor diff --git a/basis/html/elements/elements.factor b/extra/html/elements/elements.factor similarity index 100% rename from basis/html/elements/elements.factor rename to extra/html/elements/elements.factor diff --git a/basis/html/elements/summary.txt b/extra/html/elements/summary.txt similarity index 100% rename from basis/html/elements/summary.txt rename to extra/html/elements/summary.txt diff --git a/basis/html/elements/tags.txt b/extra/html/elements/tags.txt similarity index 100% rename from basis/html/elements/tags.txt rename to extra/html/elements/tags.txt From 47a751ad6cb3c9e695e9deb27873f1447b1431ee Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Fri, 6 Feb 2009 11:44:58 -0600 Subject: [PATCH 4/4] Slight cleanup and fixing unit test --- basis/furnace/chloe-tags/chloe-tags.factor | 13 +++++-------- basis/furnace/utilities/utilities.factor | 8 +++++--- basis/html/templates/chloe/chloe-tests.factor | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/basis/furnace/chloe-tags/chloe-tags.factor b/basis/furnace/chloe-tags/chloe-tags.factor index 2bdaacdcba..d7d9ae9ebb 100644 --- a/basis/furnace/chloe-tags/chloe-tags.factor +++ b/basis/furnace/chloe-tags/chloe-tags.factor @@ -19,6 +19,7 @@ http http.server http.server.redirection http.server.responses +io.streams.string furnace.utilities ; IN: furnace.chloe-tags @@ -80,16 +81,12 @@ CHLOE: a CHLOE: base compile-a-url [ [XML /> XML] ] [xml-code] ; -USE: io.streams.string - : compile-hidden-form-fields ( for -- ) '[ - [ - _ [ "," split [ hidden render ] each ] when* - nested-forms get " " join f like nested-forms-key hidden-form-field - [ modify-form ] each-responder - ] with-string-writer - [XML
<->
XML] + _ [ "," split [ hidden render>xml ] map ] [ f ] if* + nested-forms get " " join f like nested-forms-key hidden-form-field>xml + [ [ modify-form ] each-responder ] with-string-writer + [XML
<-><-><->
XML] ] [code] ; : (compile-form-attrs) ( method action -- ) diff --git a/basis/furnace/utilities/utilities.factor b/basis/furnace/utilities/utilities.factor index 716e708303..a2d4c4d996 100755 --- a/basis/furnace/utilities/utilities.factor +++ b/basis/furnace/utilities/utilities.factor @@ -81,11 +81,13 @@ GENERIC: modify-form ( responder -- ) M: object modify-form drop ; -: hidden-form-field ( value name -- ) +: hidden-form-field>xml ( value name -- xml ) over [ [XML name=<->/> XML] - write-xml - ] [ 2drop ] if ; + ] [ drop ] if ; + +: hidden-form-field ( value name -- ) + hidden-form-field>xml write-xml ; : nested-forms-key "__n" ; diff --git a/basis/html/templates/chloe/chloe-tests.factor b/basis/html/templates/chloe/chloe-tests.factor index 184f57051a..4e454dcee4 100644 --- a/basis/html/templates/chloe/chloe-tests.factor +++ b/basis/html/templates/chloe/chloe-tests.factor @@ -135,7 +135,7 @@ TUPLE: person first-name last-name ; [ ] [ H{ { "a" H{ { "b" "c" } } } } values set ] unit-test -[ "
" ] [ +[ "
" ] [ [ "test10" test-template call-template ] run-template