|
@@ 1457-1487 (lines=31) @@
|
| 1454 |
|
"first-section-level must be positive or zero for category " + category |
| 1455 |
|
) |
| 1456 |
|
|
| 1457 |
|
if "last-section-level" in definition: |
| 1458 |
|
if isinstance(definition["last-section-level"], MetaString): |
| 1459 |
|
value = definition["last-section-level"].text |
| 1460 |
|
elif ( |
| 1461 |
|
isinstance(definition["last-section-level"], MetaInlines) |
| 1462 |
|
and len(definition["last-section-level"].content) == 1 |
| 1463 |
|
): |
| 1464 |
|
value = definition["last-section-level"].content[0].text |
| 1465 |
|
else: |
| 1466 |
|
debug( |
| 1467 |
|
"[WARNING] pandoc-numbering: " |
| 1468 |
|
"last-section-level is not correct for category " + category |
| 1469 |
|
) |
| 1470 |
|
return |
| 1471 |
|
|
| 1472 |
|
# Get the level |
| 1473 |
|
try: |
| 1474 |
|
level = int(value) |
| 1475 |
|
except ValueError: |
| 1476 |
|
debug( |
| 1477 |
|
"[WARNING] pandoc-numbering: " |
| 1478 |
|
"last-section-level is not correct for category " + category |
| 1479 |
|
) |
| 1480 |
|
|
| 1481 |
|
if 0 <= level <= 6: |
| 1482 |
|
defined[category]["last-section-level"] = level |
| 1483 |
|
else: |
| 1484 |
|
# pylint: disable=line-too-long |
| 1485 |
|
debug( |
| 1486 |
|
"[WARNING] pandoc-numbering: " |
| 1487 |
|
"last-section-level must be positive or zero for category " + category |
| 1488 |
|
) |
| 1489 |
|
|
| 1490 |
|
|
|
@@ 1424-1454 (lines=31) @@
|
| 1421 |
|
# Compute the first and last levels section |
| 1422 |
|
defined[category]["first-section-level"] = len(match.group("hidden")) // 2 |
| 1423 |
|
defined[category]["last-section-level"] = len(match.group("header")) // 2 |
| 1424 |
|
if "first-section-level" in definition: |
| 1425 |
|
if isinstance(definition["first-section-level"], MetaString): |
| 1426 |
|
value = definition["first-section-level"].text |
| 1427 |
|
elif ( |
| 1428 |
|
isinstance(definition["first-section-level"], MetaInlines) |
| 1429 |
|
and len(definition["first-section-level"].content) == 1 |
| 1430 |
|
): |
| 1431 |
|
value = definition["first-section-level"].content[0].text |
| 1432 |
|
else: |
| 1433 |
|
debug( |
| 1434 |
|
"[WARNING] pandoc-numbering: " |
| 1435 |
|
"first-section-level is not correct for category " + category |
| 1436 |
|
) |
| 1437 |
|
return |
| 1438 |
|
|
| 1439 |
|
# Get the level |
| 1440 |
|
try: |
| 1441 |
|
level = int(value) - 1 |
| 1442 |
|
except ValueError: |
| 1443 |
|
debug( |
| 1444 |
|
"[WARNING] pandoc-numbering: " |
| 1445 |
|
"first-section-level is not correct for category " + category |
| 1446 |
|
) |
| 1447 |
|
|
| 1448 |
|
if 0 <= level <= 6: |
| 1449 |
|
defined[category]["first-section-level"] = level |
| 1450 |
|
else: |
| 1451 |
|
# pylint: disable=line-too-long |
| 1452 |
|
debug( |
| 1453 |
|
"[WARNING] pandoc-numbering: " |
| 1454 |
|
"first-section-level must be positive or zero for category " + category |
| 1455 |
|
) |
| 1456 |
|
|
| 1457 |
|
if "last-section-level" in definition: |