Code Duplication    Length = 15-34 lines in 3 locations

app/Plugin/Markitup/Vendor/parser/markdown/markdown.php 3 locations

@@ 346-379 (lines=34) @@
343
		);
344
345
346
	function stripLinkDefinitions($text) {
347
	#
348
	# Strips link definitions from text, stores the URLs and titles in
349
	# hash references.
350
	#
351
		$less_than_tab = $this->tab_width - 1;
352
353
		# Link defs are in the form: ^[id]: url "optional title"
354
		$text = preg_replace_callback('{
355
							^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?:	# id = $1
356
							  [ ]*
357
							  \n?				# maybe *one* newline
358
							  [ ]*
359
							(?:
360
							  <(.+?)>			# url = $2
361
							|
362
							  (\S+?)			# url = $3
363
							)
364
							  [ ]*
365
							  \n?				# maybe one newline
366
							  [ ]*
367
							(?:
368
								(?<=\s)			# lookbehind for whitespace
369
								["(]
370
								(.*?)			# title = $4
371
								[")]
372
								[ ]*
373
							)?	# title is optional
374
							(?:\n+|\Z)
375
			}xm',
376
			array(&$this, '_stripLinkDefinitions_callback'),
377
			$text);
378
		return $text;
379
	}
380
	function _stripLinkDefinitions_callback($matches) {
381
		$link_id = strtolower($matches[1]);
382
		$url = $matches[2] == '' ? $matches[3] : $matches[2];
@@ 2645-2671 (lines=27) @@
2642
2643
	### Footnotes
2644
2645
	function stripFootnotes($text) {
2646
	#
2647
	# Strips link definitions from text, stores the URLs and titles in
2648
	# hash references.
2649
	#
2650
		$less_than_tab = $this->tab_width - 1;
2651
2652
		# Link defs are in the form: [^id]: url "optional title"
2653
		$text = preg_replace_callback('{
2654
			^[ ]{0,'.$less_than_tab.'}\[\^(.+?)\][ ]?:	# note_id = $1
2655
			  [ ]*
2656
			  \n?					# maybe *one* newline
2657
			(						# text = $2 (no blank lines allowed)
2658
				(?:
2659
					.+				# actual text
2660
				|
2661
					\n				# newlines but
2662
					(?!\[\^.+?\]:\s)# negative lookahead for footnote marker.
2663
					(?!\n+[ ]{0,3}\S)# ensure line is not blank and followed
2664
									# by non-indented content
2665
				)*
2666
			)
2667
			}xm',
2668
			array(&$this, '_stripFootnotes_callback'),
2669
			$text);
2670
		return $text;
2671
	}
2672
	function _stripFootnotes_callback($matches) {
2673
		$note_id = $this->fn_id_prefix . $matches[1];
2674
		$this->footnotes[$note_id] = $this->outdent($matches[2]);
@@ 2786-2800 (lines=15) @@
2783
2784
	### Abbreviations ###
2785
2786
	function stripAbbreviations($text) {
2787
	#
2788
	# Strips abbreviations from text, stores titles in hash references.
2789
	#
2790
		$less_than_tab = $this->tab_width - 1;
2791
2792
		# Link defs are in the form: [id]*: url "optional title"
2793
		$text = preg_replace_callback('{
2794
			^[ ]{0,'.$less_than_tab.'}\*\[(.+?)\][ ]?:	# abbr_id = $1
2795
			(.*)					# text = $2 (no blank lines allowed)
2796
			}xm',
2797
			array(&$this, '_stripAbbreviations_callback'),
2798
			$text);
2799
		return $text;
2800
	}
2801
	function _stripAbbreviations_callback($matches) {
2802
		$abbr_word = $matches[1];
2803
		$abbr_desc = $matches[2];