|
@@ 1376-1406 (lines=31) @@
|
| 1373 |
|
"first-section-level must be positive or zero for category " + category |
| 1374 |
|
) |
| 1375 |
|
|
| 1376 |
|
if "last-section-level" in definition: |
| 1377 |
|
if isinstance(definition["last-section-level"], MetaString): |
| 1378 |
|
value = definition["last-section-level"].text |
| 1379 |
|
elif ( |
| 1380 |
|
isinstance(definition["last-section-level"], MetaInlines) |
| 1381 |
|
and len(definition["last-section-level"].content) == 1 |
| 1382 |
|
): |
| 1383 |
|
value = definition["last-section-level"].content[0].text |
| 1384 |
|
else: |
| 1385 |
|
debug( |
| 1386 |
|
"[WARNING] pandoc-numbering: " |
| 1387 |
|
"last-section-level is not correct for category " + category |
| 1388 |
|
) |
| 1389 |
|
return |
| 1390 |
|
|
| 1391 |
|
# Get the level |
| 1392 |
|
try: |
| 1393 |
|
level = int(value) |
| 1394 |
|
except ValueError: |
| 1395 |
|
debug( |
| 1396 |
|
"[WARNING] pandoc-numbering: " |
| 1397 |
|
"last-section-level is not correct for category " + category |
| 1398 |
|
) |
| 1399 |
|
|
| 1400 |
|
if 0 <= level <= 6: |
| 1401 |
|
defined[category]["last-section-level"] = level |
| 1402 |
|
else: |
| 1403 |
|
# pylint: disable=line-too-long |
| 1404 |
|
debug( |
| 1405 |
|
"[WARNING] pandoc-numbering: " |
| 1406 |
|
"last-section-level must be positive or zero for category " + category |
| 1407 |
|
) |
| 1408 |
|
|
| 1409 |
|
|
|
@@ 1343-1373 (lines=31) @@
|
| 1340 |
|
# Compute the first and last levels section |
| 1341 |
|
defined[category]["first-section-level"] = len(match.group("hidden")) // 2 |
| 1342 |
|
defined[category]["last-section-level"] = len(match.group("header")) // 2 |
| 1343 |
|
if "first-section-level" in definition: |
| 1344 |
|
if isinstance(definition["first-section-level"], MetaString): |
| 1345 |
|
value = definition["first-section-level"].text |
| 1346 |
|
elif ( |
| 1347 |
|
isinstance(definition["first-section-level"], MetaInlines) |
| 1348 |
|
and len(definition["first-section-level"].content) == 1 |
| 1349 |
|
): |
| 1350 |
|
value = definition["first-section-level"].content[0].text |
| 1351 |
|
else: |
| 1352 |
|
debug( |
| 1353 |
|
"[WARNING] pandoc-numbering: " |
| 1354 |
|
"first-section-level is not correct for category " + category |
| 1355 |
|
) |
| 1356 |
|
return |
| 1357 |
|
|
| 1358 |
|
# Get the level |
| 1359 |
|
try: |
| 1360 |
|
level = int(value) - 1 |
| 1361 |
|
except ValueError: |
| 1362 |
|
debug( |
| 1363 |
|
"[WARNING] pandoc-numbering: " |
| 1364 |
|
"first-section-level is not correct for category " + category |
| 1365 |
|
) |
| 1366 |
|
|
| 1367 |
|
if 0 <= level <= 6: |
| 1368 |
|
defined[category]["first-section-level"] = level |
| 1369 |
|
else: |
| 1370 |
|
# pylint: disable=line-too-long |
| 1371 |
|
debug( |
| 1372 |
|
"[WARNING] pandoc-numbering: " |
| 1373 |
|
"first-section-level must be positive or zero for category " + category |
| 1374 |
|
) |
| 1375 |
|
|
| 1376 |
|
if "last-section-level" in definition: |