mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Convert leading tabs to 4 spaces
This commit is contained in:
parent
97a0ae8a3e
commit
5d00117f44
@ -449,8 +449,13 @@ class FormatterUserFunction(FormatterFunction):
|
|||||||
self.arg_count = arg_count
|
self.arg_count = arg_count
|
||||||
self.program_text = program_text
|
self.program_text = program_text
|
||||||
|
|
||||||
|
tabs = re.compile(r'^\t*')
|
||||||
def compile_user_function(name, doc, arg_count, eval_func):
|
def compile_user_function(name, doc, arg_count, eval_func):
|
||||||
func = '\t' + eval_func.replace('\n', '\n\t')
|
def replace_func(mo):
|
||||||
|
return mo.group().replace('\t', ' ')
|
||||||
|
|
||||||
|
func = ' ' + '\n '.join([tabs.sub(replace_func, line )
|
||||||
|
for line in eval_func.splitlines()])
|
||||||
prog = '''
|
prog = '''
|
||||||
from calibre.utils.formatter_functions import FormatterUserFunction
|
from calibre.utils.formatter_functions import FormatterUserFunction
|
||||||
class UserFunction(FormatterUserFunction):
|
class UserFunction(FormatterUserFunction):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user