webbrowser: support open-url on "url-like" strings.

db4
John Benediktsson 2012-09-22 16:49:53 -07:00
parent 03a8290da9
commit ab7890911c
1 changed files with 7 additions and 1 deletions

View File

@ -1,7 +1,8 @@
! Copyright (C) 2011 John Benediktsson ! Copyright (C) 2011 John Benediktsson
! See http://factorcode.org/license.txt for BSD license ! See http://factorcode.org/license.txt for BSD license
USING: combinators present system ui.operations urls vocabs ; USING: combinators combinators.short-circuit present sequences strings system
ui.operations urls vocabs ;
IN: webbrowser IN: webbrowser
@ -17,3 +18,8 @@ HOOK: open-file os ( path -- )
>url present open-file ; >url present open-file ;
[ url? ] \ open-url H{ } define-operation [ url? ] \ open-url H{ } define-operation
PREDICATE: url-like < string
{ [ "http://" head? ] [ "https://" head? ] } 1|| ;
[ url-like? ] \ open-url H{ } define-operation