Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed extracting of first sentence from the text containing backticks #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
samdark merged 64 commits into yiisoft:master from arogachev:128-first-sentence-backticks
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
7aa586d
Draft for 3.0
Aug 30, 2021
0f5df6c
Merge remote-tracking branch 'origin/3.0' into 3.0
arogachev Nov 1, 2021
b8e27f6
Simplify dependencies in composer.json
arogachev Nov 3, 2021
ac33ed2
Minimal working version, various fixes
arogachev Nov 4, 2021
072e760
Remove older PHP versions for tests, add PHP 8
arogachev Nov 4, 2021
1ac13d8
Allow PHP 8 as a dependency in composer.json
arogachev Nov 4, 2021
79f933e
Leave hard coded value (isReturnByReference in FunctionDoc)
arogachev Nov 4, 2021
b1095fc
Remove unnecessary elseif block
arogachev Nov 4, 2021
c70b044
Move construct method to the top, remove commented out code
arogachev Nov 4, 2021
22ab8c5
Make use of StringHelper::mb_ucfirst()
arogachev Nov 4, 2021
2f798bf
Actualize stubs for setting type and types based on getType()
arogachev Nov 4, 2021
186944f
Use fork, restore endLine and isReturnByReference logic
arogachev Nov 4, 2021
aaf5dbd
Handle getNode()->default, do not remove deprecated methods' bodies
arogachev Nov 5, 2021
d12e8ce
Removed author for consistency
arogachev Nov 5, 2021
6036566
Cleanup
arogachev Nov 5, 2021
7f1178a
Handle type / types in TypeDoc, get rid of addProjectFile
arogachev Nov 5, 2021
b3b44fc
Fix undefined variable $type
arogachev Nov 5, 2021
e4f989c
Cleanup tests
arogachev Nov 5, 2021
ab6b134
Fix first 5 errors after testing on Yii 2 docs
arogachev Nov 5, 2021
01f5450
Make setUp compatible with parent (PHPUnit)
arogachev Nov 5, 2021
63f5426
Fix "Undefined array key 0" error
arogachev Nov 8, 2021
1207b7a
Fix "Call to undefined method Generic::getContent()" in Context
arogachev Nov 8, 2021
fcafd6a
Fix "Class Collection not found" error
arogachev Nov 8, 2021
f246153
Fix regression with parentheses with MethodDoc
arogachev Nov 8, 2021
73f12e8
Fix property-read / property-write parsing issues
arogachev Nov 8, 2021
3b700bd
Fix event description (was merged with class name and not capitalized)
arogachev Nov 8, 2021
7b3e0d3
Fix issue when "seeAlso" partial template was not rendered
arogachev Nov 9, 2021
b381335
Revert str_contains -> strpos
arogachev Nov 9, 2021
598c559
Handle null in aggregated type during split types
arogachev Nov 9, 2021
1b432ff
Fix broken links
arogachev Nov 9, 2021
bfbe60e
Fix regression ("mixed" in params in method signature)
arogachev Nov 9, 2021
b901254
This kind of refactoring can be done later (better diffs)
arogachev Nov 9, 2021
b710ee2
Fix pretty print of default value in property
arogachev Nov 10, 2021
a026269
Fix higlighting of backslashes (temporary solution)
arogachev Nov 11, 2021
1cf8015
Use namespace aliases for event names
arogachev Nov 11, 2021
1d2432d
Handle regression \u -> \\u in class constants' values
arogachev Nov 12, 2021
54987b9
Revert hacky attempt of fixing highlighting of backslashes
arogachev Nov 12, 2021
c036235
Fix name and type hint for params in method when it's declared via tag
arogachev Nov 12, 2021
43c814b
Fix as many warnings as possible, check docstrings
arogachev Nov 15, 2021
b8d5890
Update CHANGELOG.md
arogachev Nov 15, 2021
6895aa4
Update renderers/BaseRenderer.php
arogachev Nov 23, 2021
c3eadfe
Simplify string concatenation even more
arogachev Nov 23, 2021
8dd3238
Issue #133 is fixed too [skip ci]
arogachev Nov 23, 2021
bb1d465
Issue #155 is fixed too [skip ci]
arogachev Nov 23, 2021
87b8d63
Issue #162 is fixed too [skip ci]
arogachev Nov 23, 2021
21f8055
Issue #179 is fixed too [skip ci]
arogachev Nov 23, 2021
bcc44fa
Issue #199 is fixed too [skip ci]
arogachev Nov 23, 2021
7e98c64
Fix issue #143 (do not include internal methods and properties) [skip...
arogachev Nov 23, 2021
255733f
Add issue #180 in CHANGELOG.md[skip ci]
arogachev Nov 23, 2021
f9bef8f
Add issue #148 to CHANGELOG.md [skip ci]
arogachev Nov 24, 2021
5b2f0b7
Fixed issue #197 [skip ci]
arogachev Nov 24, 2021
7ceaa5a
Add prefix and suffix when fixing Markdown links
arogachev Nov 24, 2021
969362b
Merge branch 'master' into 3.0
arogachev Nov 25, 2021
bb94d19
Do not add guide prefix to non-Markdown links
arogachev Nov 25, 2021
5b068ef
Extract changes for issue #180 to a separate branch
arogachev Nov 23, 2021
d97b25c
Extract changes for issue #197 to a separate branch
arogachev Nov 25, 2021
0ec0800
Remove whitespace at the end of line [skip ci]
arogachev Nov 25, 2021
e1baa3d
Fixed extracting of first sentence from the text containing backticks
arogachev Nov 29, 2021
5bfb0f3
Merge branch 'master' into 128-first-sentence-backticks
samdark Nov 30, 2021
0d734a0
Merge branch 'master' into 128-first-sentence-backticks
arogachev Dec 1, 2021
9fe7274
Merge remote-tracking branch 'origin/128-first-sentence-backticks' in...
arogachev Dec 1, 2021
e04ed05
Sync CHANGELOG.md with master
arogachev Dec 1, 2021
0b23716
Sync PrettyPrinter.php with master
arogachev Dec 1, 2021
3bde22d
Merge branch 'master' into 128-first-sentence-backticks
samdark Dec 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Yii Framework 2 apidoc extension Change Log
- Bug #179: Fixed incorrect output when string type hint is used in method parameters (arogachev)
- Bug #199: Fixed processing of nullable return types (arogachev)
- Bug #148: Fixed processing of code containing uniform variable syntax (arogachev)
- Bug #128: Fixed extracting of first sentence from the text containing backticks (arogachev)
- Enh #209: Added support for todos in properties and methods (arogachev)
- Enh #18: Added pretty print for arrays (arogachev)

