line / conflr

Post R Markdown documents to Confluence
https://line.github.io/conflr/
GNU General Public License v3.0
130 stars 28 forks source link

read html file as `body` in `conflr::confl_update_page()` #154

Closed matthewdwood82 closed 2 years ago

matthewdwood82 commented 2 years ago

I think this is mostly a documentation issue. I have an html file I would like to push & update a current confluence page using conflr::confl_update_page(id = num_my_id, title = "my page", ...)

Currently, I am trying to do something like

conflr::confl_update_page(id = num_my_id, title = "my page", body = readr::read_file("main.html"))

but return the following error

> conflr::confl_update_page(id = 180014247, title = "conflr quarto/rstudio test", body = readr::read_file("main.html"))
Error in `confl_verb()`:
! Error in paste(httr::http_condition(res, type = "error"), httr::content(res)): Bad Request (HTTP 400).
 400
* Error in paste(httr::http_condition(res, type = "error"), httr::content(res)): Bad Request (HTTP 400).
 list(authorized = FALSE, valid = TRUE, allowedInReadOnlyMode = TRUE, errors = list(), successful = FALSE)
* Error in paste(httr::http_condition(res, type = "error"), httr::content(res)): Bad Request (HTTP 400).
 Error parsing xhtml: Unrecognized XML directive; expected CDATA or comment ('<![CDATA[' or '<!--').
 at [row,col {unknown-source}]: [1,323]
* Error in paste(httr::http_condition(res, type = "error"), httr::content(res)): Bad Request (HTTP 400).
 Bad Request
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
Error in `$<-.data.frame`(`*tmp*`, "call_text", value = c("conflr::confl_update_page(...)",  : 
  replacement has 3 rows, data has 2

Any recommendations for passing an existing HTML file through this function? Thanks!

yutannihilation commented 2 years ago

Hi! conflr package doesn't support it. You can convert HTML to a Markdown file with .Rmd extension first.

c.f. https://github.com/line/conflr/issues/147#issuecomment-1058222900

matthewdwood82 commented 2 years ago

Thanks. FWIW, I run into a similar issue when I try to knit from RMD. My current working theory is that I'm trying to push an {DT} object that is not converting.

See SO post here: https://stackoverflow.com/questions/73395370/dt-htmlwidgets-content-for-conflr