2008-09-25 03:02:47 -04:00
|
|
|
! Copyright (C) 2008 Doug Coleman.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2014-04-21 22:03:48 -04:00
|
|
|
USING: kernel quoting sequences splitting ;
|
2007-12-04 15:14:33 -05:00
|
|
|
IN: html.parser.utils
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
: trim1 ( seq ch -- newseq )
|
2009-01-04 12:38:25 -05:00
|
|
|
[ [ ?head-slice drop ] [ ?tail-slice drop ] bi ] 2keep drop like ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2009-01-04 12:38:25 -05:00
|
|
|
: single-quote ( str -- newstr ) "'" dup surround ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2009-01-04 12:38:25 -05:00
|
|
|
: double-quote ( str -- newstr ) "\"" dup surround ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
: quote ( str -- newstr )
|
|
|
|
CHAR: ' over member?
|
|
|
|
[ double-quote ] [ single-quote ] if ;
|
|
|
|
|
2009-01-04 12:38:25 -05:00
|
|
|
: ?quote ( str -- newstr ) dup quoted? [ quote ] unless ;
|