From 30acf559c57bbf1d0a48e1cc3dd87e6d79dc36c9 Mon Sep 17 00:00:00 2001 From: Bob Rudis Date: Wed, 1 Feb 2017 17:10:54 -0500 Subject: [PATCH] Fix warning coming from URL redirection in examples --- DESCRIPTION | 5 +++-- NEWS.md | 4 ++++ R/RcppExports.R | 2 +- R/tidy.r | 4 ++-- README.Rmd | 10 ++++----- README.md | 53 +++++++++++++++++++++++++----------------------- man/highlight_styles.Rd | 1 - man/htmltidy.Rd | 1 - man/renderXmlview.Rd | 1 - man/tidy_html.Rd | 13 ++++++------ man/xml_tree_view.Rd | 3 +-- man/xml_view.Rd | 3 +-- man/xmltreeview-shiny.Rd | 3 +-- man/xmlviewOutput.Rd | 1 - src/RcppExports.cpp | 10 ++++----- 15 files changed, 57 insertions(+), 57 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0e91613..cf30eb1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,7 @@ Package: htmltidy Title: Tidy Up and Test XPath Queries on HTML and XML Content -Version: 0.3.0 +Version: 0.3.1 +Encoding: UTF-8 Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")), person("Dave", "Raggett", email = "dsr@w3.org", role = c("ctb", "aut"), @@ -53,4 +54,4 @@ Imports: XML, htmlwidgets, htmltools -RoxygenNote: 5.0.1 +RoxygenNote: 6.0.0 diff --git a/NEWS.md b/NEWS.md index 2f52b59..aaa9cbb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# htmltidy 0.3.1 + +* Fix warnings coming from URL redirection in examples + # htmltidy 0.3.0 * Better error handling (fixed crashing bug in #1) diff --git a/R/RcppExports.R b/R/RcppExports.R index 3393706..9484152 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,4 +1,4 @@ -# This file was generated by Rcpp::compileAttributes +# 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) { diff --git a/R/tidy.r b/R/tidy.r index 3739d5b..9f31d92 100644 --- a/R/tidy.r +++ b/R/tidy.r @@ -71,7 +71,7 @@ #' cat(tidy_html(txt, option=opts)) #' #' library(httr) -#' res <- GET("http://rud.is/test/untidy.html") +#' res <- GET("https://rud.is/test/untidy.html") #' #' # look at the original, un-tidy source #' cat(content(res, as="text", encoding="UTF-8")) @@ -81,7 +81,7 @@ #' list(TidyDocType="html5", TidyWrapLen=200))) #' #' # but, you could also just do: -#' cat(tidy_html(url("http://rud.is/test/untidy.html"))) +#' cat(tidy_html(url("https://rud.is/test/untidy.html"))) tidy_html <- function(content, options=list(TidyXhtmlOut=TRUE), verbose=FALSE) { UseMethod("tidy_html") } diff --git a/README.Rmd b/README.Rmd index 9a2ea8c..733ef2d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -64,7 +64,7 @@ library(purrr) This is really "un-tidy" content: ```{r message=FALSE, warning=FALSE} -res <- GET("http://rud.is/test/untidy.html") +res <- GET("https://rud.is/test/untidy.html") cat(content(res, as="text")) ``` @@ -85,14 +85,14 @@ cat(tidy_html(content(res, as="text"), list(TidyDocType="html5", TidyWrapLen=200 NOTE: you could also just have done: ```{r message=FALSE, warning=FALSE} -cat(tidy_html(url("http://rud.is/test/untidy.html"), +cat(tidy_html(url("https://rud.is/test/untidy.html"), list(TidyDocType="html5", TidyWrapLen=200))) ``` You'll see that this differs substantially from the mangling `libxml2` does (via `read_html()`): ```{r message=FALSE, warning=FALSE} -pg <- read_html("http://rud.is/test/untidy.html") +pg <- read_html("https://rud.is/test/untidy.html") cat(toString(pg)) ``` @@ -105,13 +105,13 @@ tidy_html(content(res, as="text", encoding="UTF-8")) tidy_html(content(res, as="parsed", encoding="UTF-8")) -tidy_html(htmlParse("http://rud.is/test/untidy.html")) +tidy_html(htmlParse("https://rud.is/test/untidy.html")) ``` And, show the markup errors: ```{r message=FALSE, warning=FALSE} -invisible(tidy_html(url("http://rud.is/test/untidy.html"), verbose=TRUE)) +invisible(tidy_html(url("https://rud.is/test/untidy.html"), verbose=TRUE)) ``` ### Testing Options diff --git a/README.md b/README.md index 311e1e2..43e912f 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ library(htmltidy) # current verison packageVersion("htmltidy") -## [1] '0.3.0' +## [1] '0.3.1' library(XML) library(xml2) @@ -42,7 +42,7 @@ library(purrr) This is really "un-tidy" content: ``` r -res <- GET("http://rud.is/test/untidy.html") +res <- GET("https://rud.is/test/untidy.html") cat(content(res, as="text")) ## ## ## ## ## -## This is some really poorly formatted HTML as is this portion +## This is some really poorly formatted HTML as is this +## portion ##
## ## @@ -100,7 +104,7 @@ cat(tidy_html(content(res, as="text"), list(TidyDocType="html5", TidyWrapLen=200 NOTE: you could also just have done: ``` r -cat(tidy_html(url("http://rud.is/test/untidy.html"), +cat(tidy_html(url("https://rud.is/test/untidy.html"), list(TidyDocType="html5", TidyWrapLen=200))) ## ## @@ -121,16 +125,22 @@ cat(tidy_html(url("http://rud.is/test/untidy.html"), You'll see that this differs substantially from the mangling `libxml2` does (via `read_html()`): ``` r -pg <- read_html("http://rud.is/test/untidy.html") +pg <- read_html("https://rud.is/test/untidy.html") cat(toString(pg)) -## ## -## +## +## +## ## This is some really poorly formatted HTML ## -## as is this portion
+## as is this portion
+## +## ``` It can also deal with "raw" and parsed objects: @@ -150,25 +160,18 @@ tidy_html(content(res, as="text", encoding="UTF-8")) tidy_html(content(res, as="parsed", encoding="UTF-8")) ## {xml_document} ## -## [1] \n \n \nThis is some really poorly formatted HTML as is this\nportion\n +## [1] \n\nportion\n
+tidy_html(htmlParse("https://rud.is/test/untidy.html")) +## ## ## ## -## ## ## ## -## This is some really poorly formatted HTML as is this -## portion -##
+##

