Code Duplication    Length = 13-16 lines in 2 locations

pandoc_numbering.py 2 locations

@@ 564-579 (lines=16) @@
561
                    levelInf = 0
562
                    levelSup = 0
563
                    if hasProperty(definition, 'sectioning', 'MetaInlines') and\
564
                       len(getProperty(definition, 'sectioning')) == 1 and\
565
                       getProperty(definition, 'sectioning')[0]['t'] == 'Str':
566
567
                        global headerRegex
568
569
                        match = re.match('^' + headerRegex + '$', getFirstValue(definition, 'sectioning'))
570
                        if match:
571
                            # Compute the levelInf and levelSup values
572
                            levelInf = len(match.group('hidden')) // 2
573
                            levelSup = len(match.group('header')) // 2
574
                    else:
575
                        if hasProperty(definition, 'first', 'MetaString'):
576
                            try:
577
                                levelInf = max(min(int(getProperty(definition, 'first')) - 1, 6), 0)
578
                            except ValueError:
579
                                pass
580
                        if hasProperty(definition, 'last', 'MetaString'):
581
                            try:
582
                                levelSup = max(min(int(getProperty(definition, 'last')), 6), levelInf)
@@ 498-510 (lines=13) @@
495
                        # Prepare the list
496
                        elements = []
497
498
                        # Loop on the collection
499
                        for tag in collections[category]:
500
501
                            # Add an item to the list
502
                            text = information[tag]['toc']
503
504
                            if pandocVersion() < '1.16':
505
                                # pandoc 1.15
506
                                link = Link(text, ['#' + tag, ''])
507
                            else:
508
                                # pandoc 1.16
509
                                link = Link(['', [], []], text, ['#' + tag, ''])
510
511
                            elements.append([Plain([link])])
512
513
                        # Add a bullet list