Skip to content

Commit

Permalink
only replace spaces before the verbatim* ends
Browse files Browse the repository at this point in the history
  • Loading branch information
teepeemm committed Aug 5, 2023
1 parent b569ec3 commit d243963
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lib/LaTeXML/Package/LaTeX.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -1920,13 +1920,18 @@ sub afterDigestVerbatim {
my @lines = ();
my $gullet = $stomach->getGullet;
while (defined(my $line = $gullet->readRawLine)) {
my ($exiting, $remaining) = (0, undef);
if ($line =~ /^(.*?)\Q$end\E(.*?)$/) {
$exiting = 1;
$line = $1;
$remaining = $2; }
# The raw chars will still have to be decoded (but not space!!)
$line = join('', map { ($_ eq ' ' ? $space : FontDecodeString($_, 'OT1_typewriter')) }
split(//, $line));
if ($line =~ /^(.*?)\Q$end\E(.*?)$/) {
push(@lines, $1 . "\n"); $gullet->unread(Tokenize($2), T_CR);
last; }
push(@lines, $line . "\n"); }
push(@lines, $line . "\n");
if ($exiting) {
$gullet->unread(Tokenize($remaining), T_CR);
last; } }
pop(@lines) if $lines[-1] eq "\n";
# Note last line ends up as Whatsit's "trailer"
if (my $b = LookupValue('@environment@verbatim@atend')) {
Expand Down
2 changes: 1 addition & 1 deletion t/tokenize/verb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ More Normal <text font="bold">Bold</text> stuff.</p>
AbNormal␣{\bf␣NonBold}␣stuff.
keep␣this␣too␣␣␣␣
</verbatim>
<p>outsideverbatim
<p>outside verbatim
More Normal <text font="bold">Bold</text> stuff.</p>
</para>
</section>
Expand Down

0 comments on commit d243963

Please sign in to comment.