|
5 | 5 | from urllib import parse
|
6 | 6 | from PIL import Image
|
7 | 7 |
|
8 |
| -from . import biblio, config, dfnpanels, h, func, t, messages as m |
| 8 | +from . import biblio, config, dfnpanels, h, func, t, messages as m, idl |
9 | 9 |
|
10 | 10 |
|
11 | 11 | class MarkdownCodeSpans(func.Functor):
|
@@ -1391,19 +1391,26 @@ def formatArgumentdefTables(doc: "t.SpecType"):
|
1391 | 1391 | m.die(f"Can't find method '{forMethod}'.", el=table)
|
1392 | 1392 | continue
|
1393 | 1393 | for tr in h.findAll("tbody > tr", table):
|
1394 |
| - tds = h.findAll("td", tr) |
1395 |
| - argName = h.textContent(tds[0]).strip() |
| 1394 | + try: |
| 1395 | + argCell, typeCell, nullCell, optCell, descCell = h.findAll("td", tr) |
| 1396 | + except: |
| 1397 | + m.die( |
| 1398 | + f"In the argumentdef table for '{method.full_name}', the '{argName}' line is misformatted, with {len(h.findAll('td', tr))} cells instead of 5.", |
| 1399 | + el=table, |
| 1400 | + ) |
| 1401 | + continue |
| 1402 | + argName = h.textContent(argCell).strip() |
1396 | 1403 | arg = method.find_argument(argName)
|
1397 | 1404 | if arg:
|
1398 |
| - h.appendChild(tds[1], str(arg.type)) |
| 1405 | + h.appendChild(typeCell, idl.nodesFromType(arg.type)), |
1399 | 1406 | if str(arg.type).strip().endswith("?"):
|
1400 |
| - h.appendChild(tds[2], h.E.span({"class": "yes"}, "✔")) |
| 1407 | + h.appendChild(nullCell, h.E.span({"class": "yes"}, "✔")) |
1401 | 1408 | else:
|
1402 |
| - h.appendChild(tds[2], h.E.span({"class": "no"}, "✘")) |
| 1409 | + h.appendChild(nullCell, h.E.span({"class": "no"}, "✘")) |
1403 | 1410 | if arg.optional:
|
1404 |
| - h.appendChild(tds[3], h.E.span({"class": "yes"}, "✔")) |
| 1411 | + h.appendChild(optCell, h.E.span({"class": "yes"}, "✔")) |
1405 | 1412 | else:
|
1406 |
| - h.appendChild(tds[3], h.E.span({"class": "no"}, "✘")) |
| 1413 | + h.appendChild(optCell, h.E.span({"class": "no"}, "✘")) |
1407 | 1414 | else:
|
1408 | 1415 | m.die(
|
1409 | 1416 | f"Can't find the '{argName}' argument of method '{method.full_name}' in the argumentdef block.",
|
|
0 commit comments