xmlhtml-0.2.5.4/ 0000755 0000000 0000000 00000000000 07346545000 011536 5 ustar 00 0000000 0000000 xmlhtml-0.2.5.4/.ghci 0000644 0000000 0000000 00000000057 07346545000 012453 0 ustar 00 0000000 0000000 :set -XOverloadedStrings
:set -Wall
:set -isrc
xmlhtml-0.2.5.4/CHANGELOG.md 0000644 0000000 0000000 00000000603 07346545000 013346 0 ustar 00 0000000 0000000 # 0.2.5.3
* Bump dependency bounds for 9.4.2.
* Fixed escaping of legacy entities (#38)
# 0.2.5
* Add renderWithOptions and the ability to control how attributes are
surrounded with quotes.
* Update to latest version of blaze-html and blaze-markup. Required bumping
the lower bound because the blaze changes were not backwards compatible.
* Switch from test-framework to hspec.
xmlhtml-0.2.5.4/LICENSE 0000644 0000000 0000000 00000003027 07346545000 012545 0 ustar 00 0000000 0000000 Copyright (c)2011, Chris Smith
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Chris Smith nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
xmlhtml-0.2.5.4/README.md 0000644 0000000 0000000 00000005260 07346545000 013020 0 ustar 00 0000000 0000000 xmlhtml - XML and HTML 5 parsing and rendering
----------------------------------------------
[](https://github.com/snapframework/xmlhtml/actions)
This library implements both parsers and renderers for XML and HTML 5 document
fragments. The two share data structures to represent the document tree, so
that you can write code to easily work with either XML or HTML 5. Convenience
functions are also available to work with the internal data structure in
several natural ways.
Caveats:
- Both parsers are written to parse document fragments, not complete
documents. This means that they do not enforce rules about overall
document structure. There does not need to be only a single root node,
and the HTML 5 implementation never inserts any missing start tags.
- The XML parser is incapable of handling processing instructions, or defined
entities. If will silently drop processing instructions, and will fail if
encounters an entity reference for anything by the predefined entities
(apos, quot, amp, lt, and gt).
- The HTML parser is really an XML parser with HTML 5 quirks mode. It should
be just fine for parsing documents that conform to the HTML 5 specification.
However, it is *not* a compliant HTML 5 parser, as compliant parsers are
required to be compatible with non-compliant documents in many ways that we
aren't interested in. So this is a great basis for a template system, for
example, but a very poor basis for a web browser or web spider.
To get started, just use the parseHTML or parseXML functions from Text.XmlHtml
to parse a ByteString into a document tree. On the other side, use render to
write the document tree back to a ByteString.
Working with document trees is easily done in two ways.
1. Text.XmlHtml exports the document tree types (notably, Document and Node)
and functions like getAttribute, setAttribute, tagName, childNodes, etc. for
working with them.
2. Text.XmlHtml.Cursor exports a zipper for node forests, which you can use to
navigate and modify the document tree positionally.
That's it, basically. This is hopefully a pretty simple package to use.
TO DO Items:
1. Do something better with character encodings. For now, they are basically
ignored, and we just use the byte order mark to distinguish between the
three required encodings. We should implement the encoding sniffing rules
for both XML (the declaration) and HTML 5.
2. Benchmark and improve performance of the parsers and renderers.
3. Ensure that rendering always gives an error rather than writing an invalid
document. (Is this a good idea? It does limit rendering speed.)
xmlhtml-0.2.5.4/Setup.hs 0000644 0000000 0000000 00000000056 07346545000 013173 0 ustar 00 0000000 0000000 import Distribution.Simple
main = defaultMain
xmlhtml-0.2.5.4/extra/ 0000755 0000000 0000000 00000000000 07346545000 012661 5 ustar 00 0000000 0000000 xmlhtml-0.2.5.4/extra/haddock.css 0000644 0000000 0000000 00000020230 07346545000 014765 0 ustar 00 0000000 0000000 /* -------- Global things --------- */
HTML {
background-color: #f0f3ff;
width: 100%;
}
BODY {
-moz-border-radius:5px;
-webkit-border-radius:5px;
width: 50em;
margin: 2em auto;
padding: 0;
background-color: #ffffff;
color: #000000;
font-size: 110%;
font-family: Georgia, serif;
}
A:link { color: #5200A3; text-decoration: none }
A:visited { color: #5200A3; text-decoration: none }
A:hover { color: #5200A3; text-decoration: none; border-bottom:#5200A3 dashed 1px; }
TABLE.vanilla {
width: 100%;
border-width: 0px;
/* I can't seem to specify cellspacing or cellpadding properly using CSS... */
}
DL {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
letter-spacing: -0.01em;
margin: 0;
}
.vanilla .vanilla dl { font-size: 80%; }
.vanilla .vanilla dl dl { padding-left: 0; font-size: 95%; }
TD.section1, TD.section2, TD.section3, TD.section4, TD.doc, DL {
padding: 0 30px 0 34px;
}
TABLE.vanilla2 {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
border-width: 0px;
}
/* font is a little too small in MSIE */
TT, PRE, CODE {
font-family: Monaco,
"DejaVu Sans Mono",
"Bitstream Vera Sans Mono",
"Lucida Console",
monospace;
font-size: 90%;
}
LI P { margin: 0pt }
P { margin-top: 0; margin-bottom: 0.75em; }
TD {
border-width: 0px;
}
TABLE.narrow {
border-width: 0px;
}
TD.s8 { height: 0; margin:0; padding: 0 }
TD.s15 { height: 20px; }
SPAN.keyword { text-decoration: underline; }
/* Resize the buttom image to match the text size */
IMG.coll { width : 0.75em; height: 0.75em; margin-bottom: 0; margin-right: 0.5em }
/* --------- Contents page ---------- */
DIV.node {
padding-left: 3em;
}
DIV.cnode {
padding-left: 1.75em;
}
SPAN.pkg {
position: absolute;
left: 50em;
}
/* --------- Documentation elements ---------- */
TD FONT { font-weight: bold; letter-spacing: -0.02em; }
TD.children {
padding-left: 25px;
}
TD.synopsis {
padding: 2px;
background-color: #f0f0f0;
font-size: 80%;
font-family: Monaco,
"DejaVu Sans Mono",
"Bitstream Vera Sans Mono",
"Lucida Console",
monospace;
}
TD.decl {
padding: 4px 8px;
background-color: #FAFAFA;
border-bottom: #F2F2F2 solid 1px;
border-top: #FCFCFC solid 1px;
font-size: 80%;
font-family: Monaco,
"DejaVu Sans Mono",
"Bitstream Vera Sans Mono",
"Lucida Console",
monospace;
vertical-align: top;
}
TD.decl TD.decl {
font-size: 100%;
padding: 4px 0;
border: 0;
}
TD.topdecl {
padding: 20px 30px 0.5ex 30px;
font-size: 80%;
font-family: Monaco,
"DejaVu Sans Mono",
"Bitstream Vera Sans Mono",
"Lucida Console",
monospace;
;
vertical-align: top;
}
.vanilla .vanilla .vanilla .topdecl {
padding-left: 0;
padding-right: 0;
}
.vanilla .vanilla .vanilla {
padding-left: 30px;
}
.decl .vanilla {
padding-left: 0px !important;
}
.body .vanilla .body {
padding-left: 0;
padding-right: 0;
}
.body .vanilla .body .decl {
padding-left: 12px;
}
.body .vanilla .body div .vanilla .decl {
padding-left: 12px;
}
TABLE.declbar {
background-color: #f0f0f0;
border-spacing: 0px;
border-bottom:1px solid #d7d7df;
border-right:1px solid #d7d7df;
border-top:1px solid #f4f4f9;
border-left:1px solid #f4f4f9;
padding: 4px;
}
TD.declname {
width: 100%;
padding-right: 4px;
}
TD.declbut {
padding-left: 8px;
padding-right: 5px;
border-left-width: 1px;
border-left-color: #000099;
border-left-style: solid;
white-space: nowrap;
font-size: x-small;
}
/*
arg is just like decl, except that wrapping is not allowed. It is
used for function and constructor arguments which have a text box
to the right, where if wrapping is allowed the text box squashes up
the declaration by wrapping it.
*/
TD.arg {
padding: 2px 12px;
background-color: #f0f0f0;
font-size: 80%;
font-family: Monaco,
"DejaVu Sans Mono",
"Bitstream Vera Sans Mono",
"Lucida Console",
monospace;
vertical-align: top;
white-space: nowrap;
}
TD.recfield { padding-left: 20px }
TD.doc {
padding-left: 38px;
font-size: 95%;
line-height: 1.66;
}
TD.ndoc {
font-size: 95%;
line-height: 1.66;
padding: 2px 4px 2px 8px;
}
TD.rdoc {
padding: 2px;
padding-left: 30px;
width: 100%;
font-size: 80%;
font-style: italic;
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
}
TD.body {
padding: 0 30px;
}
TD.pkg {
width: 100%;
padding-left: 30px
}
TABLE.indexsearch TR.indexrow {
display: none;
}
TABLE.indexsearch TR.indexshow {
display: table-row;
}
TD.indexentry {
vertical-align: top;
padding: 0 30px
}
TD.indexannot {
vertical-align: top;
padding-left: 20px;
white-space: nowrap
}
TD.indexlinks {
width: 100%
}
/* ------- Section Headings ------- */
TD.section1, TD.section2, TD.section3, TD.section4, TD.section5 {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
}
TD.section1 {
padding-top: 14px;
font-weight: bold;
letter-spacing: -0.02em;
font-size: 140%
}
TD.section2 {
padding-top: 4px;
font-weight: bold;
letter-spacing: -0.02em;
font-size: 120%
}
TD.section3 {
padding-top: 5px;
font-weight: bold;
letter-spacing: -0.02em;
font-size: 105%
}
TD.section4 {
font-weight: bold;
padding-top: 12px;
padding-bottom: 4px;
letter-spacing: -0.02em;
font-size: 90%
}
/* -------------- The title bar at the top of the page */
TD.infohead {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
color: #ffffff;
font-weight: bold;
padding: 0 30px;
text-align: left;
}
TD.infoval {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
color: #ffffff;
padding: 0 30px;
text-align: left;
}
TD.topbar {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
background-color: #3465a4;
padding: 5px;
-moz-border-radius-topleft:5px;
-moz-border-radius-topright:5px;
-webkit-border-radius-topleft:5px;
-webkit-border-radius-topright:5px;
}
TD.title {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
color: #ffffff;
padding-left: 30px;
letter-spacing: -0.02em;
font-weight: bold;
width: 100%
}
TD.topbut {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
padding-left: 5px;
padding-right: 5px;
border-left-width: 1px;
border-left-color: #ffffff;
border-left-style: solid;
letter-spacing: -0.02em;
font-weight: bold;
white-space: nowrap;
}
TD.topbut A:link {
color: #ffffff
}
TD.topbut A:visited {
color: #ffff00
}
TD.topbut A:hover {
background-color: #C9D3DE;
}
TD.topbut:hover {
background-color: #C9D3DE;
}
TD.modulebar {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
color: #141B24;
background-color: #C9D3DE;
padding: 5px;
border-top-width: 1px;
border-top-color: #ffffff;
border-top-style: solid;
-moz-border-radius-bottomleft:5px;
-moz-border-radius-bottomright:5px;
-webkit-border-radius-bottomleft:5px;
-webkit-border-radius-bottomright:5px;
}
/* --------- The page footer --------- */
TD.botbar {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
-moz-border-radius:5px;
-webkit-border-radius:5px;
background-color: #3465a4;
color: #ffffff;
padding: 5px
}
TD.botbar A:link {
color: #ffffff;
text-decoration: underline
}
TD.botbar A:visited {
color: #ffff00
}
TD.botbar A:hover {
background-color: #6060ff
}
/* --------- Mini Synopsis for Frame View --------- */
.outer {
margin: 0 0;
padding: 0 0;
}
.mini-synopsis {
padding: 0.25em 0.25em;
}
.mini-synopsis H1 { font-size: 120%; }
.mini-synopsis H2 { font-size: 107%; }
.mini-synopsis H3 { font-size: 100%; }
.mini-synopsis H1, .mini-synopsis H2, .mini-synopsis H3 {
font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
margin-top: 0.5em;
margin-bottom: 0.25em;
padding: 0 0;
font-weight: bold; letter-spacing: -0.02em;
}
.mini-synopsis H1 { border-bottom: 1px solid #ccc; }
.mini-topbar {
font-size: 120%;
background: #0077dd;
padding: 0.25em;
}
xmlhtml-0.2.5.4/extra/hscolour.css 0000644 0000000 0000000 00000000737 07346545000 015240 0 ustar 00 0000000 0000000 body { font-size: 90%; }
pre, code, body {
font-family: Monaco,
"DejaVu Sans Mono",
"Bitstream Vera Sans Mono",
"Lucida Console",
monospace;
}
.hs-keyglyph, .hs-layout {color: #5200A3;}
.hs-keyword {color: #3465a4; font-weight: bold;}
.hs-comment, .hs-comment a {color: #579; }
.hs-str, .hs-chr {color: #141B24;}
.hs-keyword, .hs-conid, .hs-varid, .hs-conop, .hs-varop, .hs-num, .hs-cpp, .hs-sel, .hs-definition {}
xmlhtml-0.2.5.4/extra/logo.gif 0000644 0000000 0000000 00000001137 07346545000 014312 0 ustar 00 0000000 0000000 GIF89a ` J"K#M%N(P1W1X3Z6\?d4e=i9i:j