Code Duplication    Length = 13-16 lines in 2 locations

pandoc_numbering.py 2 locations

@@ 564-579 (lines=16) @@
561
562
def getDefaultLevels(category, meta):
563
    if not hasattr(getDefaultLevels, 'value'):
564
        getDefaultLevels.value = {}
565
        if hasMeta(meta):
566
            # Loop on all listings definition
567
            for definition in meta['pandoc-numbering']['c']:
568
                if isCorrect(definition):
569
                    levelInf = 0
570
                    levelSup = 0
571
                    if hasProperty(definition, 'sectioning', 'MetaInlines') and\
572
                       len(getProperty(definition, 'sectioning')) == 1 and\
573
                       getProperty(definition, 'sectioning')[0]['t'] == 'Str':
574
575
                        global headerRegex
576
577
                        match = re.match('^' + headerRegex + '$', getFirstValue(definition, 'sectioning'))
578
                        if match:
579
                            # Compute the levelInf and levelSup values
580
                            levelInf = len(match.group('hidden')) // 2
581
                            levelSup = len(match.group('header')) // 2
582
                    else:
@@ 498-510 (lines=13) @@
495
                        '\\makeatletter',
496
                        '\\newcommand*\\l@' + latexCategory + '{\\@dottedtocline{1}{' + str(tab) + 'em}{'+ str(space) +'em}}',
497
                        '\\@starttoc{' + latexCategory + '}',
498
                        '\\makeatother'
499
                    ]
500
                    elt = [RawBlock('tex', ''.join(latex))]
501
                else:
502
                    if category in collections:
503
                        # Prepare the list
504
                        elements = []
505
506
                        # Loop on the collection
507
                        for tag in collections[category]:
508
509
                            # Add an item to the list
510
                            text = information[tag]['toc']
511
512
                            if pandocVersion() < '1.16':
513
                                # pandoc 1.15