-
Notifications
You must be signed in to change notification settings - Fork 9
Whitespaces indentation header #62
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
Merged
kpagacz
merged 7 commits into
pharmaverse:main
from
eanokian:whitespaces_indentation_header
Apr 13, 2026
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1db432c
replaced leading whitespaces in header col 1 with left-indentation
eanokian 4429c7d
Update gentlg_single.R
eanokian 34db603
Update NEWS.md
eanokian 547f7ad
replace_leading_whitespaces_with_indentation() added unit tests, move…
eanokian 4b72318
Merge branch 'main' into whitespaces_indentation_header
eanokian 13e5b8d
shortened function name
eanokian 54e5d14
addressed CICD errors: updated WORDLIST, updated snapshot, fixed roxy…
eanokian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #' Replace leading whitespaces with left indentation RTF markup | ||
| #' | ||
| #' @details | ||
| #' The following function receives a string 'x' and returns a modified string | ||
| #' where every leading whitespace is replaced with 90 twips (0.0625 inches) left indentation RTF markup. | ||
| #' If the input does not start with a whitespace, the string is returned as is. | ||
| #' | ||
| #' @param x `character(1)` a string to replace the leading whitespaces. | ||
| #' | ||
| #' @examples | ||
| #' replace_lead_whitespaces_ind(" this is x") | ||
| #' # [1] "\\intbl\\li360\\fi0 this is x" | ||
| #' replace_lead_whitespaces_ind("this is x") | ||
| #' # [1] "this is x" | ||
| #' | ||
| #' @return `character(1)` RTF markup with leading whitespaces replaced. | ||
| #' @keywords internal | ||
| replace_lead_whitespaces_ind <- function(x) { | ||
| # get number of leading whitespaces | ||
| num_whitespaces <- attr(regexpr("^\\s*", x), "match.length") | ||
| # 2 whitespaces represent an indentation of 0.125 inches = 180 twips | ||
| # e.g. 4 whitespaces represent a left-indentation of 0.25 inches = 360 twips | ||
| num_twips <- num_whitespaces * 90 | ||
| if (num_twips > 0) { | ||
| raw_rtf_markup <- paste0("\\intbl\\li", num_twips, "\\fi0") | ||
| x <- paste0(raw_rtf_markup, " ", trimws(x, "left")) | ||
| } | ||
| x | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs tests as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added unit tests for
replace_lead_whitespaces_ind()