Browse Source

CRAN fixes

master
boB Rudis 6 years ago
parent
commit
c223096055
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 8
      .travis.yml
  2. 2
      DESCRIPTION
  3. 4
      R/RcppExports.R
  4. 2
      R/htmltidy-package.r
  5. 14
      R/tidy.r
  6. 24
      R/xmltreeview.R
  7. 45
      R/xmlview.R
  8. 15
      cran-comments.md
  9. 14
      htmltidy.Rproj
  10. 2
      man/tidy_html.Rd
  11. 27
      man/xml_tree_view.Rd
  12. 38
      man/xml_view.Rd
  13. 1
      src/Makevars
  14. 18
      src/RcppExports.cpp
  15. 544
      src/access.c
  16. 8
      src/alloc.cpp
  17. 170
      src/attrs.c
  18. 28
      src/charsets.c
  19. 102
      src/clean.c
  20. 150
      src/config.c
  21. 8
      src/entities.c
  22. 56
      src/htmltidy.cpp
  23. 22
      src/init.c
  24. 22
      src/istack.c
  25. 100
      src/lexer.c
  26. 2
      src/mappedio.c
  27. 316
      src/parser.c
  28. 152
      src/pprint.c
  29. 12
      src/streamio.c
  30. 34
      src/tags.c
  31. 58
      src/tidy.h
  32. 12
      src/tidyenum.h
  33. 66
      src/tidylib.c
  34. 36
      src/tidyplatform.h
  35. 84
      src/utf8.c
  36. 792
      src/win32tc.c

8
.travis.yml

@ -6,11 +6,3 @@ r:
- oldrel
- release
- devel
notifications:
email:
- bob@rud.is
irc:
channels:
- "irc.rud.is#builds"
nick: travisci

2
DESCRIPTION

@ -1,6 +1,6 @@
Package: htmltidy
Title: Tidy Up and Test XPath Queries on HTML and XML Content
Version: 0.3.2
Version: 0.4.0
Encoding: UTF-8
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")),

4
R/RcppExports.R

