diff --git a/CHANGELOG.md b/CHANGELOG.md index a807881..2d81124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Version 1.2.1 work in progress ------------------------------ - Improved handling of inline HTML with URL and email tags. +- Improved handling of custom syntax with `[[`, references should not use `[` as the first character in the reference name. Version 1.2.0 on 14. Mar. 2018 ------------------------------ diff --git a/MarkdownExtra.php b/MarkdownExtra.php index c6866d3..eedcf77 100644 --- a/MarkdownExtra.php +++ b/MarkdownExtra.php @@ -69,7 +69,7 @@ class MarkdownExtra extends Markdown protected function identifyReference($line) { - return ($line[0] === ' ' || $line[0] === '[') && preg_match('/^ {0,3}\[(.+?)\]:\s*([^\s]+?)(?:\s+[\'"](.+?)[\'"])?\s*('.$this->_specialAttributesRegex.')?\s*$/', $line); + return ($line[0] === ' ' || $line[0] === '[') && preg_match('/^ {0,3}\[[^\[](.*?)\]:\s*([^\s]+?)(?:\s+[\'"](.+?)[\'"])?\s*('.$this->_specialAttributesRegex.')?\s*$/', $line); } /** diff --git a/inline/LinkTrait.php b/inline/LinkTrait.php index bf79b3a..bb6c45f 100644 --- a/inline/LinkTrait.php +++ b/inline/LinkTrait.php @@ -254,7 +254,7 @@ protected function renderImage($block) protected function identifyReference($line) { - return isset($line[0]) && ($line[0] === ' ' || $line[0] === '[') && preg_match('/^ {0,3}\[(.+?)\]:\s*([^\s]+?)(?:\s+[\'"](.+?)[\'"])?\s*$/', $line); + return isset($line[0]) && ($line[0] === ' ' || $line[0] === '[') && preg_match('/^ {0,3}\[[^\[](.*?)\]:\s*([^\s]+?)(?:\s+[\'"](.+?)[\'"])?\s*$/', $line); } /** diff --git a/tests/markdown-data/list_items_with_undefined_ref.html b/tests/markdown-data/list_items_with_undefined_ref.html index 53ea8df..6cd231f 100644 --- a/tests/markdown-data/list_items_with_undefined_ref.html +++ b/tests/markdown-data/list_items_with_undefined_ref.html @@ -8,3 +8,7 @@ it to use by setting its db property.

+ diff --git a/tests/markdown-data/list_items_with_undefined_ref.md b/tests/markdown-data/list_items_with_undefined_ref.md index 98a40fe..5ae7e82 100644 --- a/tests/markdown-data/list_items_with_undefined_ref.md +++ b/tests/markdown-data/list_items_with_undefined_ref.md @@ -5,3 +5,7 @@ * [[\yii\caching\DbCache]]: uses a database table to store cached data. By default, it will create and use a [SQLite3](http://sqlite.org/) database under the runtime directory. You can explicitly specify a database for it to use by setting its `db` property. + + +* [[yii\caching\Cache::get()|get()]]: 指定されたキーを用いてキャッシュからデータを取得します。データが見つからないか、もしくは有効期限が切れたり無効になったりしている場合は false を返します。 +* [[yii\caching\Cache::set()|set()]]: キーによって識別されるデータをキャッシュに格納します。