https://rud.is/test/untidy.html

## ## ## @@ -177,7 +180,7 @@ tidy_html(htmlParse("http://rud.is/test/untidy.html")) And, show the markup errors: ``` r -invisible(tidy_html(url("http://rud.is/test/untidy.html"), verbose=TRUE)) +invisible(tidy_html(url("https://rud.is/test/untidy.html"), verbose=TRUE)) ## line 1 column 1 - Warning: missing declaration ## line 1 column 68 - Warning: nested emphasis ## line 1 column 138 - Warning: missing before
@@ -242,7 +245,7 @@ sum(map_int(book, nchar)) ## [1] 207501 system.time(tidy_book <- tidy_html(book)) ## user system elapsed -## 0.021 0.001 0.022 +## 0.023 0.001 0.024 ``` (It's usually between 20 & 25 milliseconds to process those 202 kilobytes of HTML.) Not too shabby. diff --git a/man/highlight_styles.Rd b/man/highlight_styles.Rd index 0db545a..b18b6ca 100644 --- a/man/highlight_styles.Rd +++ b/man/highlight_styles.Rd @@ -17,4 +17,3 @@ highlight_styles() See \url{https://highlightjs.org/static/demo/} for a demo of all highlight.js styles } - diff --git a/man/htmltidy.Rd b/man/htmltidy.Rd index 32a4615..d7e3ee1 100644 --- a/man/htmltidy.Rd +++ b/man/htmltidy.Rd @@ -25,4 +25,3 @@ and 'xml-viewer', respectively. \author{ Bob Rudis (bob@rud.is) } - diff --git a/man/renderXmlview.Rd b/man/renderXmlview.Rd index bcf1792..677404b 100644 --- a/man/renderXmlview.Rd +++ b/man/renderXmlview.Rd @@ -16,4 +16,3 @@ renderXmlview(expr, env = parent.frame(), quoted = FALSE) \description{ Widget render function for use in Shiny } - diff --git a/man/tidy_html.Rd b/man/tidy_html.Rd index ed3a0c5..c830a3b 100644 --- a/man/tidy_html.Rd +++ b/man/tidy_html.Rd @@ -1,14 +1,14 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/response.r, R/tidy.r \name{tidy_html.response} +\alias{tidy_html.response} \alias{tidy_html} -\alias{tidy_html.HTMLInternalDocument} -\alias{tidy_html.character} -\alias{tidy_html.connection} \alias{tidy_html.default} +\alias{tidy_html.character} \alias{tidy_html.raw} -\alias{tidy_html.response} \alias{tidy_html.xml_document} +\alias{tidy_html.HTMLInternalDocument} +\alias{tidy_html.connection} \title{Tidy or "Pretty Print" HTML/XHTML Documents} \usage{ \method{tidy_html}{response}(content, options = list(TidyXhtmlOut = TRUE), @@ -110,7 +110,7 @@ txt <- paste0( cat(tidy_html(txt, option=opts)) library(httr) -res <- GET("http://rud.is/test/untidy.html") +res <- GET("https://rud.is/test/untidy.html") # look at the original, un-tidy source cat(content(res, as="text", encoding="UTF-8")) @@ -120,7 +120,7 @@ cat(tidy_html(content(res, as="text", encoding="UTF-8"), list(TidyDocType="html5", TidyWrapLen=200))) # but, you could also just do: -cat(tidy_html(url("http://rud.is/test/untidy.html"))) +cat(tidy_html(url("https://rud.is/test/untidy.html"))) } \references{ \url{http://api.html-tidy.org/tidy/quickref_5.1.25.html} & @@ -128,4 +128,3 @@ cat(tidy_html(url("http://rud.is/test/untidy.html"))) for definitions of the options supported above and \url{https://www.w3.org/People/Raggett/tidy/} for an explanation of what "tidy" HTML is and some canonical examples of what it can do. } - diff --git a/man/xml_tree_view.Rd b/man/xml_tree_view.Rd index d0a9f22..4b2c8e3 100644 --- a/man/xml_tree_view.Rd +++ b/man/xml_tree_view.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/xmltreeview.R \name{xml_tree_view} -\alias{html_tree_view} \alias{xml_tree_view} +\alias{html_tree_view} \title{HTML/XML tree viewer} \usage{ xml_tree_view(doc = NULL, scroll = FALSE, elementId = NULL, @@ -57,4 +57,3 @@ htmltools::browsable( \references{ \href{https://github.com/juliangruber/xml-viewer}{xml-viewer} } - diff --git a/man/xml_view.Rd b/man/xml_view.Rd index 37f2595..65e04e3 100644 --- a/man/xml_view.Rd +++ b/man/xml_view.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/xmlview.R \name{xml_view} -\alias{html_view} \alias{xml_view} +\alias{html_view} \title{HTML/XML pretty printer and viewer} \usage{ xml_view(doc, style = "default", scroll = FALSE, add_filter = FALSE, @@ -88,4 +88,3 @@ xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ \href{https://highlightjs.org/}{highlight.js}, \href{http://www.eslinstructor.net/vkbeautify/}{vkbeautify} } - diff --git a/man/xmltreeview-shiny.Rd b/man/xmltreeview-shiny.Rd index 2146fe2..d25672e 100644 --- a/man/xmltreeview-shiny.Rd +++ b/man/xmltreeview-shiny.Rd @@ -1,9 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/shiny-tree-view.R \name{xmltreeview-shiny} -\alias{renderXmltreeview} \alias{xmltreeview-shiny} \alias{xmltreeviewOutput} +\alias{renderXmltreeview} \title{Shiny bindings for xmltreeview} \usage{ xmltreeviewOutput(outputId, width = "100\%", height = "400px") @@ -28,4 +28,3 @@ is useful if you want to save an expression in a variable.} Output and render functions for using xmltreeview within Shiny applications and interactive Rmd documents. } - diff --git a/man/xmlviewOutput.Rd b/man/xmlviewOutput.Rd index d986aab..d56aa8d 100644 --- a/man/xmlviewOutput.Rd +++ b/man/xmlviewOutput.Rd @@ -16,4 +16,3 @@ xmlviewOutput(outputId, width = "100\%", height = "400px") \description{ Widget output function for use in Shiny } - diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index aacf505..73c0573 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -1,4 +1,4 @@ -// This file was generated by Rcpp::compileAttributes +// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include @@ -9,12 +9,12 @@ using namespace Rcpp; 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) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + 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); - __result = Rcpp::wrap(tidy_html_int(source, options, show_errors)); - return __result; + rcpp_result_gen = Rcpp::wrap(tidy_html_int(source, options, show_errors)); + return rcpp_result_gen; END_RCPP }