Skip to content

Commit 4d34d70

Browse files
committed
code style fixes and trait consistency
1 parent d4d5858 commit 4d34d70

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

CHANGELOG.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ Version 1.1.0 on 06. Mar. 2015
3939
- Lines containing "0" where skipped or considered empty in some cases (@tanakahisateru)
4040
- #54 escape characters are now also considered inside of urls
4141

42-
Version 1.0.1 on 25. Okt. 2014
42+
Version 1.0.1 on 25. Oct. 2014
4343
------------------------------
4444

4545
- Fixed the `bin/markdown` script to work with composer autoloader (c497bada0e15f61873ba6b2e29f4bb8b3ef2a489)
4646
- #74 fixed a bug that caused a bunch of broken characters when non-ASCII input was given. Parser now handles UTF-8 input correctly. Other encodings are currently untested, UTF-8 is recommended.
4747

48-
Version 1.0.0 on 12. Okt. 2014
48+
Version 1.0.0 on 12. Oct. 2014
4949
------------------------------
5050

5151
This is the first stable release of version 1.0 which is incompatible to the 0.9.x branch regarding the internal API which is used when extending the Markdown parser. The external API has no breaking changes. The rendered Markdown however has changed in some edge cases and some rendering issues have been fixed.
@@ -58,7 +58,7 @@ You can try it out on the website: <http://markdown.cebe.cc/try>
5858

5959
The parser is now also regsitered on the [Babelmark 2 page](http://johnmacfarlane.net/babelmark2/?normalize=1&text=Hello+**World**!) by [John MacFarlane](http://johnmacfarlane.net/) which you can use to compare Markdown output of different parsers.
6060

61-
Version 1.0.0-rc on 10. Okt. 2014
61+
Version 1.0.0-rc on 10. Oct. 2014
6262
---------------------------------
6363

6464
- #21 speed up inline parsing using [strpbrk](http://www.php.net/manual/de/function.strpbrk.php) about 20% speedup compared to parsing before.

Parser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class Parser
2121
public $maximumNestingLevel = 32;
2222

2323
/**
24-
* @var string the current context the parser is in.
24+
* @var array the current context the parser is in.
2525
* TODO remove in favor of absy
2626
*/
2727
protected $context = [];

inline/EmphStrongTrait.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ protected function parseEmphStrong($text)
5454
return [['text', $text[0]], 1];
5555
}
5656

57-
if ($marker == '*' && preg_match('/^[*]((?:[^*]|[*][*][^*]+?[*][*])+?)[*](?![*][^*])/s', $text, $matches) ||
58-
$marker == '_' && preg_match('/^_((?:[^_]|__[^_]*__)+?)_(?!_[^_])\b/us', $text, $matches)) {
57+
if ($marker === '*' && preg_match('/^[*]((?:[^*]|[*][*][^*]+?[*][*])+?)[*](?![*][^*])/s', $text, $matches) ||
58+
$marker === '_' && preg_match('/^_((?:[^_]|__[^_]*__)+?)_(?!_[^_])\b/us', $text, $matches)) {
5959
return [
6060
[
6161
'emph',
@@ -77,4 +77,7 @@ protected function renderEmph($block)
7777
{
7878
return '<em>' . $this->renderAbsy($block[1]) . '</em>';
7979
}
80+
81+
abstract protected function parseInline($text);
82+
abstract protected function renderAbsy($blocks);
8083
}

inline/StrikeoutTrait.php

+3
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@ protected function renderStrike($block)
3434
{
3535
return '<del>' . $this->renderAbsy($block[1]) . '</del>';
3636
}
37+
38+
abstract protected function parseInline($text);
39+
abstract protected function renderAbsy($blocks);
3740
}

0 commit comments

Comments
 (0)