-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | JavaScript analysis tools
--
-- WebBits is a collection of libraries for working with JavaScript
-- embeded in HTML files. Highlights include:
--
--
-- - BrownPLT.JavaScript.Crawl returns all JavaScript in an
-- HTML page, including JavaScript from imported script files
-- (<script src=...>).
-- - BrownPLT.JavaScript.Environment annotates JavaScript
-- syntax with its static environment and returns a list of free
-- identifiers.
-- - BrownPLT.Html.Parser is a permissive HTML parser.
--
@package WebBits-Html
@version 1.0
-- | Datatypes for HTML parameterized over an annotation type and a script
-- type.
module BrownPLT.Html.Syntax
type HtmlId = String
type AttributeValue = String
data Attribute a s
Attribute :: HtmlId -> AttributeValue -> a -> Attribute a s
AttributeExpr :: a -> HtmlId -> s -> String -> Attribute a s
data Html a sc
Element :: HtmlId -> [Attribute a sc] -> [Html a sc] -> a -> Html a sc
Text :: String -> a -> Html a sc
Comment :: String -> a -> Html a sc
-- | must be a non-empty list
HtmlSeq :: [Html a sc] -> Html a sc
ProcessingInstruction :: String -> a -> Html a sc
InlineScript :: sc -> a -> String -> Html a sc
Script :: sc -> a -> Html a sc
-- | A type t of the Script class can be parsed using
-- Parsec. t is of kind '* -> *', as the parsed AST
-- should be annotated with souce locations (see SourcePos).
--
-- The big deal here is that we can embed a parser for some scripting
-- language, (e.g. Javascript) into this HTML parser with ease, while
-- preserving source locations. The Html datatype is parameterized over a
-- script parser (an instance of Script).
class Script t
prettyPrintScript :: (Script t) => t -> Doc
parseScriptBlock :: (Script t) => [Attribute SourcePos t] -> CharParser a t
parseInlineScript :: (Script t) => Maybe (CharParser a t)
parseAttributeScript :: (Script t) => Maybe (CharParser a t)
-- | Returns the value of the attribute in the list, or Nothing if
-- it doesn't exist of the value is an inline-expression.
attributeValue :: HtmlId -> [Attribute a s] -> Maybe String
attributeUpdate :: HtmlId -> (String -> String) -> [Attribute a s] -> [Attribute a s]
attributeSet :: HtmlId -> String -> [Attribute a s] -> [Attribute a s]
isAttributeExpr :: Attribute t t1 -> Bool
instance Typeable2 Html
instance Typeable2 Attribute
instance (Show a, Show sc) => Show (Html a sc)
instance (Eq a, Eq sc) => Eq (Html a sc)
instance (Data a, Data sc) => Data (Html a sc)
instance (Show a, Show s) => Show (Attribute a s)
instance (Eq a, Eq s) => Eq (Attribute a s)
instance (Data a, Data s) => Data (Attribute a s)
-- | A structure-recovering parser for malformed documents.
--
-- Copyright 2007-2008 Arjun Guha. Based on HtmlPrag 0.16 Copyright (C)
-- 2003 - 2005 Neil W. Van Dyke.
--
-- This program is Free Software; you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as
-- published by the Free Software Foundation; either version 2.1 of the
-- License, or (at your option) any later version. This program is
-- distributed in the hope that it will be useful, but without any
-- warranty; without even the implied warranty of merchantability or
-- fitness for a particular purpose. See
-- http://www.gnu.org/copyleft/lesser.html for details. For other
-- license options and consulting, contact the author.
module BrownPLT.Html.PermissiveParser
html :: (Script s) => CharParser [Warning] (Html SourcePos s)
parseHtmlFromFile :: (Script s) => String -> IO (Either ParseError (Html SourcePos s, [Warning]))
parseHtmlFromString :: (Script s) => String -> String -> Either ParseError (Html SourcePos s, [Warning])
tokens :: (Script s) => CharParser [Warning] [Token s]
data (Script s) => Token s
instance (Script s) => Show (Token s)
instance Show Warning
-- | Pretty-printer for HTML. This modules exports no names. It only
-- defines instances of PrettyPrintable for HTML.
module BrownPLT.Html.PrettyPrint
html :: (Script s) => Html a s -> Doc
renderHtml :: (Script s) => Html a s -> String
module BrownPLT.Html.Instances
instance Traversable (Html a)
instance Traversable (Attribute a)
instance Foldable (Html a)
instance Foldable (Attribute a)
instance Functor (Html a)
instance Functor (Attribute a)
module BrownPLT.Html.RawScript
data RawScript
RawScript :: String -> RawScript
parseFromFile :: Parser a -> SourceName -> IO (Either ParseError a)
parseFromString :: String -> RawHtml
type RawHtml = Html SourcePos RawScript
instance Typeable RawScript
instance Show RawScript
instance Eq RawScript
instance Data RawScript
instance Script RawScript
module BrownPLT.JavaScript.HtmlEmbedding
type JsHtml a = Html SourcePos (JavaScript a)
type ParsedJavaScript = JavaScript SourcePos
type ParsedJsHtml = JsHtml SourcePos
type ParsedStatement = Statement SourcePos
instance Script ParsedJavaScript
-- | Crawls an HTML page for JavaScript
module BrownPLT.JavaScript.Crawl
getPageJavaScript :: ParsedJsHtml -> IO [ParsedStatement]
instance Data SourcePos
instance Typeable SourcePos
-- | Rexports various modules of the HTML library. It's best to use this in
-- lieu of selectively importing the following libraries.
module BrownPLT.Html
renderHtml :: (Script s) => Html a s -> String
parseHtmlFromFile :: (Script s) => String -> IO (Either ParseError (Html SourcePos s, [Warning]))
parseHtmlFromString :: (Script s) => String -> String -> Either ParseError (Html SourcePos s, [Warning])