Skip to content

Commit

Permalink
generalize upgrade: skip spaces after a successful OptionalMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
dginev committed Jan 12, 2024
1 parent c77bb90 commit 798ea50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/LaTeXML/Core/Parameter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ sub read {
"Missing argument " . Stringify($self) . " for " . Stringify($fordefn),
"Ended at " . ToString($gullet->getLocator));
$value = T_OTHER('missing'); }
elsif ($value && $$self{optional} && $$self{type} =~ /^OptionalMatch/) {
# experiment: skip spaces after a successful OptionalMatch read
$gullet->skipSpaces; }
return $value; }

# This is needed by structured parameter types like KeyVals
Expand Down
4 changes: 2 additions & 2 deletions lib/LaTeXML/Package/pdfTeX.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ DefMacro('\pdfmapline{}', '');
# \vadjust [ pre spec ] filler { vertical mode material } (h, m)
DefMacro('\quitvmode', '');
# \pdfliteral [ pdfliteral spec ] general text (h, v, m)
DefPrimitive('\pdfliteral OptionalMatch:direct SkipSpaces OptionalMatch:page GeneralText', sub { (); });
DefPrimitive('\pdfliteral OptionalMatch:direct OptionalMatch:page GeneralText', sub { (); });
# \special pdfspecial spec
# \pdfresettimer
DefPrimitive('\pdfresettimer', sub { (); });
Expand All @@ -207,7 +207,7 @@ DefPrimitive('\pdfresettimerresettimer', sub { (); });
# TODO: https://tex.stackexchange.com/questions/13771/let-a-control-sequence-to-a-redefined-primitive
DefMacro('\pdfprimitive DefToken', '#1'); # we can just ignore the advanced effects for now.
# \pdfcolorstack stack number stack action general text
DefPrimitive('\pdfcolorstack Number OptionalMatch:set SkipSpaces OptionalMatch:push SkipSpaces OptionalMatch:pop SkipSpaces OptionalMatch:current', sub {
DefPrimitive('\pdfcolorstack Number OptionalMatch:set OptionalMatch:push OptionalMatch:pop OptionalMatch:current', sub {
# for now, carefully read and discard all arguments
my ($stomach, $number, $set, $push, $pop, $current) = @_;
return if ($pop);
Expand Down

0 comments on commit 798ea50

Please sign in to comment.