diff --git a/basis/farkup/farkup-tests.factor b/basis/farkup/farkup-tests.factor index 27911a8d13..aa9345e1d0 100644 --- a/basis/farkup/farkup-tests.factor +++ b/basis/farkup/farkup-tests.factor @@ -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 [ "

hello_world how are you today?\n

" ] [ "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 +[ "" ] [ "[[]]" check-link-escaping ] unit-test +[ "&blah;" ] [ "[[&blah;]]" check-link-escaping ] unit-test +[ "C++" ] [ "[[C++]]" check-link-escaping ] unit-test \ No newline at end of file diff --git a/basis/farkup/farkup.factor b/basis/farkup/farkup.factor index 284d5758a3..1bfd420dd3 100644 --- a/basis/farkup/farkup.factor +++ b/basis/farkup/farkup.factor @@ -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