1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
|
"""
B.5 Macros for text
"""
from plasTeX import Command, sourceChildren
class frenchspacing(Command):
str = ''
class nonfrenchspacing(Command):
str = ''
class normalbaselines(Command):
str = ''
class lq(Command):
str = chr(8216)
class rq(Command):
str = chr(8217)
class lbrack(Command):
str = '['
class rbrack(Command):
str = ']'
class space(Command):
str = ' '
class empty(Command):
str = ''
class null(Command):
str = ''
class bgroup(Command):
def invoke(self, tex):
self.ownerDocument.context.push()
def digest(self, tokens):
# Absorb the tokens that belong to us
for item in tokens:
if item.nodeType == Command.ELEMENT_NODE:
if item.level < self.ENDSECTIONS_LEVEL:
tokens.push(item)
break
if isinstance(item, (egroup,endgroup)):
self.endit = True
break
if item.contextDepth < self.contextDepth:
tokens.push(item)
break
item.parentNode = self
item.digest(tokens)
self.appendChild(item)
self.paragraphs(force=False)
@property
def source(self):
if self.hasChildNodes():
return '{%s}' % sourceChildren(self)
elif hasattr(self, 'endit'):
return '{}'
return '{'
class begingroup(bgroup):
pass
class egroup(Command):
str = ''
def invoke(self, tex):
self.ownerDocument.context.pop()
@property
def source(self):
return '}'
def digest(self, tokens):
return
class endgroup(egroup):
str = ''
class obeyspaces(Command):
str = ''
class loop(Command):
args = 'var:Tok'
str = ''
class iterate(Command):
str = ''
class repeat(Command):
str = ''
class enskip(Command):
pass
class enspace(Command):
pass
class quad(Command):
pass
class qquad(Command):
pass
class thinspace(Command):
pass
class negthinspace(Command):
pass
class hglue(Command):
pass
class vglue(Command):
pass
class topglue(Command):
pass
class nointerlineskip(Command):
pass
class offinterlineskip(Command):
pass
class TeXBreak(Command):
macroName = 'break'
str = ''
class allowbreak(Command):
str = ''
class ControlSpace(Command):
macroName = 'active::~'
class slash(Command):
pass
class filbreak(Command):
pass
class goodbreak(Command):
pass
class eject(Command):
str = ''
class supereject(Command):
str = ''
class removelastskip(Command):
pass
class smallbreak(Command):
pass
class medbreak(Command):
pass
class bigbreak(Command):
pass
class line(Command):
pass
class leftline(Command):
args = 'self'
class llap(Command):
args = 'self'
class centerline(Command):
args = 'self'
class underbar(Command):
args = 'self'
class uppercase(Command):
args = 'argument:str'
def invoke(self, tex):
Command.invoke(self, tex)
self.attributes['argument'] = self.attributes['argument'].upper()
class hang(Command):
pass
class textindent(Command):
args = 'self'
class narrower(Command):
pass
#
# Accents are done in the LaTeX package
#
class dots(Command):
str = chr(8230)
|