Code Duplication    Length = 41-41 lines in 2 locations

pandoc_numbering.py 2 locations

@@ 1348-1388 (lines=41) @@
1345
            )
1346
1347
1348
def meta_entry_space(category, definition, defined):
1349
    """
1350
    Compute entry space for a category.
1351
1352
    Arguments
1353
    ---------
1354
    category
1355
        The category
1356
    definition
1357
        The definition
1358
    defined
1359
        The defined parameter
1360
    """
1361
    if "entry-space" in definition:
1362
        if isinstance(definition["entry-space"], MetaString):
1363
            value = definition["entry-space"].text
1364
        elif (
1365
            isinstance(definition["entry-space"], MetaInlines)
1366
            and len(definition["entry-space"].content) == 1
1367
        ):
1368
            value = definition["entry-space"].content[0].text
1369
        else:
1370
            debug(
1371
                "[WARNING] pandoc-numbering: entry-space is not correct for category "
1372
                + category
1373
            )
1374
            return
1375
        # Get the space
1376
        try:
1377
            space = float(value)
1378
            if space > 0:
1379
                defined[category]["entry-space"] = space
1380
            else:
1381
                debug(
1382
                    "[WARNING] pandoc-numbering: "
1383
                    "entry-space must be positive for category " + category
1384
                )
1385
        except ValueError:
1386
            debug(
1387
                "[WARNING] pandoc-numbering: entry-space is not correct for category "
1388
                + category
1389
            )
1390
1391
@@ 1304-1344 (lines=41) @@
1301
            )
1302
1303
1304
def meta_entry_tab(category, definition, defined):
1305
    """
1306
    Compute entry tab for a category.
1307
1308
    Arguments
1309
    ---------
1310
    category
1311
        The category
1312
    definition
1313
        The definition
1314
    defined
1315
        The defined parameter
1316
    """
1317
    if "entry-tab" in definition:
1318
        if isinstance(definition["entry-tab"], MetaString):
1319
            value = definition["entry-tab"].text
1320
        elif (
1321
            isinstance(definition["entry-tab"], MetaInlines)
1322
            and len(definition["entry-tab"].content) == 1
1323
        ):
1324
            value = definition["entry-tab"].content[0].text
1325
        else:
1326
            debug(
1327
                "[WARNING] pandoc-numbering: entry-tab is not correct for category "
1328
                + category
1329
            )
1330
            return
1331
        # Get the tab
1332
        try:
1333
            tab = float(value)
1334
            if tab > 0:
1335
                defined[category]["entry-tab"] = tab
1336
            else:
1337
                debug(
1338
                    "[WARNING] pandoc-numbering: "
1339
                    "entry-tab must be positive for category " + category
1340
                )
1341
        except ValueError:
1342
            debug(
1343
                "[WARNING] pandoc-numbering: entry-tab is not correct for category "
1344
                + category
1345
            )
1346
1347