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 internal R6 links in LaTeX / PDF #1007

Merged
merged 1 commit into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
package level documentation, where it can be used to suppress the
auto-generated Description section (#1008).

* roxygen2 now adds hyperlinks to R6 methods in the PDF manual as well,
(#1006).

# roxygen2 7.0.2

* `\example{}` escaping has been improved (again!) so that special escapes
Expand Down
1 change: 1 addition & 0 deletions R/rd-r6.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ r6_method_begin <- function(block, method) {
c(
"\\if{html}{\\out{<hr>}}",
paste0("\\if{html}{\\out{<a id=\"method-", nm, "\"></a>}}"),
paste0("\\if{latex}{\\out{\\hypertarget{method-", nm, "}{}}}"),
paste0("\\subsection{Method \\code{", nm, "()}}{")
)
}
Expand Down
12 changes: 12 additions & 0 deletions man/RoxyTopic.Rd

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

4 changes: 4 additions & 0 deletions tests/testthat/roxygen-block-3-A.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Class A details
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-meth1"></a>}}
\if{latex}{\out{\hypertarget{method-meth1}{}}}
\subsection{Method \code{meth1()}}{
A method 1.
\subsection{Usage}{
Expand All @@ -81,6 +82,7 @@ A method 1.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-meth2"></a>}}
\if{latex}{\out{\hypertarget{method-meth2}{}}}
\subsection{Method \code{meth2()}}{
Method 2 description.
\subsection{Usage}{
Expand Down Expand Up @@ -111,6 +113,7 @@ Method 2 details.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-meth3"></a>}}
\if{latex}{\out{\hypertarget{method-meth3}{}}}
\subsection{Method \code{meth3()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{A$meth3(duplicate, missing)}\if{html}{\out{</div>}}
Expand All @@ -135,6 +138,7 @@ twice.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-clone"></a>}}
\if{latex}{\out{\hypertarget{method-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/roxygen-block-3-B.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Class B details.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-meth1"></a>}}
\if{latex}{\out{\hypertarget{method-meth1}{}}}
\subsection{Method \code{meth1()}}{
B method 1.
\subsection{Usage}{
Expand All @@ -67,6 +68,7 @@ B method 1.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-meth4"></a>}}
\if{latex}{\out{\hypertarget{method-meth4}{}}}
\subsection{Method \code{meth4()}}{
A method 4.
\subsection{Usage}{
Expand All @@ -76,6 +78,7 @@ A method 4.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-clone"></a>}}
\if{latex}{\out{\hypertarget{method-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/roxygen-block-3-C.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Classs C details.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-meth2"></a>}}
\if{latex}{\out{\hypertarget{method-meth2}{}}}
\subsection{Method \code{meth2()}}{
C method 2.
\subsection{Usage}{
Expand All @@ -80,6 +81,7 @@ C method 2.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-meth5"></a>}}
\if{latex}{\out{\hypertarget{method-meth5}{}}}
\subsection{Method \code{meth5()}}{
C method 5.
\subsection{Usage}{
Expand All @@ -89,6 +91,7 @@ C method 5.
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-undocumented_method"></a>}}
\if{latex}{\out{\hypertarget{method-undocumented_method}{}}}
\subsection{Method \code{undocumented_method()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{C$undocumented_method()}\if{html}{\out{</div>}}
Expand Down