Expand Down
7 changes: 6 additions & 1 deletion models/BaseDoc.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ public static function extractFirstSentence($text)
$sentence = mb_substr($text, 0, $pos + 1, 'utf-8');
if (mb_strlen($text, 'utf-8') >= $pos + 3) {
$abbrev = mb_substr($text, $pos - 1, 4, 'utf-8');
if ($abbrev === 'e.g.' || $abbrev === 'i.e.') { // do not break sentence after abbreviation
// do not break sentence after abbreviation
if ($abbrev === 'e.g.' ||
$abbrev === 'i.e.' ||
mb_substr_count($sentence, '`', 'utf-8') % 2 === 1 ||
mb_substr_count($text, '`', 'utf-8') % 2 === 1
) {
$sentence .= static::extractFirstSentence(mb_substr($text, $pos + 1, mb_strlen($text, 'utf-8'), 'utf-8'));
}
}
Expand Down
25 changes: 25 additions & 0 deletions tests/models/BaseDocTest.php
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/

namespace yiiunit\apidoc\models;

use PHPUnit\Framework\TestCase;
use yii\apidoc\models\BaseDoc;

class BaseDocTest extends TestCase
{
/**
* @link https://github.com/yiisoft/yii2-apidoc/issues/128
*/
public function testExtractFirstSentenceWithBackticks()
{
$initialText = 'the host info (e.g. `http://www.example.com`) that is used by [[createAbsoluteUrl()]] to ' .
'prepend to created URLs.';
$firstSentence = BaseDoc::extractFirstSentence($initialText);
$this->assertEquals($initialText, $firstSentence);;
}
}

AltStyle によって変換されたページ (->オリジナル) /