Skip to content

Commit

Permalink
merge: master
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCoene committed Apr 7, 2024
2 parents 114730e + 0590c02 commit 13140c5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ in memory.
rendering.
- Custom renderers (`as_renderer`) are now more robust.
- Add `limit` field to protect against large uploads.
- Fix issue with setting custom websocket handler [#62](https://github.com/devOpifex/ambiorix/issues/62).
- Add `engine` method on router to set custom renderers (`use` deprecated for custom renderers).

# ambiorix 2.1.0

Expand Down
2 changes: 1 addition & 1 deletion R/response.R
Original file line number Diff line number Diff line change
Expand Up @@ -817,4 +817,4 @@ deprecated_status <- function(status = NULL) {
package = "ambiorix",
msg = "Deprecated. Pass status to the `status` binding, e.g.: `res$status <- 404L`."
)
}
}
13 changes: 13 additions & 0 deletions R/routing.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ Routing <- R6::R6Class(
cli::cli_rule("Ambiorix", right = "web server")
cli::cli_li("routes: {.val {private$n_routes()}}")
},
#' @details Engine to use for rendering templates.
engine = function(engine){
if(!is_renderer_obj(engine))
engine <- as_renderer(engine)

self$use(engine)
invisible(self)
},
#' @details Use a router or middleware
#' @param use Either a router as returned by [Router], a function to use as middleware,
#' or a `list` of functions.
Expand Down Expand Up @@ -259,6 +267,11 @@ Routing <- R6::R6Class(
}

if(is_renderer_obj(use)) {
.Deprecated(
"engine",
package = "ambiorix",
msg = "Use `engine` instead of `use` for custom renderers."
)
.globals$renderer <- use
return(invisible(self))
}
Expand Down
1 change: 1 addition & 0 deletions man/Ambiorix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/Router.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/Routing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13140c5

Please sign in to comment.