diff --git a/extra/browser/analyzer/analyzer.factor b/extra/http/parser/analyzer/analyzer.factor old mode 100644 new mode 100755 similarity index 88% rename from extra/browser/analyzer/analyzer.factor rename to extra/http/parser/analyzer/analyzer.factor index 2384252e5a..8619377886 --- a/extra/browser/analyzer/analyzer.factor +++ b/extra/http/parser/analyzer/analyzer.factor @@ -1,15 +1,23 @@ USING: assocs browser.parser kernel math sequences strings ; -IN: browser.analyzer +IN: http.parser.analyzer -: remove-blank-text ( vector -- vector ) +: remove-blank-text ( vector -- vector' ) [ dup tag-name text = [ - tag-text [ blank? not ] all? + tag-text [ blank? ] all? not ] [ drop t ] if ] subset ; +: trim-text ( vector -- vector' ) + [ + dup tag-name text = [ + [ tag-text [ blank? ] trim ] keep + [ set-tag-text ] keep + ] when + ] map ; + : find-by-id ( id vector -- vector ) [ tag-attributes "id" swap at = ] curry* subset ; diff --git a/extra/browser/parser/parser-tests.factor b/extra/http/parser/parser-tests.factor similarity index 100% rename from extra/browser/parser/parser-tests.factor rename to extra/http/parser/parser-tests.factor diff --git a/extra/browser/parser/parser.factor b/extra/http/parser/parser.factor similarity index 96% rename from extra/browser/parser/parser.factor rename to extra/http/parser/parser.factor index 9ef6113e63..441094ab87 100644 --- a/extra/browser/parser/parser.factor +++ b/extra/http/parser/parser.factor @@ -1,8 +1,8 @@ -USING: arrays browser.utils hashtables io kernel namespaces -prettyprint quotations +USING: arrays http.parser.utils hashtables io kernel +namespaces prettyprint quotations sequences splitting state-parser strings ; USE: tools.interpreter -IN: browser.parser +IN: http.parser TUPLE: tag name attributes text matched? closing? ; diff --git a/extra/browser/printer/printer.factor b/extra/http/parser/printer/printer.factor similarity index 97% rename from extra/browser/printer/printer.factor rename to extra/http/parser/printer/printer.factor index a68d588afb..3df1a76991 100644 --- a/extra/browser/printer/printer.factor +++ b/extra/http/parser/printer/printer.factor @@ -1,9 +1,9 @@ -USING: assocs browser.parser browser.utils combinators +USING: assocs http.parser browser.utils combinators continuations hashtables hashtables.private io kernel math namespaces prettyprint quotations sequences splitting state-parser strings ; -IN: browser.printer +IN: http.parser.printer SYMBOL: no-section SYMBOL: html diff --git a/extra/browser/utils/utils-tests.factor b/extra/http/parser/utils/utils-tests.factor similarity index 100% rename from extra/browser/utils/utils-tests.factor rename to extra/http/parser/utils/utils-tests.factor diff --git a/extra/browser/utils/utils.factor b/extra/http/parser/utils/utils.factor similarity index 97% rename from extra/browser/utils/utils.factor rename to extra/http/parser/utils/utils.factor index 827c60d11d..d9fa5cf58a 100644 --- a/extra/browser/utils/utils.factor +++ b/extra/http/parser/utils/utils.factor @@ -3,7 +3,7 @@ hashtables.private io kernel math namespaces prettyprint quotations sequences splitting state-parser strings ; USING: browser.parser ; -IN: browser.utils +IN: http.parser.utils : string-parse-end? get-next not ;