Merge branch 'master' into new_ui

db4
Slava Pestov 2009-01-05 23:40:34 -06:00
commit 14f46ea25f
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,7 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: farkup kernel peg peg.ebnf tools.test namespaces ;
USING: farkup kernel peg peg.ebnf tools.test namespaces xml
urls.encoding assocs xml.utilities ;
IN: farkup.tests
relative-link-prefix off
@ -157,3 +158,12 @@ link-no-follow? off
[ "<p>hello_world how are you today?\n<ul><li> hello_world how are you today?</li></ul></p>" ]
[ "hello_world how are you today?\n- hello_world how are you today?" convert-farkup ] unit-test
: check-link-escaping ( string -- link )
convert-farkup string>xml-chunk
"a" deep-tag-named "href" swap at url-decode ;
[ "Trader Joe's" ] [ "[[Trader Joe's]]" check-link-escaping ] unit-test
[ "<foo>" ] [ "[[<foo>]]" check-link-escaping ] unit-test
[ "&blah;" ] [ "[[&blah;]]" check-link-escaping ] unit-test
[ "C++" ] [ "[[C++]]" check-link-escaping ] unit-test

View File

@ -167,7 +167,7 @@ stand-alone
} cond ;
: escape-link ( href text -- href-esc text-esc )
[ check-url escape-quoted-string ] dip escape-string ;
[ check-url ] dip escape-string ;
: write-link ( href text -- )
escape-link