mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add some String methods that the RapydScript compiler uses
This commit is contained in:
parent
cb34ffd380
commit
71b7a434fa
@ -95,9 +95,10 @@ class Context(object):
|
||||
self.g.Duktape.readfile = readfile
|
||||
self.eval('''
|
||||
console = { log: function() { print(Array.prototype.join.call(arguments, ' ')); } };
|
||||
Duktape.modSearch = function (id, require, exports, module) {
|
||||
return Duktape.load_file(id);
|
||||
}
|
||||
Duktape.modSearch = function (id, require, exports, module) { return Duktape.load_file(id); }
|
||||
String.prototype.trimLeft = function() { return this.replace(/^\s+/, ''); };
|
||||
String.prototype.trimRight = function() { return this.replace(/\s+$/, ''); };
|
||||
String.prototype.trim = function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); };
|
||||
''')
|
||||
|
||||
def eval(self, code='', fname='<eval>', noreturn=False):
|
||||
|
Loading…
x
Reference in New Issue
Block a user