Skip to content
This repository has been archived by the owner on Apr 4, 2020. It is now read-only.

Commit

Permalink
Prepare to release 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
colinodell committed Apr 11, 2019
1 parent 050452e commit 92806c3
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 61 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
@@ -1,8 +1,6 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,10 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased][unreleased]

[unreleased]: https://github.com/thephpleague/commonmark-ext-smartpunct/compare/v0.1.0...HEAD
## [0.2.0] - 2019-04-10

### Changed

- Made extension compatible with `league/commonmark` 0.19

## [0.1.0] - 2019-03-11

Split this extension out of the old `league/commonmark-extras` library.

[unreleased]: https://github.com/thephpleague/commonmark-ext-smartpunct/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/thephpleague/commonmark-ext-smartpunct/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/thephpleague/commonmark-ext-smartpunct/commits/v0.1.0
14 changes: 7 additions & 7 deletions composer.json
Expand Up @@ -14,21 +14,21 @@
}
],
"require": {
"php" : ">=5.6",
"league/commonmark": "^0.13|^0.14|^0.15|^0.16|^0.17|^0.18"
"php" : "^7.1",
"league/commonmark": "^0.19"
},
"require-dev": {
"jgm/smartpunct": "0.28",
"phpunit/phpunit": "^5.7"
"jgm/smartpunct": "0.29",
"phpunit/phpunit": "^7.5"
},
"repositories": [
{
"type": "package",
"package": {
"name": "jgm/smartpunct",
"version": "0.28",
"version": "0.29",
"dist": {
"url": "https://raw.githubusercontent.com/jgm/commonmark.js/0.28.0/test/smart_punct.txt",
"url": "https://raw.githubusercontent.com/jgm/commonmark.js/0.29.0/test/smart_punct.txt",
"type": "file"
}
}
Expand All @@ -49,7 +49,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.2-dev"
"dev-master": "0.3-dev"
}
}
}
7 changes: 2 additions & 5 deletions phpunit.xml.dist
Expand Up @@ -16,14 +16,11 @@
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
8 changes: 4 additions & 4 deletions src/PunctuationParser.php
Expand Up @@ -15,15 +15,15 @@
namespace League\CommonMark\Ext\SmartPunct;

use League\CommonMark\Inline\Element\Text;
use League\CommonMark\Inline\Parser\AbstractInlineParser;
use League\CommonMark\Inline\Parser\InlineParserInterface;
use League\CommonMark\InlineParserContext;

class PunctuationParser extends AbstractInlineParser
class PunctuationParser implements InlineParserInterface
{
/**
* @return string[]
*/
public function getCharacters()
public function getCharacters(): array
{
return ['-', '.'];
}
Expand All @@ -33,7 +33,7 @@ public function getCharacters()
*
* @return bool
*/
public function parse(InlineParserContext $inlineContext)
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
$ch = $cursor->getCharacter();
Expand Down
8 changes: 4 additions & 4 deletions src/QuoteParser.php
Expand Up @@ -16,19 +16,19 @@

use League\CommonMark\Delimiter\Delimiter;
use League\CommonMark\Inline\Element\Text;
use League\CommonMark\Inline\Parser\AbstractInlineParser;
use League\CommonMark\Inline\Parser\InlineParserInterface;
use League\CommonMark\InlineParserContext;
use League\CommonMark\Util\RegexHelper;

class QuoteParser extends AbstractInlineParser
class QuoteParser implements InlineParserInterface
{
protected $double = ['"', '“', '”'];
protected $single = ["'", '‘', '’'];

/**
* @return string[]
*/
public function getCharacters()
public function getCharacters(): array
{
return array_merge($this->double, $this->single);
}
Expand All @@ -38,7 +38,7 @@ public function getCharacters()
*
* @return bool
*/
public function parse(InlineParserContext $inlineContext)
public function parse(InlineParserContext $inlineContext): bool
{
$cursor = $inlineContext->getCursor();
$character = $this->getCharacterType($cursor->getCharacter());
Expand Down
50 changes: 12 additions & 38 deletions src/SmartPunctExtension.php
Expand Up @@ -17,51 +17,25 @@
use League\CommonMark\Block\Element\Document;
use League\CommonMark\Block\Element\Paragraph;
use League\CommonMark\Block\Renderer as CoreBlockRenderer;
use League\CommonMark\Extension\Extension;
use League\CommonMark\ConfigurableEnvironmentInterface;
use League\CommonMark\Extension\ExtensionInterface;
use League\CommonMark\Inline\Element\Text;
use League\CommonMark\Inline\Renderer as CoreInlineRenderer;

class SmartPunctExtension extends Extension
class SmartPunctExtension implements ExtensionInterface
{
/**
* {@inheritdoc}
*/
public function getInlineParsers()
public function register(ConfigurableEnvironmentInterface $environment)
{
return [
new QuoteParser(),
new PunctuationParser(),
];
}
$environment
->addInlineParser(new QuoteParser(), 10)
->addInlineParser(new PunctuationParser(), 0)

/**
* {@inheritdoc}
*/
public function getInlineProcessors()
{
return [
new QuoteProcessor(),
];
}
->addInlineProcessor(new QuoteProcessor(), 10)

/**
* {@inheritdoc}
*/
public function getBlockRenderers()
{
return [
Document::class => new CoreBlockRenderer\DocumentRenderer(),
Paragraph::class => new CoreBlockRenderer\ParagraphRenderer(),
];
}
->addBlockRenderer(Document::class, new CoreBlockRenderer\DocumentRenderer(), 0)
->addBlockRenderer(Paragraph::class, new CoreBlockRenderer\ParagraphRenderer(), 0)

/**
* {@inheritdoc}
*/
public function getInlineRenderers()
{
return [
Text::class => new CoreInlineRenderer\TextRenderer(),
];
->addInlineRenderer(Text::class, new CoreInlineRenderer\TextRenderer(), 0)
;
}
}

0 comments on commit 92806c3

Please sign in to comment.