@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
tidy_html_int <- function(source, options, show_errors) {
.Call('htmltidy_tidy_html_int', PACKAGE = 'htmltidy', source, options, show_errors)
do_the_tidy <- function(source, options, show_errors) {
.Call(`_htmltidy_do_the_tidy`, source, options, show_errors)
}

2
R/htmltidy-package.r

@ -19,7 +19,7 @@
#' @name htmltidy
#' @docType package
#' @author Bob Rudis (bob@@rud.is)
#' @useDynLib htmltidy, .registration=TRUE
#' @importFrom Rcpp sourceCpp
#' @import xml2 XML htmlwidgets htmltools
#' @useDynLib htmltidy, .registration=TRUE
NULL

14
R/tidy.r

@ -70,6 +70,7 @@
#'
#' cat(tidy_html(txt, option=opts))
#'
#' \dontrun{
#' library(httr)
#' res <- GET("https://rud.is/test/untidy.html")
#'
@ -82,6 +83,7 @@
#'
#' # but, you could also just do:
#' cat(tidy_html(url("https://rud.is/test/untidy.html")))
#' }
tidy_html <- function(content, options=list(TidyXhtmlOut=TRUE), verbose=FALSE) {
UseMethod("tidy_html")
}
@ -91,7 +93,7 @@ tidy_html <- function(content, options=list(TidyXhtmlOut=TRUE), verbose=FALSE) {
tidy_html.default <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) {
content <- paste0(content, collapse="")
.Call('htmltidy_tidy_html_int', PACKAGE='htmltidy',
.Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose)
}
@ -100,7 +102,7 @@ tidy_html.default <- function(content, options=list(TidyXhtmlOut=TRUE),
tidy_html.character <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) {
content <- paste0(content, collapse="")
.Call('htmltidy_tidy_html_int', PACKAGE='htmltidy',
.Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose)
}
@ -110,7 +112,7 @@ tidy_html.raw <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) {
content <- content[1]
content <- iconv(readBin(content, character()), to="UTF-8")
out <- .Call('htmltidy_tidy_html_int', PACKAGE='htmltidy',
out <- .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose)
charToRaw(out)
}
@ -120,7 +122,7 @@ tidy_html.raw <- function(content, options=list(TidyXhtmlOut=TRUE),
tidy_html.xml_document <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) {
content <- toString(content)
out <- .Call('htmltidy_tidy_html_int', PACKAGE='htmltidy',
out <- .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose)
xml2::read_html(out)
}
@ -130,7 +132,7 @@ tidy_html.xml_document <- function(content, options=list(TidyXhtmlOut=TRUE),
tidy_html.HTMLInternalDocument <- function(content, options=list(TidyXhtmlOut=TRUE),
verbose=FALSE) {
content <- XML::saveXML(content)
out <- .Call('htmltidy_tidy_html_int', PACKAGE='htmltidy',
out <- .Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=content, options=options, show_errors=verbose)
XML::htmlParse(out)
}
@ -143,7 +145,7 @@ tidy_html.connection <- function(content, options=list(TidyXhtmlOut=TRUE),
html <- paste0(readLines(content, warn=FALSE), collapse="")
close(content)
.Call('htmltidy_tidy_html_int', PACKAGE='htmltidy',
.Call('_htmltidy_do_the_tidy', PACKAGE='htmltidy',
source=html, options=options, show_errors=verbose)
}

24
R/xmltreeview.R

@ -11,7 +11,6 @@
#' Default is \code{FALSE} (take up the full viewer/browser window). If
#' this is set to \code{TRUE}, \code{height} should be set to a value
#' other than \code{NULL}.
#' @param elementId element id
#' @param width widget \code{div} width
#' @param height widget \code{div} height
#' @note Large HTML or XML content may take some time to render properly. It is suggested
@ -20,22 +19,12 @@
#' @export
#' @references \href{https://github.com/juliangruber/xml-viewer}{xml-viewer}
#' @examples
#' if (interactive()) {
#'
#' # from ?xml2::read_xml
#' cd <- xml2::read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml")
#'
#' xml_tree_view(cd)
#'
#' htmltools::browsable(
#' htmltools::tagList(
#' xml_tree_view(cd, width = "100%", height = "300px"),
#' xml_view(cd)
#' )
#' )
#' if(interactive()) {
#' txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
#' "<body>Don't forget me this weekend!</body></note>")
#' # xml_tree_view(txt)
#' }
xml_tree_view <- function(doc=NULL, scroll=FALSE,
elementId=NULL, width="100%", height=NULL) {
xml_tree_view <- function(doc=NULL, scroll=FALSE, width="100%", height=NULL) {
if (inherits(doc, "character")) {
doc <- paste0(doc, collapse="")
@ -59,8 +48,7 @@ xml_tree_view <- function(doc=NULL, scroll=FALSE,
x = params,
width = width,
height = height,
package = 'htmltidy',
elementId = elementId
package = 'htmltidy'
)
}

45
R/xmlview.R

@ -17,7 +17,6 @@
#' @param apply_xpath Add and apply an XPath query string to the view. If
#' \code{add_filter} is \code{TRUE} then this query string will
#' appear in the filter box and be applied to the passed in document.
#' @param elementId element id
#' @param width widget width (best to keep it at 100\%)
#' @param height widget height (kinda only useful for knitting since this is
#' meant to be an interactive tool).
@ -29,43 +28,12 @@
#' \href{http://www.eslinstructor.net/vkbeautify/}{vkbeautify}
#' @examples
#' if (interactive()) {
#' library(xml2)
#'
#' # plain text
#' txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
#' "<body>Don't forget me this weekend!</body></note>")
#' xml_view(txt)
#'
#' # xml object
#' doc <- read_xml(txt)
#' xml_view(doc, style="obsidian")
#'
#' # different style
#' xml_view(xml_find_all(doc, ".//to"), style="github-gist")
#'
#' # some more complex daata
#' xml_view(read_xml(system.file("extdata/dwml.xml", package="htmltidy")))
#' xml_view(read_xml(system.file("extdata/getHistory.xml", package="htmltidy")),
#' "androidstudio")
#' xml_view(read_xml(system.file("extdata/input.xml", package="htmltidy")),
#' "sunburst")
#'
#' # filter + apply an initial XPath query string
#' xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")),
#' add_filter=TRUE, apply_xpath=".//temperature")
#'
#' doc <- read_xml("http://www.npr.org/rss/rss.php?id=1001")
#'
#' str(doc)
#'
#' xml_view(doc, add_filter=TRUE)
#' xml2::xml_find_all(doc, './/dc:creator', ns=xml2::xml_ns(doc))
#'
#' xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ns(doc)))
#' # xml_view(txt)
#' }
xml_view <- function(doc, style="default", scroll=FALSE, add_filter=FALSE,
apply_xpath=NULL, elementId=NULL,
width="100%", height=NULL) {
apply_xpath = NULL, width="100%", height=NULL) {
xml_doc_name <- "doc"
@ -94,17 +62,16 @@ xml_view <- function(doc, style="default", scroll=FALSE, add_filter=FALSE,
styleSheet = style,
addFilter = add_filter,
applyXPath = apply_xpath,
scroll=scroll,
xmlDocName=xml_doc_name
scroll = scroll,
xmlDocName = xml_doc_name
)
htmlwidgets::createWidget(
name = 'xmlview',
params,
x = params,
width = width,
height = height,
package = 'htmltidy',
elementId = elementId
package = 'htmltidy'
)
}

15
cran-comments.md

@ -1,15 +1,20 @@
## Test environments
* local OS X install, R 3.3.2 (clang)
* ubuntu 12.04 (on travis-ci), oldrel, release & devel
* local OS X install, R 3.4.1 (clang)
* ubuntu 14.04 (on travis-ci), oldrel, release & devel
* win-builder (devel and release)
* AppVeyor
## R CMD check results
0 errors | 0 warnings | 1 notes (names)
0 errors | 0 warnings | 0 notes
---
Fix per note from CRAN regarding checks tossing warnings
due to URL redirection.
Fix per note from CRAN regarding
checks failing, htmltidy C[++]
code has been updated and examples
that required internet access to
successfully complete have been
re-worked to use the system.file()
package exmaple files.

14
htmltidy.Rproj

@ -5,21 +5,19 @@ SaveWorkspace: No
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
UseSpacesForTab: Yes
NumSpacesForTab: 2
RnwWeave: Sweave
LaTeX: pdfLaTeX
PackageBuildArgs: --resave-data
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace

2
man/tidy_html.Rd

@ -109,6 +109,7 @@ txt <- paste0(
cat(tidy_html(txt, option=opts))
\dontrun{
library(httr)
res <- GET("https://rud.is/test/untidy.html")
@ -122,6 +123,7 @@ cat(tidy_html(content(res, as="text", encoding="UTF-8"),
# but, you could also just do:
cat(tidy_html(url("https://rud.is/test/untidy.html")))
}
}
\references{
\url{http://api.html-tidy.org/tidy/quickref_5.1.25.html} &
\url{https://github.com/htacg/tidy-html5/blob/master/include/tidyenum.h}

27
man/xml_tree_view.Rd

@ -5,11 +5,11 @@
\alias{html_tree_view}
\title{HTML/XML tree viewer}
\usage{
xml_tree_view(doc = NULL, scroll = FALSE, elementId = NULL,
width = "100\%", height = NULL)
xml_tree_view(doc = NULL, scroll = FALSE, width = "100\%",
height = NULL)
html_tree_view(doc = NULL, scroll = FALSE, elementId = NULL,
width = "100\%", height = NULL)
html_tree_view(doc = NULL, scroll = FALSE, width = "100\%",
height = NULL)
}
\arguments{
\item{doc}{\code{xml2} document/node/nodeset, an \code{HTMLInternalDocument}/
@ -21,8 +21,6 @@ Default is \code{FALSE} (take up the full viewer/browser window). If
this is set to \code{TRUE}, \code{height} should be set to a value
other than \code{NULL}.}
\item{elementId}{element id}
\item{width}{widget \code{div} width}
\item{height}{widget \code{div} height}
@ -38,19 +36,10 @@ Large HTML or XML content may take some time to render properly. It is suggested
or used in a browser context vs an IDE viewer context.
}
\examples{
if (interactive()) {
# from ?xml2::read_xml
cd <- xml2::read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml")
xml_tree_view(cd)
htmltools::browsable(
htmltools::tagList(
xml_tree_view(cd, width = "100\%", height = "300px"),
xml_view(cd)
)
)
if(interactive()) {
txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
"<body>Don't forget me this weekend!</body></note>")
# xml_tree_view(txt)
}
}
\references{

38
man/xml_view.Rd

@ -6,10 +6,10 @@
\title{HTML/XML pretty printer and viewer}
\usage{
xml_view(doc, style = "default", scroll = FALSE, add_filter = FALSE,
apply_xpath = NULL, elementId = NULL, width = "100\%", height = NULL)
apply_xpath = NULL, width = "100\%", height = NULL)
html_view(doc, style = "default", scroll = FALSE, add_filter = FALSE,
apply_xpath = NULL, elementId = NULL, width = "100\%", height = NULL)
apply_xpath = NULL, width = "100\%", height = NULL)
}
\arguments{
\item{doc}{\code{xml2} document/node/nodeset, an \code{HTMLInternalDocument}/
@ -30,8 +30,6 @@ other than \code{NULL}.}
\code{add_filter} is \code{TRUE} then this query string will
appear in the filter box and be applied to the passed in document.}
\item{elementId}{element id}
\item{width}{widget width (best to keep it at 100\%)}
\item{height}{widget height (kinda only useful for knitting since this is
@ -49,39 +47,9 @@ Large HTML or XML content may take some time to render properly. It is suggested
}
\examples{
if (interactive()) {
library(xml2)
# plain text
txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
"<body>Don't forget me this weekend!</body></note>")
xml_view(txt)
# xml object
doc <- read_xml(txt)
xml_view(doc, style="obsidian")
# different style
xml_view(xml_find_all(doc, ".//to"), style="github-gist")
# some more complex daata
xml_view(read_xml(system.file("extdata/dwml.xml", package="htmltidy")))
xml_view(read_xml(system.file("extdata/getHistory.xml", package="htmltidy")),
"androidstudio")
xml_view(read_xml(system.file("extdata/input.xml", package="htmltidy")),
"sunburst")
# filter + apply an initial XPath query string
xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")),
add_filter=TRUE, apply_xpath=".//temperature")
doc <- read_xml("http://www.npr.org/rss/rss.php?id=1001")
str(doc)
xml_view(doc, add_filter=TRUE)
xml2::xml_find_all(doc, './/dc:creator', ns=xml2::xml_ns(doc))
xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ns(doc)))
# xml_view(txt)
}
}
\references{

1
src/Makevars

@ -1,2 +1,3 @@
PKG_CPPFLAGS = -I.
PKG_CXXFLAGS = -I.
PKG_LIBS = -L.

18
src/RcppExports.cpp

@ -5,16 +5,26 @@
using namespace Rcpp;
// tidy_html_int
Rcpp::CharacterVector tidy_html_int(std::string source, Rcpp::List options, bool show_errors);
RcppExport SEXP htmltidy_tidy_html_int(SEXP sourceSEXP, SEXP optionsSEXP, SEXP show_errorsSEXP) {
// do_the_tidy
Rcpp::CharacterVector do_the_tidy(std::string source, Rcpp::List options, bool show_errors);
RcppExport SEXP _htmltidy_do_the_tidy(SEXP sourceSEXP, SEXP optionsSEXP, SEXP show_errorsSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< std::string >::type source(sourceSEXP);
Rcpp::traits::input_parameter< Rcpp::List >::type options(optionsSEXP);
Rcpp::traits::input_parameter< bool >::type show_errors(show_errorsSEXP);
rcpp_result_gen = Rcpp::wrap(tidy_html_int(source, options, show_errors));
rcpp_result_gen = Rcpp::wrap(do_the_tidy(source, options, show_errors));
return rcpp_result_gen;
END_RCPP
}
static const R_CallMethodDef CallEntries[] = {
{"_htmltidy_do_the_tidy", (DL_FUNC) &_htmltidy_do_the_tidy, 3},
{NULL, NULL, 0}
};
RcppExport void R_init_htmltidy(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}

544
src/access.c

File diff suppressed because it is too large

8
src/alloc.cpp

@ -25,22 +25,22 @@ static TidyPanic g_panic = NULL;
Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc )
{
g_malloc = fmalloc;
return yes;
return aye;
}
Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc )
{
g_realloc = frealloc;
return yes;
return aye;
}
Bool TIDY_CALL tidySetFreeCall( TidyFree ffree )
{
g_free = ffree;
return yes;
return aye;
}
Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic )
{
g_panic = fpanic;
return yes;
return aye;
}
static void TIDY_CALL defaultPanic( TidyAllocator* ARG_UNUSED(allocator), ctmbstr msg )

170
src/attrs.c

@ -96,43 +96,43 @@ static AttrCheck CheckRDFaPrefix;
static const Attribute attribute_defs [] =
{
{ TidyAttr_UNKNOWN, "unknown!", NULL },
{ TidyAttr_ABBR, "abbr", CH_PCDATA },
{ TidyAttr_ACCEPT, "accept", CH_XTYPE },
{ TidyAttr_ACCEPT_CHARSET, "accept-charset", CH_CHARSET },
{ TidyAttr_ACCESSKEY, "accesskey", CH_CHARACTER },
{ TidyAttr_ACTION, "action", CH_ACTION },
{ TidyAttr_UNKNOWN, "unknown!", NULL },
{ TidyAttr_ABBR, "abbr", CH_PCDATA },
{ TidyAttr_ACCEPT, "accept", CH_XTYPE },
{ TidyAttr_ACCEPT_CHARSET, "accept-charset", CH_CHARSET },
{ TidyAttr_ACCESSKEY, "accesskey", CH_CHARACTER },
{ TidyAttr_ACTION, "action", CH_ACTION },
{ TidyAttr_ADD_DATE, "add_date", CH_PCDATA }, /* A */
{ TidyAttr_ALIGN, "align", CH_ALIGN }, /* varies by element */
{ TidyAttr_ALINK, "alink", CH_COLOR },
{ TidyAttr_ALINK, "alink", CH_COLOR },
{ TidyAttr_ALLOWFULLSCREEN, "allowfullscreen", CH_BOOL },
{ TidyAttr_ALT, "alt", CH_PCDATA }, /* nowrap */
{ TidyAttr_ARCHIVE, "archive", CH_URLS }, /* space or comma separated list */
{ TidyAttr_AXIS, "axis", CH_PCDATA },
{ TidyAttr_BACKGROUND, "background", CH_URL },
{ TidyAttr_BGCOLOR, "bgcolor", CH_COLOR },
{ TidyAttr_AXIS, "axis", CH_PCDATA },
{ TidyAttr_BACKGROUND, "background", CH_URL },
{ TidyAttr_BGCOLOR, "bgcolor", CH_COLOR },
{ TidyAttr_BGPROPERTIES, "bgproperties", CH_PCDATA }, /* BODY "fixed" fixes background */
{ TidyAttr_BORDER, "border", CH_BORDER }, /* like LENGTH + "border" */
{ TidyAttr_BORDERCOLOR, "bordercolor", CH_COLOR }, /* used on TABLE */
{ TidyAttr_BOTTOMMARGIN, "bottommargin", CH_NUMBER }, /* used on BODY */
{ TidyAttr_CELLPADDING, "cellpadding", CH_LENGTH }, /* % or pixel values */
{ TidyAttr_CELLSPACING, "cellspacing", CH_LENGTH },
{ TidyAttr_CHAR, "char", CH_CHARACTER },
{ TidyAttr_CHAROFF, "charoff", CH_LENGTH },
{ TidyAttr_CHARSET, "charset", CH_CHARSET },
{ TidyAttr_CELLSPACING, "cellspacing", CH_LENGTH },
{ TidyAttr_CHAR, "char", CH_CHARACTER },
{ TidyAttr_CHAROFF, "charoff", CH_LENGTH },
{ TidyAttr_CHARSET, "charset", CH_CHARSET },
{ TidyAttr_CHECKED, "checked", CH_BOOL }, /* i.e. "checked" or absent */
{ TidyAttr_CITE, "cite", CH_URL },
{ TidyAttr_CLASS, "class", CH_PCDATA },
{ TidyAttr_CLASSID, "classid", CH_URL },
{ TidyAttr_CITE, "cite", CH_URL },
{ TidyAttr_CLASS, "class", CH_PCDATA },
{ TidyAttr_CLASSID, "classid", CH_URL },
{ TidyAttr_CLEAR, "clear", CH_CLEAR }, /* BR: left, right, all */
{ TidyAttr_CODE, "code", CH_PCDATA }, /* APPLET */
{ TidyAttr_CODEBASE, "codebase", CH_URL }, /* OBJECT */
{ TidyAttr_CODETYPE, "codetype", CH_XTYPE }, /* OBJECT */
{ TidyAttr_COLOR, "color", CH_COLOR }, /* BASEFONT, FONT */
{ TidyAttr_COLS, "cols", CH_COLS }, /* TABLE & FRAMESET */
{ TidyAttr_COLSPAN, "colspan", CH_NUMBER },
{ TidyAttr_COLSPAN, "colspan", CH_NUMBER },
{ TidyAttr_COMPACT, "compact", CH_BOOL }, /* lists */
{ TidyAttr_CONTENT, "content", CH_PCDATA },
{ TidyAttr_CONTENT, "content", CH_PCDATA },
{ TidyAttr_COORDS, "coords", CH_COORDS }, /* AREA, A */
{ TidyAttr_DATA, "data", CH_URL }, /* OBJECT */
{ TidyAttr_DATAFLD, "datafld", CH_PCDATA }, /* used on DIV, IMG */
@ -150,7 +150,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_FOR, "for", CH_IDREF }, /* LABEL */
{ TidyAttr_FRAME, "frame", CH_TFRAME }, /* TABLE */
{ TidyAttr_FRAMEBORDER, "frameborder", CH_FBORDER }, /* 0 or 1 */
{ TidyAttr_FRAMESPACING, "framespacing", CH_NUMBER },
{ TidyAttr_FRAMESPACING, "framespacing", CH_NUMBER },
{ TidyAttr_GRIDX, "gridx", CH_NUMBER }, /* TABLE Adobe golive*/
{ TidyAttr_GRIDY, "gridy", CH_NUMBER }, /* TABLE Adobe golive */
{ TidyAttr_HEADERS, "headers", CH_IDREFS }, /* table cells */
@ -159,7 +159,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_HREFLANG, "hreflang", CH_LANG }, /* A, LINK */
{ TidyAttr_HSPACE, "hspace", CH_NUMBER }, /* APPLET, IMG, OBJECT */
{ TidyAttr_HTTP_EQUIV, "http-equiv", CH_PCDATA }, /* META */
{ TidyAttr_ID, "id", CH_IDDEF },
{ TidyAttr_ID, "id", CH_IDDEF },
{ TidyAttr_ISMAP, "ismap", CH_BOOL }, /* IMG */
{ TidyAttr_ITEMID, "itemid", CH_PCDATA },
{ TidyAttr_ITEMPROP, "itemprop", CH_PCDATA },
@ -167,7 +167,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_ITEMSCOPE, "itemscope", CH_BOOL },
{ TidyAttr_ITEMTYPE, "itemtype", CH_URL },
{ TidyAttr_LABEL, "label", CH_PCDATA }, /* OPT, OPTGROUP */
{ TidyAttr_LANG, "lang", CH_LANG },
{ TidyAttr_LANG, "lang", CH_LANG },
{ TidyAttr_LANGUAGE, "language", CH_PCDATA }, /* SCRIPT */
{ TidyAttr_LAST_MODIFIED, "last_modified", CH_PCDATA }, /* A */
{ TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */
@ -181,21 +181,21 @@ static const Attribute attribute_defs [] =
{ TidyAttr_MEDIA, "media", CH_MEDIA }, /* STYLE, LINK */
{ TidyAttr_METHOD, "method", CH_FSUBMIT }, /* FORM: get or post */
{ TidyAttr_MULTIPLE, "multiple", CH_BOOL }, /* SELECT */
{ TidyAttr_NAME, "name", CH_NAME },
{ TidyAttr_NAME, "name", CH_NAME },
{ TidyAttr_NOHREF, "nohref", CH_BOOL }, /* AREA */
{ TidyAttr_NORESIZE, "noresize", CH_BOOL }, /* FRAME */
{ TidyAttr_NOSHADE, "noshade", CH_BOOL }, /* HR */
{ TidyAttr_NOWRAP, "nowrap", CH_BOOL }, /* table cells */
{ TidyAttr_OBJECT, "object", CH_PCDATA }, /* APPLET */
{ TidyAttr_OnAFTERUPDATE, "onafterupdate", CH_SCRIPT },
{ TidyAttr_OnBEFOREUNLOAD, "onbeforeunload", CH_SCRIPT },
{ TidyAttr_OnBEFOREUPDATE, "onbeforeupdate", CH_SCRIPT },
{ TidyAttr_OnAFTERUPDATE, "onafterupdate", CH_SCRIPT },
{ TidyAttr_OnBEFOREUNLOAD, "onbeforeunload", CH_SCRIPT },
{ TidyAttr_OnBEFOREUPDATE, "onbeforeupdate", CH_SCRIPT },
{ TidyAttr_OnBLUR, "onblur", CH_SCRIPT }, /* event */
{ TidyAttr_OnCHANGE, "onchange", CH_SCRIPT }, /* event */
{ TidyAttr_OnCLICK, "onclick", CH_SCRIPT }, /* event */
{ TidyAttr_OnDATAAVAILABLE, "ondataavailable", CH_SCRIPT }, /* object, applet */
{ TidyAttr_OnDATASETCHANGED, "ondatasetchanged", CH_SCRIPT }, /* object, applet */
{ TidyAttr_OnDATASETCOMPLETE, "ondatasetcomplete", CH_SCRIPT },
{ TidyAttr_OnDATASETCOMPLETE, "ondatasetcomplete", CH_SCRIPT },
{ TidyAttr_OnDBLCLICK, "ondblclick", CH_SCRIPT }, /* event */
{ TidyAttr_OnERRORUPDATE, "onerrorupdate", CH_SCRIPT }, /* form fields */
{ TidyAttr_OnFOCUS, "onfocus", CH_SCRIPT }, /* event */
@ -218,8 +218,8 @@ static const Attribute attribute_defs [] =
{ TidyAttr_PROMPT, "prompt", CH_PCDATA }, /* ISINDEX */
{ TidyAttr_RBSPAN, "rbspan", CH_NUMBER }, /* ruby markup */
{ TidyAttr_READONLY, "readonly", CH_BOOL }, /* form fields */
{ TidyAttr_REL, "rel", CH_LINKTYPES },
{ TidyAttr_REV, "rev", CH_LINKTYPES },
{ TidyAttr_REL, "rel", CH_LINKTYPES },
{ TidyAttr_REV, "rev", CH_LINKTYPES },
{ TidyAttr_RIGHTMARGIN, "rightmargin", CH_NUMBER }, /* used on BODY */
{ TidyAttr_ROLE, "role", CH_PCDATA },
{ TidyAttr_ROWS, "rows", CH_NUMBER }, /* TEXTAREA */
@ -227,7 +227,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_RULES, "rules", CH_TRULES }, /* TABLE */
{ TidyAttr_SCHEME, "scheme", CH_PCDATA }, /* META */
{ TidyAttr_SCOPE, "scope", CH_SCOPE }, /* table cells */
{ TidyAttr_SCROLLING, "scrolling", CH_SCROLL }, /* yes, no or auto */
{ TidyAttr_SCROLLING, "scrolling", CH_SCROLL }, /* aye, no or auto */
{ TidyAttr_SELECTED, "selected", CH_BOOL }, /* OPTION */
{ TidyAttr_SHAPE, "shape", CH_SHAPE }, /* AREA, A */
{ TidyAttr_SHOWGRID, "showgrid", CH_BOOL }, /* TABLE Adobe golive */
@ -239,7 +239,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_SRCSET, "srcset", CH_PCDATA }, /* IMG (HTML5) */
{ TidyAttr_STANDBY, "standby", CH_PCDATA }, /* OBJECT */
{ TidyAttr_START, "start", CH_NUMBER }, /* OL */
{ TidyAttr_STYLE, "style", CH_PCDATA },
{ TidyAttr_STYLE, "style", CH_PCDATA },
{ TidyAttr_SUMMARY, "summary", CH_PCDATA }, /* TABLE */
{ TidyAttr_TABINDEX, "tabindex", CH_NUMBER }, /* fields, OBJECT and A */
{ TidyAttr_TARGET, "target", CH_TARGET }, /* names a frame/window */
@ -249,8 +249,8 @@ static const Attribute attribute_defs [] =
{ TidyAttr_TRANSLATE, "translate", CH_BOOL }, /* HTML5 global attribute */
{ TidyAttr_TYPE, "type", CH_TYPE }, /* also used by SPACER */
{ TidyAttr_USEMAP, "usemap", CH_URL }, /* things with images */
{ TidyAttr_VALIGN, "valign", CH_VALIGN },
{ TidyAttr_VALUE, "value", CH_PCDATA },
{ TidyAttr_VALIGN, "valign", CH_VALIGN },
{ TidyAttr_VALUE, "value", CH_PCDATA },
{ TidyAttr_VALUETYPE, "valuetype", CH_VTYPE }, /* PARAM: data, ref, object */
{ TidyAttr_VERSION, "version", CH_PCDATA }, /* HTML <?xml?> */
{ TidyAttr_VLINK, "vlink", CH_COLOR }, /* BODY */
@ -501,7 +501,7 @@ Bool TY_(AttributeIsProprietary)(Node* node, AttVal* attval)
if (AttributeVersions(node, attval) & VERS_ALL)
return no;
return yes;
return aye;
}
/* returns true if the element is a W3C defined element
@ -513,13 +513,13 @@ Bool TY_(AttributeIsProprietary)(Node* node, AttVal* attval)
Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc)
{
uint doctype;
if (!node || !attval)
return no;
if (!node->tag)
return no;
if (!(node->tag->versions & VERS_ALL))
return no;
@ -527,8 +527,8 @@ Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc)
if (AttributeVersions(node, attval) & doctype)
return no;
return yes;
return aye;
}
@ -770,7 +770,7 @@ static void attrsRemoveFromHash( TidyDocImpl* doc, TidyAttribImpl *attribs,
{
AttrHash* next = p->next;
if ( prev )
prev->next = next;
prev->next = next;
else
attribs->hashtab[h] = next;
TidyDocFree(doc, p);
@ -877,7 +877,7 @@ void TY_(DropAttrByName)( TidyDocImpl* doc, Node *node, ctmbstr name )
else
node->attributes = next;
TY_(FreeAttribute)( doc, attr );
TY_(FreeAttribute)( doc, attr );
break;
}
}
@ -955,7 +955,7 @@ Bool TY_(IsAnchorElement)( TidyDocImpl* ARG_UNUSED(doc), Node* node)
tid == TidyTag_IFRAME ||
tid == TidyTag_IMG ||
tid == TidyTag_MAP )
return yes;
return aye;
return no;
}
@ -976,7 +976,7 @@ Bool TY_(IsAnchorElement)( TidyDocImpl* ARG_UNUSED(doc), Node* node)
*/
Bool TY_(IsCSS1Selector)( ctmbstr buf )
{
Bool valid = yes;
Bool valid = aye;
int esclen = 0;
byte c;
int pos;
@ -1021,7 +1021,7 @@ static uint anchorNameHash(ctmbstr s)
{
uint hashval = 0;
/* Issue #149 - an inferred name can be null. avoid crash */
if (s)
if (s)
{
for ( ; *s != '\0'; s++) {
tmbchar c = TY_(ToLower)( *s );
@ -1040,7 +1040,7 @@ static uint anchorNameHash5(ctmbstr s)
{
uint hashval = 0;
/* Issue #149 - an inferred name can be null. avoid crash */
if (s)
if (s)
{
for ( ; *s != '\0'; s++) {
tmbchar c = *s;
@ -1051,8 +1051,8 @@ static uint anchorNameHash5(ctmbstr s)
}
/*\
* removes anchor for specific node
/*\
* removes anchor for specific node
* Issue #185 - Treat elements ids as case-sensitive
* if in HTML5 modes, make hash of value AS IS!
\*/
@ -1096,7 +1096,7 @@ static Anchor* NewAnchor( TidyDocImpl* doc, ctmbstr name, Node* node )
}
/*\
* add new anchor to namespace
* add new anchor to namespace
* Issue #185 - Treat elements ids as case-sensitive
* if in HTML5 modes, make hash of value AS IS!
\*/
@ -1124,7 +1124,7 @@ static Anchor* AddAnchor( TidyDocImpl* doc, ctmbstr name, Node *node )
}
/*\
* return node associated with anchor
* return node associated with anchor
* Issue #185 - Treat elements ids as case-sensitive
* if in HTML5 modes, make hash of value AS IS!
\*/
@ -1148,7 +1148,7 @@ static Node* GetNodeByAnchor( TidyDocImpl* doc, ctmbstr name )
if ( TY_(tmbstrcmp)(found->name, lname) == 0 )
break;
}
TidyDocFree(doc, lname);
if ( found )
return found->node;
@ -1350,7 +1350,7 @@ void TY_(RepairDuplicateAttributes)( TidyDocImpl* doc, Node *node, Bool isXml )
temp = first->next;
TY_(ReportAttrError)( doc, node, first, REPEATED_ATTRIBUTE);
TY_(RemoveAttribute)( doc, node, first );
firstRedefined = yes;
firstRedefined = aye;
first = temp;
second = second->next;
}
@ -1376,16 +1376,16 @@ const Attribute* TY_(CheckAttribute)( TidyDocImpl* doc, Node *node, AttVal *attv
{
if (attrIsXML_LANG(attval) || attrIsXML_SPACE(attval))
{
doc->lexer->isvoyager = yes;
doc->lexer->isvoyager = aye;
if (!cfgBool(doc, TidyHtmlOut))
{
TY_(SetOptionBool)(doc, TidyXhtmlOut, yes);
TY_(SetOptionBool)(doc, TidyXmlOut, yes);
TY_(SetOptionBool)(doc, TidyXhtmlOut, aye);
TY_(SetOptionBool)(doc, TidyXmlOut, aye);
}
}
TY_(ConstrainVersion)(doc, AttributeVersions(node, attval));
if (attribute->attrchk)
attribute->attrchk( doc, node, attval );
}
@ -1397,7 +1397,7 @@ Bool TY_(IsBoolAttribute)(AttVal *attval)
{
const Attribute *attribute = ( attval ? attval->dict : NULL );
if ( attribute && attribute->attrchk == CH_BOOL )
return yes;
return aye;
return no;
}
@ -1438,17 +1438,17 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
{
tmbstr p;
Bool hasUpper = no;
if (!AttrHasValue(attval))
return;
p = attval->value;
while (*p)
{
if (TY_(IsUpper)(*p)) /* #501230 - fix by Terry Teague - 09 Jan 02 */
{
hasUpper = yes;
hasUpper = aye;
break;
}
p++;
@ -1459,7 +1459,7 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
Lexer* lexer = doc->lexer;
if (lexer->isvoyager)
TY_(ReportAttrError)( doc, node, attval, ATTR_VALUE_NOT_LCASE);
if ( lexer->isvoyager || cfgBool(doc, TidyLowerLiterals) )
attval->value = TY_(tmbstrtolower)(attval->value);
}
@ -1469,13 +1469,13 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
{
tmbchar c;
tmbchar c;
tmbstr dest, p;
uint escape_count = 0, backslash_count = 0;
uint i, pos = 0;
uint len;
Bool isJavascript = no;
if (!AttrHasValue(attval))
{
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
@ -1483,7 +1483,7 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
}
p = attval->value;
isJavascript =
TY_(tmbstrncmp)(p,"javascript:",sizeof("javascript:")-1)==0;
@ -1504,7 +1504,7 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
Bool hadnonspace = no;
len = TY_(tmbstrlen)(p) + escape_count * 2 + 1;
dest = (tmbstr) TidyDocAlloc(doc, len);
for (i = 0; 0 != (c = p[i]); ++i)
{
if ((c > 0x7e) || (c <= 0x20) || (strchr("<>", c)))
@ -1518,12 +1518,12 @@ void TY_(CheckUrl)( TidyDocImpl* doc, Node *node, AttVal *attval)
else
{
pos += sprintf( dest + pos, "%%%02X", (byte)c );
hadnonspace = yes;
hadnonspace = aye;
}
}
else
{
hadnonspace = yes;
hadnonspace = aye;
dest[pos++] = c;
}
}
@ -1578,7 +1578,7 @@ Bool TY_(IsValidHTMLID)(ctmbstr id)
if (TY_(IsHTMLSpace)(*s++))
return no;
return yes;
return aye;
}
@ -1610,7 +1610,7 @@ Bool TY_(IsValidXMLID)(ctmbstr id)
return no;
}
return yes;
return aye;
}
static Bool IsValidNMTOKEN(ctmbstr name)
@ -1634,15 +1634,15 @@ static Bool IsValidNMTOKEN(ctmbstr name)
return no;
}
return yes;
return aye;
}
static Bool AttrValueIsAmong(AttVal *attval, ctmbstr const list[])
{
const ctmbstr *v;
const ctmbstr *v;
for (v = list; *v; ++v)
if (AttrValueIs(attval, *v))
return yes;
return aye;
return no;
}
@ -1789,7 +1789,7 @@ void CheckValign( TidyDocImpl* doc, Node *node, AttVal *attval)
void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval)
{
tmbstr p;
if (!AttrHasValue(attval))
{
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
@ -1801,7 +1801,7 @@ void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval)
return;
p = attval->value;
if (!TY_(IsDigit)(*p++))
{
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
@ -1858,7 +1858,7 @@ void CheckClear( TidyDocImpl* doc, Node *node, AttVal *attval)
}
CheckLowerCaseAttrValue( doc, node, attval );
if (!AttrValueIsAmong(attval, values))
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
}
@ -1878,7 +1878,7 @@ void CheckScope( TidyDocImpl* doc, Node *node, AttVal *attval)
void CheckNumber( TidyDocImpl* doc, Node *node, AttVal *attval)
{
tmbstr p;
if (!AttrHasValue(attval))
{
TY_(ReportAttrError)( doc, node, attval, MISSING_ATTR_VALUE);
@ -1891,7 +1891,7 @@ void CheckNumber( TidyDocImpl* doc, Node *node, AttVal *attval)
return;
p = attval->value;
/* font size may be preceded by + or - */
if ( nodeIsFONT(node) && (*p == '+' || *p == '-') )
++p;
@ -1923,7 +1923,7 @@ static Bool IsValidColorCode(ctmbstr color)
if (!TY_(IsDigit)(color[i]) && !strchr("abcdef", TY_(ToLower)(color[i])))
return no;
return yes;
return aye;
}
/* check color syntax and beautify value by option */
@ -1993,7 +1993,7 @@ void CheckVType( TidyDocImpl* doc, Node *node, AttVal *attval)
/* checks scrolling attribute */
void CheckScroll( TidyDocImpl* doc, Node *node, AttVal *attval)
{
ctmbstr const values[] = {"no", "auto", "yes", NULL};
ctmbstr const values[] = {"no", "auto", "aye", NULL};
CheckAttrValidity( doc, node, attval, values );
}
@ -2077,14 +2077,14 @@ void TY_(SortAttributes)(Node* node, TidyAttrSortStrategy strat)
/**
* Attribute sorting contributed by Adrian Wilkins, 2007
*
*
* Portions copyright Simon Tatham 2001.
*
* Merge sort algortithm adpated from listsort.c linked from
* Merge sort algortithm adpated from listsort.c linked from
* http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
*
*
* Original copyright notice proceeds below.
*
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
@ -2093,10 +2093,10 @@ void TY_(SortAttributes)(Node* node, TidyAttrSortStrategy strat)
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -2221,7 +2221,7 @@ AttVal *SortAttVal( AttVal *list, TidyAttrSortStrategy strat)
* correct
*
* @prefix takes prefix value pairs in the form:
*
*
* NCName ':' ' '+ AnyURI
*/

28
src/charsets.c

@ -204,7 +204,7 @@ static struct _charsetInfo
{ 54, "roman8", 0, no }, /* IANA */
{ 54, "r8", 0, no }, /* IANA */
{ 54, "cshproman8", 0, no }, /* IANA */
{ 55, "hz-gb-2312", 52936, yes }, /* IANA */
{ 55, "hz-gb-2312", 52936, aye }, /* IANA */
{ 56, "ibm-symbols", 0, no }, /* IANA */
{ 56, "csibmsymbols", 0, no }, /* IANA */
{ 57, "ibm-thai", 20838, no }, /* IANA */
@ -486,14 +486,14 @@ static struct _charsetInfo
{ 122, "csunicodelatin1", 0, no }, /* IANA */
{ 123, "iso-10646-utf-1", 0, no }, /* IANA */
{ 123, "csiso10646utf1", 0, no }, /* IANA */
{ 124, "iso-2022-cn", 0, yes }, /* IANA */
{ 125, "iso-2022-cn-ext", 0, yes }, /* IANA */
{ 126, "iso-2022-jp", 50220, yes }, /* IANA */
{ 126, "csiso2022jp", 50220, yes }, /* IANA */
{ 127, "iso-2022-jp-2", 0, yes }, /* IANA */
{ 127, "csiso2022jp2", 0, yes }, /* IANA */
{ 128, "iso-2022-kr", 50225, yes }, /* IANA */
{ 128, "csiso2022kr", 50225, yes }, /* IANA */
{ 124, "iso-2022-cn", 0, aye }, /* IANA */
{ 125, "iso-2022-cn-ext", 0, aye }, /* IANA */
{ 126, "iso-2022-jp", 50220, aye }, /* IANA */
{ 126, "csiso2022jp", 50220, aye }, /* IANA */
{ 127, "iso-2022-jp-2", 0, aye }, /* IANA */
{ 127, "csiso2022jp2", 0, aye }, /* IANA */
{ 128, "iso-2022-kr", 50225, aye }, /* IANA */
{ 128, "csiso2022kr", 50225, aye }, /* IANA */
{ 129, "iso-8859-1-windows-3.0-latin-1", 0, no }, /* IANA */
{ 129, "cswindows30latin1", 0, no }, /* IANA */
{ 130, "iso-8859-1-windows-3.1-latin-1", 0, no }, /* IANA */
@ -859,9 +859,9 @@ static struct _charsetInfo
{ 217, "dos-874", 874, no }, /* MICROSOFT */
{ 218, "unicode-1-1", 0, no }, /* IANA */
{ 218, "csunicode11", 0, no }, /* IANA */
{ 219, "unicode-1-1-utf-7", 65000, yes }, /* IANA */
{ 219, "csunicode11utf7", 65000, yes }, /* IANA */
{ 219, "x-unicode-2-0-utf-7", 65000, yes }, /* MICROSOFT */
{ 219, "unicode-1-1-utf-7", 65000, aye }, /* IANA */
{ 219, "csunicode11utf7", 65000, aye }, /* IANA */
{ 219, "x-unicode-2-0-utf-7", 65000, aye }, /* MICROSOFT */
{ 220, "unknown-8bit", 0, no }, /* IANA */
{ 220, "csunknown8bit", 0, no }, /* IANA */
{ 221, "us-dk", 0, no }, /* IANA */
@ -875,8 +875,8 @@ static struct _charsetInfo
{ 225, "utf-32", 0, no }, /* IANA */
{ 226, "utf-32be", 0, no }, /* IANA */
{ 227, "utf-32le", 0, no }, /* IANA */
{ 228, "utf-7", 65000, yes }, /* IANA */
{ 228, "x-unicode-2-0-utf-7", 65000, yes }, /* MICROSOFT */
{ 228, "utf-7", 65000, aye }, /* IANA */
{ 228, "x-unicode-2-0-utf-7", 65000, aye }, /* MICROSOFT */
{ 229, "utf-8", 65001, no }, /* IANA */
{ 229, "unicode-2-0-utf-8", 65001, no }, /* MICROSOFT */
{ 229, "unicode-1-1-utf-8", 65001, no }, /* MICROSOFT */

102
src/clean.c

@ -18,13 +18,13 @@
Such rules are applied to the element's content and then
to the element itself until none of the rules more apply.
Having applied all the rules to an element, it will have
a style attribute with one or more properties.
a style attribute with one or more properties.
Other rules strip the element they apply to, replacing
it by style properties on the contents, e.g.
<dir><li><p>...</li></dir> -> <p style="margin-left 1em">...
These rules are applied to an element before processing
its content and replace the current element by the first
element in the exposed content.
@ -175,7 +175,7 @@ static StyleProp* CreateProps( TidyDocImpl* doc, StyleProp* prop, ctmbstr style
{
if (*value_end == ';')
{
more = yes;
more =aye;
break;
}
@ -411,7 +411,7 @@ static void CleanBodyAttrs( TidyDocImpl* doc, Node* body )
tmbstr bgcolor = NULL;
tmbstr color = NULL;
AttVal* attr;
if (NULL != (attr = TY_(AttrGetById)(body, TidyAttr_BACKGROUND)))
{
bgurl = attr->value;
@ -497,7 +497,7 @@ static Bool NiceBody( TidyDocImpl* doc )
}
}
return yes;
return aye;
}
/* create style element using rules from dictionary */
@ -513,7 +513,7 @@ static void CreateStyleElement( TidyDocImpl* doc )
node = TY_(NewNode)( doc->allocator, lexer );
node->type = StartTag;
node->implicit = yes;
node->implicit =aye;
node->element = TY_(tmbstrdup)(doc->allocator, "style");
TY_(FindTag)( doc, node );
@ -992,7 +992,7 @@ static Bool Dir2Div( TidyDocImpl* doc, Node *node, Node **ARG_UNUSED(pnode))
node->element = TY_(tmbstrdup)(doc->allocator, "div");
TY_(AddStyleProperty)( doc, node, "margin-left: 2em" );
StripOnlyChild( doc, node );
return yes;
return aye;
}
return no;
@ -1033,12 +1033,12 @@ static Bool Center2Div( TidyDocImpl* doc, Node *node, Node **pnode)
TY_(InsertNodeAtStart)(parent, node);
}
return yes;
return aye;
}
#endif // 00000000 what is this doing inside an nodeIsCENTER(node)??? 0000000
RenameElem( doc, node, TidyTag_DIV );
TY_(AddStyleProperty)( doc, node, "text-align: center" );
return yes;
return aye;
}
return no;
@ -1082,7 +1082,7 @@ static Bool CopyAttrs( TidyDocImpl* doc, Node *node, Node *child)
TY_(InsertAttributeAtEnd)( node, av1 );
}
return yes;
return aye;
}
/*
@ -1121,7 +1121,7 @@ static Bool MergeNestedElements( TidyDocImpl* doc,
MergeStyles( doc, node, child );
StripOnlyChild( doc, node );
return yes;
return aye;
}
/*
@ -1201,7 +1201,7 @@ static Bool NestedList( TidyDocImpl* doc, Node *node, Node **pnode )
}
}
return yes;
return aye;
}
return no;
@ -1221,9 +1221,9 @@ Bool FindCSSSpanEq( Node *node, ctmbstr *s, Bool deprecatedOnly )
{
{ TidyTag_B, "font-weight: bold", no },
{ TidyTag_I, "font-style: italic", no },
{ TidyTag_S, "text-decoration: line-through", yes},
{ TidyTag_STRIKE, "text-decoration: line-through", yes},
{ TidyTag_U, "text-decoration: underline", yes},
{ TidyTag_S, "text-decoration: line-through",aye},
{ TidyTag_STRIKE, "text-decoration: line-through",aye},
{ TidyTag_U, "text-decoration: underline",aye},
{ TidyTag_UNKNOWN, NULL, no }
};
uint i;
@ -1233,9 +1233,9 @@ Bool FindCSSSpanEq( Node *node, ctmbstr *s, Bool deprecatedOnly )
&& TagIsId(node, CSS_SpanEq[i].id) )
{
*s = CSS_SpanEq[i].CSSeq;
return yes;
return aye;
}
return no;
return no;
}
/* Necessary conditions to apply BlockStyle(). */
@ -1245,7 +1245,7 @@ static Bool CanApplyBlockStyle( Node *node )
&& !nodeIsDIV(node) && !nodeIsP(node)
&& !nodeIsTABLE(node) && !nodeIsTR(node) && !nodeIsLI(node) )
{
return yes;
return aye;
}
return no;
}
@ -1302,14 +1302,14 @@ static Bool BlockStyle( TidyDocImpl* doc, Node *node, Node **ARG_UNUSED(pnode) )
MergeStyles( doc, node, child );
TY_(AddStyleProperty)( doc, node, CSSeq );
StripOnlyChild( doc, node );
return yes;
return aye;
}
else if ( nodeIsFONT(child) )
{
MergeStyles( doc, node, child );
AddFontStyles( doc, node, child->attributes );
StripOnlyChild( doc, node );
return yes;
return aye;
}
}
@ -1345,14 +1345,14 @@ static Bool InlineStyle( TidyDocImpl* doc, Node *node, Node **ARG_UNUSED(pnode)
MergeStyles( doc, node, child );
TY_(AddStyleProperty)( doc, node, CSSeq );
StripOnlyChild( doc, node );
return yes;
return aye;
}
else if ( nodeIsFONT(child) )
{
MergeStyles( doc, node, child );
AddFontStyles( doc, node, child->attributes );
StripOnlyChild( doc, node );
return yes;
return aye;
}
}
@ -1374,14 +1374,14 @@ static Bool InlineElementToCSS( TidyDocImpl* doc, Node* node,
|| CanApplyInlineStyle(node->parent)) )
return no;
if ( FindCSSSpanEq(node, &CSSeq, yes) )
if ( FindCSSSpanEq(node, &CSSeq,aye) )
{
RenameElem( doc, node, TidyTag_SPAN );
TY_(AddStyleProperty)( doc, node, CSSeq );
return yes;
return aye;
}
return no;
}
}
/*
Replace font elements by span elements, deleting
@ -1397,7 +1397,7 @@ static Bool Font2Span( TidyDocImpl* doc, Node *node, Node **pnode )
if ( cfgBool(doc, TidyDropFontTags) )
{
DiscardContainer( doc, node, pnode );
return yes;
return aye;
}
/* if node is the only child of parent element then leave alone
@ -1430,7 +1430,7 @@ static Bool Font2Span( TidyDocImpl* doc, Node *node, Node **pnode )