File tree Expand file tree Collapse file tree 3 files changed +132
-106
lines changed Expand file tree Collapse file tree 3 files changed +132
-106
lines changed Original file line number Diff line number Diff line change 8787 continue-on-error : true
8888 run : |
8989 # using split_inclusive that uses regex feature that uses an unstable feature
90- RUSTC_BOOTSTRAP=true cargo run --manifest-path ci/sembr/Cargo.toml src
90+ RUSTC_BOOTSTRAP=1 cargo run --manifest-path ci/sembr/Cargo.toml src
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ struct Cli {
2222static REGEX_IGNORE : LazyLock < Regex > =
2323 LazyLock :: new ( || Regex :: new ( r"^\s*(\d\.|\-|\*)\s+" ) . unwrap ( ) ) ;
2424static REGEX_IGNORE_END : LazyLock < Regex > = LazyLock :: new ( || Regex :: new ( r"(\.|\?|;|!)$" ) . unwrap ( ) ) ;
25+ static REGEX_IGNORE_LINK_TARGETS : LazyLock < Regex > =
26+ LazyLock :: new ( || Regex :: new ( r"^\[.+\]: " ) . unwrap ( ) ) ;
2527static REGEX_SPLIT : LazyLock < Regex > = LazyLock :: new ( || Regex :: new ( r"(\.|\?|;|!)\s+" ) . unwrap ( ) ) ;
2628
2729fn main ( ) -> Result < ( ) > {
@@ -94,6 +96,7 @@ fn ignore(line: &str, in_code_block: bool) -> bool {
9496 || line. starts_with ( '#' )
9597 || line. trim ( ) . is_empty ( )
9698 || REGEX_IGNORE . is_match ( line)
99+ || REGEX_IGNORE_LINK_TARGETS . is_match ( line)
97100}
98101
99102fn comply ( content : & str ) -> String {
@@ -221,6 +224,15 @@ fn test_prettify_prefix_spaces() {
221224 assert_eq ! ( expected, lengthen_lines( original, 50 ) ) ;
222225}
223226
227+ #[ test]
228+ fn test_prettify_ignore_link_targets ( ) {
229+ let original = "\
230+ [a target]: https://example.com
231+ [another target]: https://example.com
232+ " ;
233+ assert_eq ! ( original, lengthen_lines( original, 100 ) ) ;
234+ }
235+
224236#[ test]
225237fn test_sembr_then_prettify ( ) {
226238 let original = "\
You can’t perform that action at this time.
0 commit comments