From 625c47844369ad70927ac16099b6678de82ba84f Mon Sep 17 00:00:00 2001 From: IndrajeetPatil Date: Mon, 20 May 2024 11:57:04 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20r-lib/st?= =?UTF-8?q?yler@6db6eff9869214af1226e09038852ee568752f3a=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/articles/customizing_styler.html | 17 +++++++++-------- dev/articles/remove_rules.html | 27 ++++++++++++++------------- dev/articles/strict.html | 4 +--- dev/pkgdown.yml | 2 +- dev/reference/style_file.html | 10 +++++----- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/dev/articles/customizing_styler.html b/dev/articles/customizing_styler.html index 853e60a26..f25d6cabd 100644 --- a/dev/articles/customizing_styler.html +++ b/dev/articles/customizing_styler.html @@ -218,10 +218,10 @@

How styler works#> List of 12 #> $ initialize :List of 1 #> ..$ initialize:function (pd_flat) -#> $ line_break :List of 12 -#> ..$ set_line_break_around_comma_and_or :function (pd, strict) -#> ..$ set_line_break_after_assignment :function (pd) -#> ..$ set_line_break_before_curly_opening :function (pd) +#> $ line_break :List of 13 +#> ..$ remove_empty_lines_after_opening_and_before_closing_braces:function (pd) +#> ..$ set_line_break_around_comma_and_or :function (pd, strict) +#> ..$ set_line_break_after_assignment :function (pd) #> .. [list output truncated] #> $ space :List of 19 #> ..$ remove_space_before_closing_paren :function (pd_flat) @@ -240,14 +240,15 @@

How styler workstidyverse_style()$space$remove_space_after_opening_paren #> function (pd_flat) #> { -#> paren_after <- pd_flat$token %in% c("'('", "'['", "LBB") +#> opening_braces <- c("'('", "'['", "LBB") +#> paren_after <- pd_flat$token %in% opening_braces #> if (!any(paren_after)) { #> return(pd_flat) #> } #> pd_flat$spaces[paren_after & (pd_flat$newlines == 0L)] <- 0L #> pd_flat #> } -#> <bytecode: 0x563a45f21998> +#> <bytecode: 0x56180663bee8> #> <environment: namespace:styler>

As the name says, this function removes spaces after the opening parenthesis. But how? Its input is a nest. Since the visitor @@ -395,7 +396,7 @@

Implementation details#> outer_indention_refs = NA) #> transformed_absolute_indent #> } -#> <bytecode: 0x563a4991d780> +#> <bytecode: 0x56180a03e6c8> #> <environment: namespace:styler>

This means that the order of the styling is clearly defined and it is for example not possible to modify line breaks based on spacing, because @@ -533,7 +534,7 @@

Showcasing the development #> pd$lag_newlines[round_after_curly] <- 0L #> pd #> } -#> <bytecode: 0x563a45d23210> +#> <bytecode: 0x56180643a4b8> #> <environment: namespace:styler>

With our example function set_line_break_before_curly_opening() we don’t need to diff --git a/dev/articles/remove_rules.html b/dev/articles/remove_rules.html index 81fff6a10..66b9aef9a 100644 --- a/dev/articles/remove_rules.html +++ b/dev/articles/remove_rules.html @@ -242,18 +242,19 @@

Practice#> [19] "set_space_in_curly_curly" #> #> $line_break -#> [1] "set_line_break_around_comma_and_or" -#> [2] "set_line_break_after_assignment" -#> [3] "set_line_break_before_curly_opening" -#> [4] "remove_line_break_before_round_closing_after_curly" -#> [5] "remove_line_breaks_in_fun_dec" -#> [6] "style_line_break_around_curly" -#> [7] "set_line_break_around_curly_curly" -#> [8] "set_line_break_before_closing_call" -#> [9] "set_line_break_after_opening_if_call_is_multi_line" -#> [10] "remove_line_break_in_fun_call" -#> [11] "add_line_break_after_pipe" -#> [12] "set_line_break_after_ggplot2_plus" +#> [1] "remove_empty_lines_after_opening_and_before_closing_braces" +#> [2] "set_line_break_around_comma_and_or" +#> [3] "set_line_break_after_assignment" +#> [4] "set_line_break_before_curly_opening" +#> [5] "remove_line_break_before_round_closing_after_curly" +#> [6] "remove_line_breaks_in_fun_dec" +#> [7] "style_line_break_around_curly" +#> [8] "set_line_break_around_curly_curly" +#> [9] "set_line_break_before_closing_call" +#> [10] "set_line_break_after_opening_if_call_is_multi_line" +#> [11] "remove_line_break_in_fun_call" +#> [12] "add_line_break_after_pipe" +#> [13] "set_line_break_after_ggplot2_plus" #> #> $indention #> [1] "indent_braces" "unindent_fun_dec" @@ -280,7 +281,7 @@

Practice#> pd$text[to_replace] <- "<-" #> pd #> } -#> <bytecode: 0x56361f3c0ca8> +#> <bytecode: 0x555f468bf870> #> <environment: namespace:styler>

Next, you simply set that element to NULL.

diff --git a/dev/articles/strict.html b/dev/articles/strict.html
index d7d7c82e7..0c007fd6d 100644
--- a/dev/articles/strict.html
+++ b/dev/articles/strict.html
@@ -173,12 +173,10 @@ 

The effect of strict = FALSE
1  +    (1 + 3)
 1 ~  more()   #   comment
    -
  • More than one line break is tolerated before closing curly brace and -line breaks between curly and round braces are not removed.
  • +
  • Line breaks between curly and round braces are not removed.
test({
   1
-
 }
 )