| 1 | # /=====================================================================\ # | ||
| 2 | # | LaTeXML::Post::LexMath | # | ||
| 3 | # | Copy Lexemes as parallel Math | # | ||
| 4 | # \=========================================================ooo==U==ooo=/ # | ||
| 5 | |||
| 6 | # ================================================================================ | ||
| 7 | # Trivial Math PostProcessor which supplies the lexemes string | ||
| 8 | # (if deposited in the lexemes attribute of the XMath) | ||
| 9 | # currently required to --preload=llamapun.sty to achieve that | ||
| 10 | # ================================================================================ | ||
| 11 | |||
| 12 | package LaTeXML::Post::LexMath; | ||
| 13 | use strict; | ||
| 14 | use warnings; | ||
| 15 | use LaTeXML::Common::XML; | ||
| 16 | use LaTeXML::Post; | ||
| 17 | use base qw(LaTeXML::Post::MathProcessor); | ||
| 18 | |||
| 19 | #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
| 20 | # Top level | ||
| 21 | #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
| 22 | |||
| 23 | our $lxMimeType = 'application/x-llamapun'; | ||
| 24 | |||
| 25 | sub convertNode { | ||
| 26 | my ($self, $doc, $xmath, $style) = @_; | ||
| 27 | my $math = $xmath->parentNode; | ||
| 28 | my $lexemes = $math && isElementNode($math) && $math->getAttribute('lexemes'); | ||
| 29 | return { processor => $self, encoding => $lxMimeType, mimetype => $lxMimeType, | ||
| 30 | string => $lexemes }; } | ||
| 31 | |||
| 32 | sub rawIDSuffix { | ||
| 33 | return '.lm'; } | ||
| 34 | |||
| 35 | #================================================================================ | ||
| 36 | |||
| 37 | 1; |