Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix implementation of @slot #84

Closed
tobias-verbeke opened this issue Mar 19, 2012 · 2 comments
Closed

fix implementation of @slot #84

tobias-verbeke opened this issue Mar 19, 2012 · 2 comments

Comments

@tobias-verbeke
Copy link

The current implementation of @slot does not pass the Rd checks, primarily because
\section{Slots} should become \section{Slots}{...}. Some other improvements
are possible as well.

Current (erroneous) form

\section{Slots}
\itemize{
  \item{a}{Object of class \code{"numeric"}}
  \item{b}{Object of class \code{"character"}}
}

could become

\section{Slots}{
  \describe{
    \item{\code{a}:}{Object of class \code{"numeric"}.}
    \item{\code{b}:}{Object of class \code{"character"}.}
  }
}
@unDocUMeantIt
Copy link

the following seems to improve the situation (applied to the S4 branch), but i still get wierd errors, e.g. when trying to roxygenize() the XiMpLe package.

--- a/R/rd-tag-api.R
+++ b/R/rd-tag-api.R
@@ -33,7 +33,11 @@
 }

 #' @S3method format rd_tag
-format.rd_tag <- function(x, ...) stop("Unimplemented format")
+format.rd_tag <- function(x, ...) {
+  # somehow this gets triggered for format.slot_tag,
+  # this is only a workaround...
+  if(length(class(x)) == 1) stop("Unimplemented format")
+}

 #' @S3method merge rd_tag
 merge.rd_tag <- function(x, y, ...) {
@@ -126,11 +130,11 @@
 #' @S3method format slot_tag
 format.slot_tag <- function(x, ...) {
   names <- names(x$values)
-  items <- str_c("\\item{", names, "}{", x$values, "}", collapse = "\n\n")
-  str_c("\\section{Slots}\n\n",
-    "\\itemize{\n", 
+  items <- str_c("\\item{\\code{", names, "}:}{", x$values, "}", collapse = "\n\n")
+  str_c("\\section{Slots}{\n\n",
+    "\\describe{\n", 
     str_wrap(items, width = 60, exdent = 2, indent = 2),
-    "\n}\n")
+    "\n}}\n")
 }

@hadley
Copy link
Member

hadley commented Nov 4, 2013

See #85

@hadley hadley closed this as completed Nov 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants