From 5ae594a2eeae26c3a8d4ec8cf72b570cf5485212 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= <maelle.salmon@yahoo.se>
Date: Thu, 7 Nov 2024 13:30:44 +0100
Subject: [PATCH] docs: safer example for `emodnet_get_wfs_info()`

---
 R/info.R                    | 4 +---
 man/emodnet_get_wfs_info.Rd | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/R/info.R b/R/info.R
index c4a2ce3..8ac0e12 100644
--- a/R/info.R
+++ b/R/info.R
@@ -91,8 +91,7 @@ emodnet_get_layer_info <- memoise::memoise(.emodnet_get_layer_info)
 #' @export
 #' @describeIn emodnet_get_wfs_info Get info on all layers from
 #' an EMODnet WFS service.
-#' @examples
-#' \dontrun{
+#' @examplesIf interactive()
 #' emodnet_get_wfs_info(service = "bathymetry")
 #' # Query a wfs object
 #' wfs_bio <- emodnet_init_wfs_client("biology")
@@ -100,7 +99,6 @@ emodnet_get_layer_info <- memoise::memoise(.emodnet_get_layer_info)
 #' # Get info for specific layers from wfs object
 #' layers <- c("mediseh_zostera_m_pnt", "mediseh_posidonia_nodata")
 #' emodnet_get_layer_info(wfs = wfs_bio, layers = layers)
-#' }
 emodnet_get_wfs_info <- memoise::memoise(.emodnet_get_wfs_info)
 
 #' @describeIn emodnet_get_wfs_info Get metadata on all layers and all available
diff --git a/man/emodnet_get_wfs_info.Rd b/man/emodnet_get_wfs_info.Rd
index 2c03177..dee55f7 100644
--- a/man/emodnet_get_wfs_info.Rd
+++ b/man/emodnet_get_wfs_info.Rd
@@ -56,7 +56,7 @@ services from server.
 
 }}
 \examples{
-\dontrun{
+\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
 emodnet_get_wfs_info(service = "bathymetry")
 # Query a wfs object
 wfs_bio <- emodnet_init_wfs_client("biology")
@@ -64,5 +64,5 @@ emodnet_get_wfs_info(wfs_bio)
 # Get info for specific layers from wfs object
 layers <- c("mediseh_zostera_m_pnt", "mediseh_posidonia_nodata")
 emodnet_get_layer_info(wfs = wfs_bio, layers = layers)
-}
+\dontshow{\}) # examplesIf}
 }