1LaTeXML::Common::ObjectU(s3e)r Contributed Perl DocumentaLtaiToenXML::Common::Object(3)
2
3
4
6 "LaTeXML::Common::Object" - abstract base class for most LaTeXML
7 objects.
8
10 "LaTeXML::Common::Object" serves as an abstract base class for all
11 other objects (both the data objects and control objects). It provides
12 for common methods for stringification and comparison operations to
13 simplify coding and to beautify error reporting.
14
15 Generic functions
16 "$string = Stringify($object);"
17 Returns a string identifying $object, for debugging. Works on any
18 values and objects, but invokes the stringify method on blessed
19 objects. More informative than the default perl conversion to a
20 string.
21
22 "$string = ToString($object);"
23 Converts $object to string attempting, when possible, to generate
24 straight text without TeX markup. This is most useful for
25 converting Tokens or Boxes to document content or attribute values,
26 or values to be used for pathnames, keywords, etc. Generally,
27 however, it is not possible to convert Whatsits generated by
28 Constructors into clean strings, without TeX markup. Works on any
29 values and objects, but invokes the toString method on blessed
30 objects.
31
32 "$boolean = Equals($x,$y);"
33 Compares the two objects for equality. Works on any values and
34 objects, but invokes the equals method on blessed objects, which
35 does a deep comparison of the two objects.
36
37 "$tokens = Revert($object);"
38 Returns a Tokens list containing the TeX that would create $object.
39 Note that this is not necessarily the original TeX code; expansions
40 or other substitutions may have taken place.
41
42 Methods
43 "$string = $object->stringify;"
44 Returns a readable representation of $object, useful for debugging.
45
46 "$string = $object->toString;"
47 Returns the string content of $object; most useful for extracting a
48 clean, usable, Unicode string from tokens or boxes that might
49 representing a filename or such. To the extent possible, this
50 should provide a string that can be used as XML content, or
51 attribute values, or for filenames or whatever. However, control
52 sequences defined as Constructors may leave TeX code in the value.
53
54 "$boole = $object->equals($other);"
55 Returns whether $object and $other are equal. Should perform a
56 deep comparision, but the default implementation just compares for
57 object identity.
58
59 "$boole = $object->isaToken;"
60 Returns whether $object is an LaTeXML::Core::Token.
61
62 "$boole = $object->isaBox;"
63 Returns whether $object is an LaTeXML::Core::Box.
64
65 "$boole = $object->isaDefinition;"
66 Returns whether $object is an LaTeXML::Core::Definition.
67
68 "$digested = $object->beDigested;"
69 Does whatever is needed to digest the object, and return the
70 digested representation. Tokens would be digested into boxes; Some
71 objects, such as numbers can just return themselves.
72
73 "$object->beAbsorbed($document);"
74 Do whatever is needed to absorb the $object into the $document,
75 typically by invoking appropriate methods on the $document.
76
78 Bruce Miller <bruce.miller@nist.gov>
79
81 Public domain software, produced as part of work done by the United
82 States Government & not subject to copyright in the US.
83
84
85
86perl v5.32.0 2020-11-17 LaTeXML::Common::Object(3)