31
31
from mathics_django .settings import get_doctest_html_data_path
32
32
33
33
# FIXME: remove globalness
34
+ doctest_html_data_path = get_doctest_html_data_path (should_be_readable = True )
34
35
try :
35
- doctest_html_data_path = get_doctest_html_data_path (should_be_readable = True )
36
36
with open (doctest_html_data_path , "rb" ) as doctest_html_data_file :
37
37
doc_data = pickle .load (doctest_html_data_file )
38
38
except IOError :
43
43
class DjangoDocElement :
44
44
def href (self , ajax = False ):
45
45
if ajax :
46
- return "javascript:loadDoc('%s')" % self .get_uri ()
46
+ return f "javascript:loadDoc('{ self .get_uri ()} ')"
47
47
else :
48
- return "/doc%s" % self .get_uri ()
48
+ return f "/doc{ self .get_uri ()} "
49
49
50
50
def get_prev (self ):
51
51
return self .get_prev_next ()[0 ]
@@ -212,7 +212,6 @@ def get_tests(self):
212
212
return tests
213
213
214
214
def html (self ):
215
- counters = {}
216
215
items = [item for item in self .items if not item .is_private ()]
217
216
title_line = self .title + "\n "
218
217
if len (items ) and items [0 ].text .startswith (title_line ):
@@ -221,7 +220,7 @@ def html(self):
221
220
# Or that is the intent. This code is a bit hacky.
222
221
items [0 ].text = items [0 ].text [len (title_line ) :]
223
222
224
- text = "\n " .join (item .html (counters ) for item in items if not item .is_private ())
223
+ text = "\n " .join (item .html () for item in items if not item .is_private ())
225
224
if text == "" :
226
225
# HACK ALERT if text is "" we may have missed some test markup.
227
226
return mark_safe (escape_html (self .rawdoc ))
@@ -262,7 +261,7 @@ def get_collection(self):
262
261
"""Return a list of parts in this doc"""
263
262
return self .doc .parts
264
263
265
- def html (self , counters = None ):
264
+ def html (self ):
266
265
if len (self .tests ) == 0 :
267
266
return "\n "
268
267
return '<ul class="tests">%s</ul>' % (
@@ -302,8 +301,7 @@ def __init__(
302
301
303
302
if text .count ("<dl>" ) != text .count ("</dl>" ):
304
303
raise ValueError (
305
- "Missing opening or closing <dl> tag in "
306
- "{} documentation" .format (title )
304
+ f"Missing opening or closing <dl> tag in { title } documentation"
307
305
)
308
306
309
307
# Needs to come after self.chapter is initialized since
@@ -364,8 +362,7 @@ def __init__(
364
362
365
363
if text .count ("<dl>" ) != text .count ("</dl>" ):
366
364
raise ValueError (
367
- "Missing opening or closing <dl> tag in "
368
- "{} documentation" .format (title )
365
+ f"Missing opening or closing <dl> tag in { title } documentation"
369
366
)
370
367
# print("YYY Adding section", title)
371
368
chapter .sections_by_slug [self .slug ] = self
@@ -450,8 +447,7 @@ def __init__(
450
447
451
448
if text .count ("<dl>" ) != text .count ("</dl>" ):
452
449
raise ValueError (
453
- "Missing opening or closing <dl> tag in "
454
- "{} documentation" .format (title )
450
+ f"Missing opening or closing <dl> tag in { title } documentation"
455
451
)
456
452
self .section .subsections_by_slug [self .slug ] = self
457
453
@@ -520,7 +516,7 @@ def html(self) -> str:
520
516
521
517
522
518
class DjangoDocTests (DocTests ):
523
- def html (self , counters = None ):
519
+ def html (self ):
524
520
if len (self .tests ) == 0 :
525
521
return "\n "
526
522
return '<ul class="tests">%s</ul>' % (
@@ -531,6 +527,6 @@ def html(self, counters=None):
531
527
532
528
533
529
class DjangoDocText (DocText ):
534
- def html (self , counters = None ) -> str :
535
- result = escape_html (self .text , counters = counters )
530
+ def html (self ) -> str :
531
+ result = escape_html (self .text )
536
532
return result
0 commit comments