Skip to content

Commit

Permalink
Merge pull request #61 from thephpleague/spec-0.17
Browse files Browse the repository at this point in the history
Spec 0.17
  • Loading branch information
colinodell committed Jan 25, 2015
2 parents 7195613 + ab8721b commit ad1b894
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip

## [Unreleased][unreleased]

## [0.6.1] - 2015-01-25
### Changed
- Bumped spec target version to 0.17
- Updated emphasis parsing for underscores to prevent intra-word emphasis
- Defered closing of fenced code blocks

## [0.6.0] - 2015-01-09
### Added
- Bulk registration of parsers/renderers via extensions (#45)
Expand Down Expand Up @@ -122,7 +128,8 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
### Added
- Initial commit (compatible with jgm/stmd:spec.txt @ 0275f34)

[unreleased]: https://github.com/thephpleague/commonmark/compare/0.6.0...HEAD
[unreleased]: https://github.com/thephpleague/commonmark/compare/0.6.1...HEAD
[0.6.1]: https://github.com/thephpleague/commonmark/compare/0.6.0...0.6.1
[0.6.0]: https://github.com/thephpleague/commonmark/compare/0.5.1...0.6.0
[0.5.1]: https://github.com/thephpleague/commonmark/compare/0.5.0...0.5.1
[0.5.0]: https://github.com/thephpleague/commonmark/compare/0.4.0...0.5.0
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ The following table shows which versions of league/commonmark are compatible wit
</thead>
<tbody>
<tr>
<td><strong>0.6.0</strong></td>
<td><strong><a href="http://spec.commonmark.org/0.16/">0.16</a></strong><br><a href="http://spec.commonmark.org/0.15/">0.15</a><br><a href="http://spec.commonmark.org/0.14/">0.14</a></td>
<td>current spec (as of Jan 15 '15)</td>
<td><strong>0.6.1</strong></td>
<td><strong><a href="http://spec.commonmark.org/0.17/">0.17</a></strong></td>
<td>current spec (as of Jan 25 '15)</td>
</tr>
<tr>
<td>0.6.0</td>
<td><a href="http://spec.commonmark.org/0.16/">0.16</a><br><a href="http://spec.commonmark.org/0.15/">0.15</a><br><a href="http://spec.commonmark.org/0.14/">0.14</a></td>
<td></td>
</tr>
<tr>
<td>0.5.x<br>0.4.0</td>
<td><a href="http://spec.commonmark.org/0.13/">0.13</a></td>
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"require-dev": {
"erusev/parsedown": "~1.0",
"jgm/CommonMark": "0.16",
"jgm/CommonMark": "0.17",
"michelf/php-markdown": "~1.4",
"phpunit/phpunit": "~4.3"
},
Expand All @@ -31,9 +31,9 @@
"type": "package",
"package": {
"name": "jgm/CommonMark",
"version": "0.16",
"version": "0.17",
"dist": {
"url": "http://spec.commonmark.org/0.16/spec.txt",
"url": "http://spec.commonmark.org/0.17/spec.txt",
"type": "file"
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/Block/Element/FencedCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ public function isCode()

public function matchesNextLine(Cursor $cursor)
{
if ($this->length === -1) {
if ($cursor->isBlank()) {
$this->lastLineBlank = true;
}

return false;
}

// Skip optional spaces of fence offset
$cursor->advanceWhileMatches(' ', $this->offset);

Expand Down Expand Up @@ -198,7 +206,7 @@ public function handleRemainingContents(ContextInterface $context, Cursor $curso
$match = RegexHelper::matchAll('/^(?:`{3,}|~{3,})(?= *$)/', $cursor->getLine(), $cursor->getFirstNonSpacePosition());
if (strlen($match[0]) >= $container->getLength()) {
// don't add closing fence to container; instead, close it:
$container->finalize($context);
$this->setLength(-1); // -1 means we've passed closer

return;
}
Expand Down
11 changes: 7 additions & 4 deletions src/Inline/Parser/EmphasisParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,22 @@ public function parse(ContextInterface $context, InlineParserContext $inlineCont

$charAfter = $cursor->getCharacter() ?: "\n";

$canOpen = $numDelims > 0 && !preg_match('/\pZ|\s/u', $charAfter) &&
$leftFlanking = $numDelims > 0 && !preg_match('/\pZ|\s/u', $charAfter) &&
!(preg_match(RegexHelper::REGEX_PUNCTUATION, $charAfter) &&
!preg_match('/\pZ|\s/u', $charBefore) &&
!(preg_match(RegexHelper::REGEX_PUNCTUATION, $charBefore)));

$canClose = $numDelims > 0 && !preg_match('/\pZ|\s/u', $charBefore) &&
$rightFlanking = $numDelims > 0 && !preg_match('/\pZ|\s/u', $charBefore) &&
!(preg_match(RegexHelper::REGEX_PUNCTUATION, $charBefore) &&
!preg_match('/\pZ|\s/u', $charAfter) &&
!(preg_match(RegexHelper::REGEX_PUNCTUATION, $charAfter)));

if ($character === '_') {
$canOpen = $canOpen && !preg_match('/[a-z0-9]/i', $charBefore);
$canClose = $canClose && !preg_match('/[a-z0-9]/i', $charAfter);
$canOpen = $leftFlanking && !$rightFlanking;
$canClose = $rightFlanking && !$leftFlanking;
} else {
$canOpen = $leftFlanking;
$canClose = $rightFlanking;
}

$inlineContext->getInlines()->add(
Expand Down

0 comments on commit ad1b894

Please sign in to comment.