@@ -40,31 +40,30 @@ def buildContentElement(self, par):
4040 par .text = "\n "
4141 par .tail = "\n "
4242
43-
4443 def buildCaptionElement (self , par , title ):
45- capcaption = ElementTree .SubElement (par , "figcaption" )
44+ caption = ElementTree .SubElement (par , "figcaption" )
4645 if self .captionClass is not "" :
47- capcaption .set ("class" , self .captionClass )
46+ caption .set ("class" , self .captionClass )
4847 if self .captionNumbering :
49- captionPrefixSpan = ElementTree .SubElement (capcaption , "span" )
48+ captionPrefixSpan = ElementTree .SubElement (caption , "span" )
5049 captionPrefixSpan .text = "{} {}:" .format (self .captionPrefix , self .captionNumber )
5150 captionPrefixSpan .tail = " {}" .format (title )
5251 if self .captionPrefixClass is not "" :
5352 captionPrefix .set ("class" , self .captionPrefixClass )
5453 else :
55- capcaption .text = title
56- capcaption .tail = "\n "
54+ caption .text = title
55+ caption .tail = "\n "
5756
5857 def run (self , root ):
5958 for par in root .findall ("./p[img]" ):
60- self .captionNumber += 1
6159 img = par .find ("img" )
60+ self .captionNumber += 1
6261 self .buildContentElement (par )
6362 img .tail = "\n "
64- if self .stripTitle :
65- del img .attrib ["title" ]
6663 par .append (img )
6764 self .buildCaptionElement (par , img .get ("title" ))
65+ if self .stripTitle :
66+ del img .attrib ["title" ]
6867
6968class captionExtension (Extension ):
7069 def __init__ (self , ** kwargs ):
0 commit comments