/usr/share/pyshared/plasTeX/Packages/babel.py is in python-plastex 0.9.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | from plasTeX import Command, Environment
def ProcessOptions(options, document):
context = document.context
languages = document.context.languages.keys()
for key, value in options.items():
if key in languages:
context.loadLanguage(key, document)
class selectlanguage(Command):
args = 'lang:str'
def invoke(self, tex):
res = Command.invoke(self, tex)
context.loadLanguage(self.attributes['lang'], self.ownerDocument)
return res
class otherlanguage(Environment):
args = 'lang:str'
def invoke(self, tex):
res = Environment.invoke(self, tex)
doc = self.ownerDocument
if self.macroMode != self.MODE_END:
self.ownerDocument.userdata.setPath('babel/previouslanguage',
doc.context.currentLanguage)
doc.context.loadLanguage(self.attributes['lang'], self.ownerDocument)
else:
lang = doc.userdata.getPath('babel/previouslanguage')
doc.context.loadLanguage(lang, self.ownerDocument)
return res
class foreignlanguage(Command):
args = 'lang:str self'
def postArgument(self, arg, value, tex):
if arg.name == 'lang':
doc = self.ownerDocument
doc.userdata.setPath('babel/previouslanguage',
doc.context.currentLanguage)
doc.context.loadLanguage(value, doc)
else:
Command.postArgument(self, arg, value, tex)
def invoke(self, tex):
res = Command.invoke(self, tex)
doc = self.ownerDocument
lang = doc.userdata.getPath('babel/previouslanguage')
doc.context.loadLanguage(lang, doc)
return res
class OtherLanguageStar(Environment):
args = 'lang:str'
macroName = 'otherlanguage*'
class iflanguage(Command):
args = 'lang:str yes:nox no:nox'
def invoke(self, tex):
res = Command.invoke(self, tex)
if self.ownerDocument.context.currentLanguage == self.attributes['lang']:
return self.attributes['yes']
return self.attributes['no']
|