@@ -488,17 +488,17 @@ def _create_stylesheet(self):
488488 name = self ._get_css_class (ttype )
489489 style = ''
490490 if ndef ['color' ]:
491- style += 'color: %s ; ' % webify (ndef ['color' ])
491+ style += 'color: {} ; ' . format ( webify (ndef ['color' ]) )
492492 if ndef ['bold' ]:
493493 style += 'font-weight: bold; '
494494 if ndef ['italic' ]:
495495 style += 'font-style: italic; '
496496 if ndef ['underline' ]:
497497 style += 'text-decoration: underline; '
498498 if ndef ['bgcolor' ]:
499- style += 'background-color: %s ; ' % webify (ndef ['bgcolor' ])
499+ style += 'background-color: {} ; ' . format ( webify (ndef ['bgcolor' ]) )
500500 if ndef ['border' ]:
501- style += 'border: 1px solid %s ; ' % webify (ndef ['border' ])
501+ style += 'border: 1px solid {} ; ' . format ( webify (ndef ['border' ]) )
502502 if style :
503503 t2c [ttype ] = name
504504 # save len(ttype) to enable ordering the styles by
@@ -561,11 +561,11 @@ def get_background_style_defs(self, arg=None):
561561
562562 def get_linenos_style_defs (self ):
563563 lines = [
564- 'pre { %s }' % self ._pre_style ,
565- 'td.linenos .normal { %s }' % self ._linenos_style ,
566- 'span.linenos { %s }' % self ._linenos_style ,
567- 'td.linenos .special { %s }' % self ._linenos_special_style ,
568- 'span.linenos.special { %s }' % self ._linenos_special_style ,
564+ f 'pre {{ { self ._pre_style } }}' ,
565+ f 'td.linenos .normal {{ { self ._linenos_style } }}' ,
566+ f 'span.linenos {{ { self ._linenos_style } }}' ,
567+ f 'td.linenos .special {{ { self ._linenos_special_style } }}' ,
568+ f 'span.linenos.special {{ { self ._linenos_special_style } }}' ,
569569 ]
570570
571571 return lines
@@ -683,9 +683,9 @@ def _wrap_tablelinenos(self, inner):
683683
684684 if nocls :
685685 if special_line :
686- style = ' style="%s"' % self ._linenos_special_style
686+ style = f ' style="{ self ._linenos_special_style } "'
687687 else :
688- style = ' style="%s"' % self ._linenos_style
688+ style = f ' style="{ self ._linenos_style } "'
689689 else :
690690 if special_line :
691691 style = ' class="special"'
@@ -742,9 +742,9 @@ def _wrap_inlinelinenos(self, inner):
742742
743743 if nocls :
744744 if special_line :
745- style = ' style="%s"' % self ._linenos_special_style
745+ style = f ' style="{ self ._linenos_special_style } "'
746746 else :
747- style = ' style="%s"' % self ._linenos_style
747+ style = f ' style="{ self ._linenos_style } "'
748748 else :
749749 if special_line :
750750 style = ' class="linenos special"'
@@ -794,8 +794,8 @@ def _wrap_div(self, inner):
794794 style .append (self .cssstyles )
795795 style = '; ' .join (style )
796796
797- yield 0 , ('<div' + (self .cssclass and ' class="%s"' % self .cssclass ) +
798- (style and (' style="%s"' % style )) + '>' )
797+ yield 0 , ('<div' + (self .cssclass and f ' class="{ self .cssclass } "' ) +
798+ (style and (f ' style="{ style } "' )) + '>' )
799799 yield from inner
800800 yield 0 , '</div>\n '
801801
@@ -812,7 +812,7 @@ def _wrap_pre(self, inner):
812812
813813 # the empty span here is to keep leading empty lines from being
814814 # ignored by HTML parsers
815- yield 0 , ('<pre' + (style and ' style="%s"' % style ) + '><span></span>' )
815+ yield 0 , ('<pre' + (style and f ' style="{ style } "' ) + '><span></span>' )
816816 yield from inner
817817 yield 0 , '</pre>'
818818
@@ -841,7 +841,7 @@ def _format_lines(self, tokensource):
841841 try :
842842 cspan = self .span_element_openers [ttype ]
843843 except KeyError :
844- title = ' title="%s"' % '.' .join (ttype ) if self .debug_token_types else ''
844+ title = ' title="{}"' . format ( '.' .join (ttype ) ) if self .debug_token_types else ''
845845 if nocls :
846846 css_style = self ._get_css_inline_styles (ttype )
847847 if css_style :
@@ -928,7 +928,7 @@ def _highlight_lines(self, tokensource):
928928 style = (f' style="background-color: { self .style .highlight_color } "' )
929929 yield 1 , f'<span{ style } >{ value } </span>'
930930 else :
931- yield 1 , '<span class="hll">%s </span>' % value
931+ yield 1 , f '<span class="hll">{ value } </span>'
932932 else :
933933 yield 1 , value
934934
0 commit comments