Code Duplication    Length = 19-20 lines in 2 locations

pythonx/markdown_lib/preprocessors.py 2 locations

@@ 299-318 (lines=20) @@
296
                            self.markdown.htmlStash.store('\n\n'.join(items)))
297
                    items = []
298
299
        if items:
300
            if self.markdown_in_raw and 'markdown' in attrs.keys():
301
                items[0] = items[0][left_index:]
302
                items[-1] = items[-1][:-len(right_tag) - 2]
303
                if items[len(items) - 1]:  # not a newline/empty string
304
                    right_index = len(items) + 3
305
                else:
306
                    right_index = len(items) + 2
307
                new_blocks.append(
308
                    self.markdown.htmlStash.store_tag(
309
                        left_tag, attrs, 0, right_index))
310
                placeholderslen = len(self.markdown.htmlStash.tag_data)
311
                new_blocks.extend(self._nested_markdown_in_html(items))
312
                nests = len(self.markdown.htmlStash.tag_data) - placeholderslen
313
                self.markdown.htmlStash.tag_data[-1 - nests][
314
                    'right_index'] += nests - 2
315
            else:
316
                new_blocks.append(
317
                    self.markdown.htmlStash.store('\n\n'.join(items)))
318
            new_blocks.append('\n')
319
320
        new_text = "\n\n".join(new_blocks)
321
        return new_text.split("\n")
@@ 278-296 (lines=19) @@
275
                        text.insert(0, block[data_index:])
276
277
                    in_tag = False
278
                    if self.markdown_in_raw and 'markdown' in attrs.keys():
279
                        items[0] = items[0][left_index:]
280
                        items[-1] = items[-1][:-len(right_tag) - 2]
281
                        if items[len(items) - 1]:  # not a newline/empty string
282
                            right_index = len(items) + 3
283
                        else:
284
                            right_index = len(items) + 2
285
                        new_blocks.append(self.markdown.htmlStash.store_tag(
286
                            left_tag, attrs, 0, right_index))
287
                        placeholderslen = len(self.markdown.htmlStash.tag_data)
288
                        new_blocks.extend(
289
                            self._nested_markdown_in_html(items))
290
                        nests = len(self.markdown.htmlStash.tag_data) - \
291
                            placeholderslen
292
                        self.markdown.htmlStash.tag_data[-1 - nests][
293
                            'right_index'] += nests - 2
294
                    else:
295
                        new_blocks.append(
296
                            self.markdown.htmlStash.store('\n\n'.join(items)))
297
                    items = []
298
299
        if items: