@@ -283,6 +283,7 @@ def process(meta):
283
283
for name in ['eqnos-warning-level' , 'xnos-warning-level' ]:
284
284
if name in meta :
285
285
warninglevel = int (get_meta (meta , name ))
286
+ pandocxnos .set_warning_level (warninglevel )
286
287
break
287
288
288
289
metanames = ['eqnos-warning-level' , 'xnos-warning-level' ,
@@ -386,34 +387,33 @@ def add_tex(meta):
386
387
\\ usepackage%s{cleveref}
387
388
""" % ('[capitalise]' if capitalise else '' )
388
389
pandocxnos .add_to_header_includes (
389
- meta , 'tex' , tex , warninglevel ,
390
- r'\\usepackage(\[[\w\s,]*\])?\{cleveref\}' )
390
+ meta , 'tex' , tex ,
391
+ regex = r'\\usepackage(\[[\w\s,]*\])?\{cleveref\}' )
391
392
392
393
pandocxnos .add_to_header_includes (
393
- meta , 'tex' , DISABLE_CLEVEREF_BRACKETS_TEX , warninglevel )
394
+ meta , 'tex' , DISABLE_CLEVEREF_BRACKETS_TEX )
394
395
395
396
if plusname_changed and references :
396
397
tex = """
397
398
%%%% pandoc-eqnos: change cref names
398
399
\\ crefname{equation}{%s}{%s}
399
400
""" % (plusname [0 ], plusname [1 ])
400
- pandocxnos .add_to_header_includes (meta , 'tex' , tex , warninglevel )
401
+ pandocxnos .add_to_header_includes (meta , 'tex' , tex )
401
402
402
403
if starname_changed and references :
403
404
tex = """
404
405
%%%% pandoc-eqnos: change Cref names
405
406
\\ Crefname{equation}{%s}{%s}
406
407
""" % (starname [0 ], starname [1 ])
407
- pandocxnos .add_to_header_includes (meta , 'tex' , tex , warninglevel )
408
+ pandocxnos .add_to_header_includes (meta , 'tex' , tex )
408
409
409
410
if numbersections and references :
410
- pandocxnos .add_to_header_includes (
411
- meta , 'tex' , NUMBER_BY_SECTION_TEX , warninglevel )
411
+ pandocxnos .add_to_header_includes (meta , 'tex' , NUMBER_BY_SECTION_TEX )
412
412
413
413
if secoffset and references :
414
414
pandocxnos .add_to_header_includes (
415
- meta , 'tex' , SECOFFSET_TEX % secoffset , warninglevel ,
416
- r'\\setcounter\{section\}' )
415
+ meta , 'tex' , SECOFFSET_TEX % secoffset ,
416
+ regex = r'\\setcounter\{section\}' )
417
417
418
418
if warnings :
419
419
STDERR .write ('\n ' )
@@ -440,8 +440,7 @@ def add_html(meta):
440
440
# See https://github.com/jgm/pandoc/issues/3139.
441
441
442
442
if references :
443
- pandocxnos .add_to_header_includes (
444
- meta , 'html' , EQUATION_STYLE_HTML , warninglevel )
443
+ pandocxnos .add_to_header_includes (meta , 'html' , EQUATION_STYLE_HTML )
445
444
446
445
# pylint: disable=too-many-locals, unused-argument
447
446
def main (stdin = STDIN , stdout = STDOUT , stderr = STDERR ):
@@ -479,8 +478,7 @@ def main(stdin=STDIN, stdout=STDOUT, stderr=STDERR):
479
478
process (meta )
480
479
481
480
# First pass
482
- attach_attrs_math = attach_attrs_factory (Math , warninglevel ,
483
- allow_space = True )
481
+ attach_attrs_math = attach_attrs_factory (Math , allow_space = True )
484
482
detach_attrs_math = detach_attrs_factory (Math )
485
483
insert_secnos = insert_secnos_factory (Math )
486
484
delete_secnos = delete_secnos_factory (Math )
@@ -490,15 +488,14 @@ def main(stdin=STDIN, stdout=STDOUT, stderr=STDERR):
490
488
detach_attrs_math ], blocks )
491
489
492
490
# Second pass
493
- process_refs = process_refs_factory (LABEL_PATTERN , references .keys (),
494
- warninglevel )
491
+ process_refs = process_refs_factory (LABEL_PATTERN , references .keys ())
495
492
replace_refs = replace_refs_factory (references ,
496
493
cleveref , eqref ,
497
494
plusname if not capitalise or \
498
495
plusname_changed else
499
496
[name .title () for name in plusname ],
500
497
starname )
501
- attach_attrs_span = attach_attrs_factory (Span , warninglevel , replace = True )
498
+ attach_attrs_span = attach_attrs_factory (Span , replace = True )
502
499
altered = functools .reduce (lambda x , action : walk (x , action , fmt , meta ),
503
500
[repair_refs , process_refs , replace_refs ,
504
501
attach_attrs_span ],
0 commit comments