|
1 | 1 | # File src/library/tools/R/Rd2txt.R |
2 | 2 | # Part of the R package, https://www.R-project.org |
3 | 3 | # |
4 | | -# Copyright (C) 1995-2024 The R Core Team |
| 4 | +# Copyright (C) 1995-2025 The R Core Team |
5 | 5 | # |
6 | 6 | # This program is free software; you can redistribute it and/or modify |
7 | 7 | # it under the terms of the GNU General Public License as published by |
@@ -37,7 +37,8 @@ Rd2txt_options <- local({ |
37 | 37 | sectionExtra = 2L, |
38 | 38 | itemBullet = "* ", |
39 | 39 | enumFormat = function(n) sprintf("%d. ", n), |
40 | | - showURLs = FALSE, |
| 40 | + ## descStyle = "none", |
| 41 | + showURLs = FALSE, |
41 | 42 | code_quote = TRUE, |
42 | 43 | underline_titles = TRUE) |
43 | 44 | function(...) { |
@@ -516,6 +517,7 @@ Rd2txt <- |
516 | 517 | strip |
517 | 518 | } |
518 | 519 | ## Strip pending blank lines, then add n new ones. |
| 520 | + ## (Currently not used with n > 1, which only works if not 'wrapping'.) |
519 | 521 | blankLine <- function(n = 1L) { |
520 | 522 | while (stripBlankLine()) NULL |
521 | 523 | flushBuffer() |
@@ -891,9 +893,12 @@ Rd2txt <- |
891 | 893 | indent <<- max(opts$minIndent, |
892 | 894 | indent + opts$extraIndent) |
893 | 895 | keepFirstIndent <<- TRUE |
894 | | - putw(strrep(" ", indent0), |
895 | | - DLlab, |
896 | | - " ") |
| 896 | + linebreak <- identical(opts$descStyle, "linebreak") |
| 897 | + suffix <- if (identical(opts$descStyle, "colon") |
| 898 | + && !endsWith(DLlab, ":")) ": " |
| 899 | + else if (!linebreak) " " |
| 900 | + putw(strrep(" ", indent0), DLlab, suffix) |
| 901 | + if (linebreak) blankLine(0L) |
897 | 902 | writeContent(block[[2L]], tag) |
898 | 903 | blankLine(0L) |
899 | 904 | indent <<- indent0 |
|
0 commit comments