[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: ASCII spaces only
From: |
Gavin D. Smith |
Subject: |
branch master updated: ASCII spaces only |
Date: |
Mon, 17 Jan 2022 15:34:56 -0500 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new c765f5a488 ASCII spaces only
c765f5a488 is described below
commit c765f5a488f20d353493ac72be63c3eb045cb8af
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Jan 17 20:34:45 2022 +0000
ASCII spaces only
* tp/Texinfo/Convert/Plaintext.pm (_align_lines, _convert):
Use /a in regexps where \s or \S is used. This also has a possible
performance benefit.
---
ChangeLog | 8 ++++++++
tp/Texinfo/Convert/Plaintext.pm | 22 +++++++++++-----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 37812d3144..44dd941c7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-01-17 Gavin Smith <gavinsmith0123@gmail.com>
+
+ ASCII spaces only
+
+ * tp/Texinfo/Convert/Plaintext.pm (_align_lines, _convert):
+ Use /a in regexps where \s or \S is used. This also has a possible
+ performance benefit.
+
2022-01-17 Gavin Smith <gavinsmith0123@gmail.com>
ASCII spaces only
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index ab56d25e32..50863a4b2a 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -993,9 +993,9 @@ sub _align_lines($$$$$$)
# for debugging.
$orig_line = $line;
$removed_line_bytes_end -= count_bytes($self, $chomped);
- $line =~ s/^(\s*)//;
+ $line =~ s/^(\s*)//a;
$removed_line_bytes_begin -= count_bytes($self, $1);
- $line =~ s/(\s*)$//;
+ $line =~ s/(\s*)$//a;
$removed_line_bytes_end -= count_bytes($self, $1);
my $line_width = Texinfo::Convert::Unicode::string_width($line);
if ($line_width == 0) {
@@ -1817,7 +1817,7 @@ sub _convert($$)
if ($command eq 'strong'
and scalar (@{$element->{'args'}->[0]->{'contents'}})
and $element->{'args'}->[0]->{'contents'}->[0]->{'text'}
- and $element->{'args'}->[0]->{'contents'}->[0]->{'text'} =~
/^Note\s/i
+ and $element->{'args'}->[0]->{'contents'}->[0]->{'text'} =~
/^Note\s/ai
and $self->{'output_format'}
and $self->{'output_format'} eq 'info') {
$self->line_warn($self, __(
@@ -2078,7 +2078,7 @@ sub _convert($$)
my $post_quote = $pre_quote;
$name_text .= _convert($self, {'contents' => [
{'text' => "$post_quote: "}]});
- $name_text =~ s/^(\s*)/$1$pre_quote/ if $pre_quote;
+ $name_text =~ s/^(\s*)/$1$pre_quote/a if $pre_quote;
$result .= $name_text;
_count_added($self,$self->{'formatters'}[-1]{'container'},
$pre_quote)
@@ -2098,9 +2098,9 @@ sub _convert($$)
my $node_text_checked = $node_text
.get_pending($self->{'formatters'}->[-1]->{'container'});
- $maybe_file =~ s/^\s*//;
+ $maybe_file =~ s/^\s*//a;
$maybe_file = quotemeta $maybe_file;
- $node_text_checked =~ s/^\s*$maybe_file//;
+ $node_text_checked =~ s/^\s*$maybe_file//a;
$quoting_required = 0;
if ($node_text_checked =~ /([,\t\.])/m ) {
if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
@@ -2115,7 +2115,7 @@ sub _convert($$)
$pre_quote = $quoting_required ? "\x{7f}" : '';
$post_quote = $pre_quote;
if ($pre_quote) {
- $node_text =~ s/^(\s*)/$1$pre_quote/;
+ $node_text =~ s/^(\s*)/$1$pre_quote/a;
_count_added($self,$self->{'formatters'}[-1]{'container'},
$pre_quote);
}
@@ -2162,7 +2162,7 @@ sub _convert($$)
shift @{$self->{'current_contents'}->[-1]};
}
- $node_text =~ s/^(\s*)/$1$pre_quote/;
+ $node_text =~ s/^(\s*)/$1$pre_quote/a;
}
$result .= $node_text;
}
@@ -2182,7 +2182,7 @@ sub _convert($$)
if ($command eq 'xref') {
if ($next and defined($next->{'text'}) and $next->{'text'} =~
/\S/) {
my $text = $next->{'text'};
- $text =~ s/^\s*//;
+ $text =~ s/^\s*//a;
my $char = substr($text, 0, 1);
$self->line_warn($self, sprintf(__(
"`.' or `,' must follow \@xref, not %s"),
@@ -2649,7 +2649,7 @@ sub _convert($$)
my $old_context = pop @{$self->{'context'}};
delete $self->{'multiple_pass'};
die if ($old_context ne 'listoffloats');
- while ($caption_text =~
s/^\s*(\p{Unicode::EastAsianWidth::InFullwidth}\s*|\S+\s*)//) {
+ while ($caption_text =~
s/^\s*(\p{Unicode::EastAsianWidth::InFullwidth}\s*|\S+\s*)//a) {
my $new_word = $1;
$new_word =~ s/\n//g;
if ((Texinfo::Convert::Unicode::string_width($new_word) +
@@ -2972,7 +2972,7 @@ sub _convert($$)
delete $self->{'formatters'}->[-1]->{'suppress_styles'};
$pre_quote = $post_quote = '';
if ($entry_name_seen) {
- if ($node_text =~ /([,\t]|\.\s)/) {
+ if ($node_text =~ /([,\t]|\.\s)/a) {
if ($self->get_conf('INFO_SPECIAL_CHARS_WARNING')) {
$self->line_warn($self, sprintf(__(
"menu entry node name should not contain `%s'"), $1),